-
Notifications
You must be signed in to change notification settings - Fork 4k
core,testing: deprecate passing ServerCall to StatsTraceContext #3912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
core,testing: deprecate passing ServerCall to StatsTraceContext #3912
Conversation
Instead, pass a ServerCallInfo object containing the interesting bits of info. This lets us modify the call handler for binary logging, but still provide the original info to the StatsTraceContext API.
|
This PR is required for #3879 |
|
@zhangkun83 PTAL |
| * handler. | ||
| */ | ||
| @SuppressWarnings("deprecation") | ||
| public void serverCallStarted(final ServerCallInfo<?, ?> callInfo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Argument doesn't need to be final.
| public boolean isCancelled() { | ||
| return isCancelled; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ServerCallInfo is passed only to serverCallStarted(). isReady() and isCancelled() don't seem to be useful at that point. We should probably remove them.
|
@zhangkun83 ping The GAE failure is due to an unrelated issue #4000 |
| private final Attributes attributes; | ||
| private final String authority; | ||
|
|
||
| ServerCallInfo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... if you lock down the constructor, how do people outside of gRPC unit-test their own ServerStreamTracers?
Maybe this should be an abstract class, and put the impl in io/grpc/internal.
| /** | ||
| * An implementation of {@link ServerCallInfo}. | ||
| */ | ||
| public final class ServerCallInfoImpl<ReqT, RespT> extends ServerCallInfo<ReqT, RespT> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be package-private.
Instead, pass a ServerCallInfo object containing the interesting bits
of info. This lets us modify the call handler for binary logging, but
still provide the original info to the StatsTraceContext API.
Updated unit tests and existing code to use new API
Modified existing tests that were overspecified, and failed because of new but harmless mock interactions.