elastic / apm-agent-java

https://www.elastic.co/guide/en/apm/agent/java/current/index.html
Apache License 2.0
560 stars 320 forks source link

Warn unexpected SpanContext in otel span link #3672

Closed SylvainJuge closed 3 weeks ago

SylvainJuge commented 3 weeks ago

What does this PR do?

The OpenTelemetry API allows to use arbitrary SpanContext instances with io.opentelemetry.api.trace.SpanBuilder#addLink(io.opentelemetry.api.trace.SpanContext).

However the otel bridge implementation only works with OTelSpanContext that are created from Elastic traces, and we do not currently support to create OTelSpanContext from arbitrary IDs.

This PR currently introduces a warning and silently avoid throwing an exception.

Relates to https://github.com/elastic/apm-agent-java/issues/3662

Checklist