Skip to content

ADOT Collector + Node.js + X-Ray: What is the default sampling behavior?

0

Hi AWS team,

I am currently instrumenting my application using the following setup:

When using OpenTelemetry JavaScript SDK + ADOT Collector + X-Ray exporter without explicitly configuring OTEL_TRACES_SAMPLER, is the following understanding correct?

  • The default OpenTelemetry JavaScript sampler is used
  • Therefore, Node.js ends up effectively doing 100% sampling (all spans recorded and sent)
    • X-Ray default sampling Reservoir: 0, Rate: 5 is not applied.

asked a year ago240 views

1 Answer
0
Accepted Answer

When using OpenTelemetry JavaScript SDK with ADOT Collector and X-Ray exporter without explicitly configuring OTEL_TRACES_SAMPLER, the default sampling behavior depends on your specific setup.

For Application Signals with X-Ray, by default, X-Ray centralized sampling is enabled with the following settings:

  • Reservoir rate: 1 trace per second
  • Fixed rate: 5%

The environment variables for the ADOT SDK agent are automatically set as:

However, if you're using ADOT auto-instrumentation for Node.js without explicitly setting these environment variables, the behavior is different. The ADOT auto-instrumentation for Node.js supports X-Ray remote sampling, but you need to explicitly enable it by setting the environment variable OTEL_TRACES_SAMPLER=xray.

If you don't set this environment variable, the default OpenTelemetry JavaScript sampler will be used, which typically samples at 100% (all spans recorded and sent). In this case, the X-Ray default sampling rules (Reservoir: 1/s, Rate: 5%) would not be applied.

To ensure your Node.js application uses X-Ray sampling rules, you should explicitly set OTEL_TRACES_SAMPLER=xray in your environment variables.
Sources
Trace sampling rate - Amazon CloudWatch
Migrate to OpenTelemetry Node.js - AWS X-Ray

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.