Skip to content

Commit

Permalink
Override toString() for delegating connection (#2335)
Browse files Browse the repository at this point in the history
Motivation:

#2278 added a new connection wrapper
`DefaultFilterableStreamingHttpLoadBalancedConnection` that does not
implement `toString()`. It hides the channel id in RRLB logs.

Modifications:

- Implement `toString()` for
`DefaultFilterableStreamingHttpLoadBalancedConnection` in
`HttpLoadBalancerFactory` and `DefaultHttpLoadBalancerFactory`;
- Make `AbstractStreamingHttpConnection#toString()` final;

Result:

RRLB logs include channel id.
  • Loading branch information
idelpivnitskiy authored Sep 8, 2022
1 parent 6b6b162 commit 8efc07a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,10 @@ public ReservedBlockingStreamingHttpConnection asBlockingStreamingConnection() {
public ReservedBlockingHttpConnection asBlockingConnection() {
return toReservedBlockingConnection(this, executionContext().executionStrategy());
}

@Override
public String toString() {
return delegate.toString();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public final Completable closeAsyncGracefully() {
}

@Override
public String toString() {
public final String toString() {
return getClass().getName() + '(' + connectionContext + ')';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,10 @@ public Completable closeAsyncGracefully() {
public StreamingHttpRequest newRequest(final HttpRequestMethod method, final String requestTarget) {
return delegate.newRequest(method, requestTarget);
}

@Override
public String toString() {
return delegate.toString();
}
}
}

0 comments on commit 8efc07a

Please sign in to comment.