SDK
JavaScript SDK
Description
In the NodeJS OTLP Integration doc, the example uses addSpanProcessor method of NodeTracerProvider class.
However, this method was removed in @opentelemetry/sdk-trace-node v2.0.0.
So when using latest version of OTel SDK, the example throws TypeError.
const provider = new NodeTracerProvider({
// This ensures trace propagation works as expected
sampler: sentryClient ? new SentrySampler(sentryClient) : undefined,
});
provider.addSpanProcessor(
new BatchSpanProcessor(
new OTLPTraceExporter({
url: "http://OTLP-ENDPOINT.com/api",
})
)
);
Suggested Solution
The example should be updated to work with @opentelemetry/sdk-trace-node v2.x. A span processor can be set through constructor instead of addSpanProcessor.
SDK
JavaScript SDK
Description
In the NodeJS OTLP Integration doc, the example uses
addSpanProcessormethod ofNodeTracerProviderclass.However, this method was removed in
@opentelemetry/sdk-trace-nodev2.0.0.So when using latest version of OTel SDK, the example throws
TypeError.Suggested Solution
The example should be updated to work with
@opentelemetry/sdk-trace-nodev2.x. A span processor can be set through constructor instead ofaddSpanProcessor.