- Newest
- Most votes
- Most comments
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:
- OTEL_TRACES_SAMPLER=xray
- OTEL_TRACES_SAMPLER_ARG=endpoint=http://cloudwatch-agent.amazon-cloudwatch:2000
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
Relevant content
asked 5 years ago
asked 4 years ago
asked 4 years ago
- AWS OFFICIALUpdated 8 months ago
