Sample spans always in Nodejs sample app #1498
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because
PassThrough
, sampled flag is set tofalse
(0
) (for ex.Root=1-66ca4895-3f6cef844dab67fb6f6461a4;Parent=27c4bbf84acc163c;Sampled=0;Lineage=d4d48d4d:0
)parentbased_always_on
, child spans are sampled only if their parent span is sampledPassThrough
in the example, sampled flag is set tofalse
as mentioned above), spans starting from handler span are not sampled and not recorded as well (that is why we seeRecording is off, propagating context in a non-recording span
logs).So, to fix this issue in the sample Node.js sample app, I have set sampling policy to
always_on
and they will be sampled always even though parent span context by AWS XRay is not sampled.The alternative solutions might be
Active
hereOTEL_LAMBDA_DISABLE_AWS_CONTEXT_PROPAGATION
env var totrue
in the example (https://github.com/open-telemetry/opentelemetry-js-contrib/blob/de7a6cb77e643ed0de82e514510089fba5ae0405/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts#L86)