-
Notifications
You must be signed in to change notification settings - Fork 324
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
OTel SpanLink results in ClassCastException #3662
Comments
Hi, I've managed to reproduce the error that you are facing here and the agent should not trigger a The problem here is that you are manually creating a Can you elaborate a bit on the use-case that you are trying to achieve here ? Maybe there is a simpler option by using a span attribute as a work-around for your use case. |
I have just implemented a "work-around" that just properly warns that using arbitrary spans context is not supported with the otel bridge. #3672 A snapshot is available here if you'd like to test it. |
Thanks for the reply. Our goal is to spin up a new trace per asynchronous job, and associate the newly created trace with the one that enqueued the job. Similar to what is described here; https://opentelemetry.io/docs/concepts/signals/traces/#span-links Request (Trace 1) --> Enqueue Job (metadata: T1TraceId, T1SpanId) -> Asynchronous Job Executed (Spin up Trace 2, and associated with Trace 1). Is this achievable using the otel bridge, or the elastic apm api? |
Do you have a strong requirement to use Elastic APM agent here ? As you are already using the OpenTelemetry API, it might be more natural to use an opentelemetry agent and not the opentelemetry bridge in our APM agent. I would suggest to use our new opentelemetry java distribution or the upstream opentelemetry instrumentation agent, the data captured by those can be ingested as-is in APM. |
Thanks for the reply. The Will the https://github.com/elastic/elastic-otel-java/ replace the |
The classic Elastic APM Java agent has many features not yet available in the OpenTelemetry distribution. We are implementing these in our distribution and gradually contributing these upstream to OpenTelemetry. This is likely to take some time, so the long run could be quite long and ultimately it will come down to customer demand. Which is a long-winded way of saying maybe |
Describe the bug
The
OTelSpanBuilder
is unable to handle linkedAutoValue_ImmutableSpanContext
.Should
io.opentelemetry.api.trace.SpanContext.create()
be instrumented and return aOTelSpanContext
instead?apm-agent-java/apm-agent-plugins/apm-opentelemetry/apm-opentelemetry-plugin/src/main/java/co/elastic/apm/agent/opentelemetry/tracing/OTelSpanBuilder.java
Line 198 in 0e1fb43
Steps to reproduce
Expected behavior
The linked span context should work as expected.
Solution
I began implementing a
SpanContextOpenTelemetryInstrumentation
, but was unable to set thetraceId
inTraceContext
without using reflection.The text was updated successfully, but these errors were encountered: