Skip to content

Sample spans always in Nodejs sample app #1498

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

Conversation

serkan-ozal
Copy link
Contributor

Because

  • by default trace context is propagated through AWS XRay in Lambda handlers as long as it is not explicitly disabled (https://github.com/open-telemetry/opentelemetry-js-contrib/blob/de7a6cb77e643ed0de82e514510089fba5ae0405/plugins/node/opentelemetry-instrumentation-aws-lambda/src/instrumentation.ts#L395)
  • and when AWS XRay tracing mode is PassThrough, sampled flag is set to false (0) (for ex. Root=1-66ca4895-3f6cef844dab67fb6f6461a4;Parent=27c4bbf84acc163c;Sampled=0;Lineage=d4d48d4d:0)
  • and since default sampling strategy is parentbased_always_on, child spans are sampled only if their parent span is sampled
  • hence, since propagated parent span context by AWS XRay is not sampled (because AWS XRay tracing mode is configured as PassThrough in the example, sampled flag is set to false as mentioned above), spans starting from handler span are not sampled and not recorded as well (that is why we see Recording 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

@serkan-ozal serkan-ozal requested a review from a team August 25, 2024 06:30
Copy link
Member

@pragmaticivan pragmaticivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tylerbenson tylerbenson merged commit a9928f3 into open-telemetry:main Aug 29, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants