You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once we added dependency to this library: io.opentelemetry.instrumentation / opentelemetry-grpc-1.6
It will inject the ContextStorageBridge, with that, it changes the Context.current() behavior, it will return a new Object everytime call the method. That causes various issue such as it breaks the unit test that depends the equality of the Context.
Steps to reproduce
Add dependency to: io.opentelemetry.instrumentation / opentelemetry-grpc-1.6
@jianwu is there anything in gRPC documentation that requires Context.current() to return the same instance. Or is this an undocumented behavior that your application relies on?
Not sure if this is specified. But this seems to be a common sense behavior. When you call a current() multiple times, if you return a different object every time, it will cause surprise and also performance issue. In our case, we have unit test that verify the GRpc context is not changed after calling some logic. And those unit test has nothing to do with OTel at all. Only because we added the dependency in a lower level common library. As the OTel version of ContextStorageOverride is dynamically discovered. It breaks those unit tests.
This breakage is hard to troubleshoot. Also I can't find a workaround for this issue and there's no meaningful equal() for GRpc context.
Describe the bug
Once we added dependency to this library: io.opentelemetry.instrumentation / opentelemetry-grpc-1.6
It will inject the
ContextStorageBridge
, with that, it changes theContext.current()
behavior, it will return a new Object everytime call the method. That causes various issue such as it breaks the unit test that depends the equality of the Context.Steps to reproduce
Add dependency to: io.opentelemetry.instrumentation / opentelemetry-grpc-1.6
Run following code:
Expected behavior
It prints "false"
Actual behavior
it should print "true"
Javaagent or library instrumentation version
1.64.0
Environment
JDK: Java 17
OS: Mac os
Additional context
No response
The text was updated successfully, but these errors were encountered: