-
Notifications
You must be signed in to change notification settings - Fork 565
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
SpanListener do not get invoked when native OTel tracer is used via Inject or unwrap #9079
Comments
Hi @m0mus |
The task has been categorized as a normal priority item. We do not currently have an estimated completion date, but considering the number of high priority tasks in the queue, it is unlikely to be completed in the immediate future. Is there a specific urgency associated with this task that we should be aware of? |
it's required for spectra module |
You are referring to two different technology implementations: Helidon tracing (which supports, among others, OpenTelemetry tracing) and Helidon's implementation of the MicroProfile Telemetry 1.1 spec which is layered on OpenTelemetry tracing. First, a clarification. I do not see how the current Helidon code can be "breaking" any solutions in an app or library. I understand that you are asking Helidon to provide some additional functionality, but "breaking" refers to changes which cause working code to stop working. The code you are referring to could not ever have worked the way you want because, as you point out, the injected OTel tracers or spans have never participated in the separate Helidon tracing span listener feature. Now, as to your specific suggestions and requests...
|
Thanks for reviewing the requirements . This requirement is for a library that relies on SpanListener for emitting Spans as events in JFR. This helps us to co-related JVM events such as GC pauses, socket reads, even method samples etc with associated Span and do deeper analysis. This functionality is very critical for root cause analysis of slow requests both for production as well during performance tests.
I thought this already works. The MixedTelemetryGreetResource example uses such an approach. However the services directly use MP Telemetry.,and native OTel tracers. For this usage where services directly use native OTel API , as one would expect the SpanListener is not invoked and those spans will not make it to JFR as events. So the solution we have breaks for such usages. This is what I meant when I said breaks the solution.
So net we would need a solution, where we need the Helidon SpanListener methods to be invoked , even when services are directly using the OTel API’s, either by injecting OTel tracer or when OTel tracer is obtained by unwrapping a Helidon Tracer. |
Would the following work for you... Suppose Helidon provided a way--perhaps through configuration--for you to select that the injected MP Telemetry types:
This means that uses of |
Sure, we can try it out if a prototype implementation is provided.
If the wrappers implement standard OpenTelemetry api interfaces , instanceof or cast to to standard Otel interfaces ( io.opentelemetry.api.trace.Tracer, io.opentelemetry.api.trace.Span ). should still work, right? I guess the. instanceof or cast to implementation types ( io.opentelemetry.sdk.trace.sdkTracer, io.opentelemetry.sdk.trace.SdkSpan etc.) will break. The Helidon provided injected MP Telemetry wrappers, can maintain a reference to original implementation(SdkSpan, SdkTracer) as a delegate, can provide unwrap() method to get the native OTel types. This approach is used in the implementation of unwrap() method ( below for ref) io.helidon.tracing.providers.opentelemetry.OpenTelemetrySpan
Can a similar approach be done here as well? |
|
Environment Details
Problem Description
Helidon 4.x supports the direct use of direct native OpenTelemetry Tracer ( io.opentelemetry.api.trace.Tracer) by services code in addition to use of Helidon's wrapper API's ( io.helidon.tracing.Tracer ) .
There are multiple ways the native Otel tracer can be used. For. such use cases since he wrapper is not involved the SpanListener do not get invoked. This will break the solutions ( RIC telemetry-jar) that are implemented based on Span Listener life cycle events.
private io.opentelemetry.api.trace.Tracer tracer;
By unwrapping the Helidon Tracer
var tracer = io.helidon.tracing.Tracer.global();
io.opentelemetry.api.trace.Tracer unwrapped = tracer.unwrap(io.opentelemetry.api.trace.Tracer.class);
Span span = unwrapped.spanBuilder("custom").startSpan();
The ask here is to explore the options, on SpanListeners invoked.
For example , For. usecase #1 above, where native OTel tracer is injected.
would it make sense to have a separate wrapped Tracer ( that actually implements io.opentelemetry.api.trace.Tracer and adds the SpanListener feature ) injected instead of the injecting the instance of “io.opentelemetry.sdk.trace.SdkTracer”
For #2, Similarly, Can the unwrap() of. Helidon Tracer unwrap to new wrapped Tracer that implements io.opentelemetry.api.trace.Tracer instead of “io.opentelemetry.sdk.trace.SdkTracer” ?
The text was updated successfully, but these errors were encountered: