opentelemetry-js
opentelemetry-js copied to clipboard
OTEL_TRACES_EXPORTER default value incompatible with @opentelemetry/sdk-trace-base
Discussed in https://github.com/open-telemetry/opentelemetry-js/discussions/3415
Originally posted by fischerman November 16, 2022 What's the meaning of this log message?
Exporter "otlp" requested through environment variable is unavailable.
Why am I seeing it? I'm providing the exporter in code (not via env variables). OTEL_TRACES_EXPORTER
is undefined.
const exporter = new OTLPTraceExporter()
const sdk = new NodeSDK({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: '...',
}),
traceExporter: exporter,
sampler: new AlwaysOnSampler(),
instrumentations: [getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-graphql': {
depth: 1000,
}
})]
});
$ npm ls | grep @opentelemetry
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
├── @opentelemetry/[email protected]
The problem
The default value for OTEL_TRACES_EXPORTER
is "otlp"
, but BasicTracerProvider
doesn't register any exporters so this would lead to a diag.error log by default.
Hey, I am running into this bug and I think it's causing my traces to not be exported.
This line https://github.com/open-telemetry/opentelemetry-js/blob/ef6fcdcd1a7e5234758e3bcc9ff6c29db5ff4d23/packages/opentelemetry-sdk-trace-base/src/BasicTracerProvider.ts#L89 is being run because the _buildExporterFromEnv
method is returning undefined.
Is there a work around? I am following this https://opentelemetry.io/docs/instrumentation/js/serverless/ guide to try and instrument one of my lambda functions
edit: Missed disableAwsContextPropagation: true 👀 - now I can see some logs but still nothing coming through to honeycome.
Edit: data is coming through, had a honeycomb related issue. Don't think this error is causing me any issues
I had code just like the author's but I had also exported OTEL_TRACES_EXPORTER: "otlp"
. Once I removed that export, it worked fine (due to #3492 fix)
Try that, it should work, then I think we can close this issue.