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
Results in a span like this:
With a different traceId and no parentSpanId.
This despite the context correctly being extracted by @aws/otel-aws-xray-propagator:
Note the EXTRACTED_SPAN_CONTEXT Symbol. I couldn't find this anywhere in the opentelemetry-js source code, but it turns out this was removed in open-telemetry/opentelemetry-js#1589. Those changes were released as part of 0.12.0.
It turns out this is happening because when @aws/otel-aws-xray-propagatorcalls setExtractedSpanContext, it's calling @opentelemetry/core@0.10.2's version of that function, which still uses the EXTRACTED_SPAN_CONTEXT Symbol
When tracer.startSpan then tries to read the context, it's using our app's version of the core and api (0.12.0) and goes through this flow:
getActiveSpan tries to read the value using the ACTIVE_SPAN_KEY key, but there's nothing there so it returns undefined. This then bubbles back up the stack to become the return value of getParent in startSpan. startSpan then creates the span as a new root span with a new trace ID and no parent.
@aws/otel-aws-xray-propagator depends on "@opentelemetry/core": "^0.10.2". Because the version is specified using a caret (^), it accepts newer versions that do not modify the left-most non-zero digit. Since opentelemetry-js is still in the 0.x.x version range, this means that e.g. 0.10.3 would be accepted but 0.11.0 would not. In my case it results in @aws/otel-aws-xray-propagator having its own version of @opentelemetry/core@0.10.2 in its node_modules folder and it using that over the version we use in our app. Ditto for @opentelemetry/api.
Fixing the issue is probably a matter of upgrading @aws/otel-aws-xray-propagator's dependencies to 0.12.0 and adapting to any potential breaking changes in the propagator API.
The text was updated successfully, but these errors were encountered:
mickdekkers
changed the title
OpenTelemetry Propagator AWS X-Ray does not work with @opentelemetry/core >=0.12.x
OpenTelemetry Propagator AWS X-Ray does not work with @opentelemetry/core and api >=0.12.x
Nov 27, 2020
This one had me scratching my head for a while 😅
When using
@aws/otel-aws-xray-propagator@0.12.1
with@opentelemetry/core@0.12.0
and@opentelemetry/api@0.12.0
, doing this:Results in a span like this:

With a different
traceId
and noparentSpanId
.This despite the context correctly being extracted by

@aws/otel-aws-xray-propagator
:Note the
EXTRACTED_SPAN_CONTEXT
Symbol. I couldn't find this anywhere in the opentelemetry-js source code, but it turns out this was removed in open-telemetry/opentelemetry-js#1589. Those changes were released as part of0.12.0
.It turns out this is happening because when

@aws/otel-aws-xray-propagator
callssetExtractedSpanContext
, it's calling@opentelemetry/core@0.10.2
's version of that function, which still uses theEXTRACTED_SPAN_CONTEXT
SymbolWhen
tracer.startSpan
then tries to read the context, it's using our app's version of the core and api (0.12.0
) and goes through this flow:getActiveSpan
tries to read the value using theACTIVE_SPAN_KEY
key, but there's nothing there so it returnsundefined
. This then bubbles back up the stack to become the return value ofgetParent
instartSpan
.startSpan
then creates the span as a new root span with a new trace ID and no parent.@aws/otel-aws-xray-propagator
depends on"@opentelemetry/core": "^0.10.2"
. Because the version is specified using a caret (^
), it accepts newer versions that do not modify the left-most non-zero digit. Since opentelemetry-js is still in the0.x.x
version range, this means that e.g.0.10.3
would be accepted but0.11.0
would not. In my case it results in@aws/otel-aws-xray-propagator
having its own version of@opentelemetry/core@0.10.2
in itsnode_modules
folder and it using that over the version we use in our app. Ditto for@opentelemetry/api
.Fixing the issue is probably a matter of upgrading
@aws/otel-aws-xray-propagator
's dependencies to0.12.0
and adapting to any potential breaking changes in the propagator API.The text was updated successfully, but these errors were encountered: