-
Notifications
You must be signed in to change notification settings - Fork 873
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
Implement a dedicated reactor-netty 1.0 instrumentation #4662
Implement a dedicated reactor-netty 1.0 instrumentation #4662
Conversation
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.
nice 🎉
if (propagatedContext.useClientContext) { | ||
context = contextView.getOrDefault(ReactorContextKeys.CLIENT_CONTEXT_KEY, null); | ||
} | ||
if (context == null) { | ||
context = contextView.getOrDefault(ReactorContextKeys.CLIENT_PARENT_CONTEXT_KEY, null); | ||
} |
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.
is the fallback in case of useClientContext
important? (vs straight if/else here)
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.
It is -- when reactor-netty span is suppressed and client context is not accessible from the reactor's ContextView
we still want to execute the doOn*()
callbacks with the parent context in scope.
.../io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/HttpClientInstrumentation.java
Outdated
Show resolved
Hide resolved
.../io/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/HttpClientInstrumentation.java
Outdated
Show resolved
Hide resolved
...ntelemetry/javaagent/instrumentation/reactornetty/v1_0/HttpResponseReceiverInstrumenter.java
Outdated
Show resolved
Hide resolved
...ntelemetry/javaagent/instrumentation/reactornetty/v1_0/HttpResponseReceiverInstrumenter.java
Show resolved
Hide resolved
...ntelemetry/javaagent/instrumentation/reactornetty/v1_0/HttpResponseReceiverInstrumenter.java
Outdated
Show resolved
Hide resolved
// connection is actually an instance of HttpClientOperations - a package private class that | ||
// implements both Connection and HttpClientResponse |
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.
thx for these comments ❤️
...o/opentelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyClientSslTest.groovy
Show resolved
Hide resolved
...ntelemetry/javaagent/instrumentation/reactornetty/v1_0/ReactorNettyConnectionSpanTest.groovy
Show resolved
Hide resolved
// needs to be called after original method to prevent StackOverflowError | ||
callDepth.decrementAndGet(); |
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.
can you move the callDepth update to beginning of these methods? I'm just paranoid about resetting thread local state 😄
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.
I have to decrement the count after the original response*()
method is called, that's why they're the last thing I'm calling. I've wrapped those invocations in try-finally blocks - now the counter will always be decremented.
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.
oh, i completely missed the skipOn
and what was happening here 👍
|
||
Context context = instrumenter().start(parentContext, config); | ||
contextHolder.context = context; | ||
return ContextPropagationOperator.runWithContext(mono, context) |
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.
nice! it looks like pure context API is still useful even without extra convenience we discussed to start spans
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.
Yes, it turned out to be super useful this time 🚀
Co-authored-by: Trask Stalnaker <[email protected]>
…ry#4662) * Implement a dedicated reactor-netty 1.0 instrumentation * Apply suggestions from code review Co-authored-by: Trask Stalnaker <[email protected]> * code review comments * code review comments * code review comments Co-authored-by: Trask Stalnaker <[email protected]>
This PR introduces a completely new reactor-netty 1.0 instrumentation; one that does not rely on netty client instrumentation to produce telemetry. The HTTP client span is now the parent of RESOLVE/CONNECT/SSL spans, as I suggested in #4617:
(Now I only need to change the kind of those nested spans from
INTERNAL
toCLIENT
...)CC @lmolkova