Open trentm opened 1 month ago
We should test whether sampling with distributed tracing works at all. Take this dev patch:
diff --git a/examples/start-elastic-sdk.js b/examples/start-elastic-sdk.js index 99875f0..f0f0116 100644 --- a/examples/start-elastic-sdk.js +++ b/examples/start-elastic-sdk.js @@ -42,6 +42,9 @@ const { ExpressInstrumentation, } = require('@opentelemetry/instrumentation-express'); +const {tracing} = require('@opentelemetry/sdk-node'); +const {ParentBasedSampler, TraceIdRatioBasedSampler} = tracing; + const sdk = new ElasticNodeSDK({ serviceName: path.parse(process.argv[1]).name, // One can **override** completely the instrumentations provided by ElasticNodeSDK @@ -69,6 +91,9 @@ const sdk = new ElasticNodeSDK({ // the OTel NodeSDK, for example: // new AnotherInstrumentation(), ], + sampler: new ParentBasedSampler({ + root: new TraceIdRatioBasedSampler(0.5), + }), });
ParentBasedSampler
TraceIdRatioBasedSampler
We should test whether sampling with distributed tracing works at all. Take this dev patch:
ParentBasedSampler
by default?TraceIdRatioBasedSampler
if a value is given?