跳至内容

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.

已提问 1 年前294 查看次数

1 回答
0
已接受的回答

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

已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。