opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

[sdk] `OTEL_METRICS_EXPORTER` default value is not `otlp`

Open david-luna opened this issue 7 months ago • 2 comments
trafficstars

What happened?

Steps to Reproduce

  • Get the express example from https://github.com/open-telemetry/opentelemetry-js-contrib
  • instrument it with @opentelemetry/auto-instrumentations-node
  • do not set OTEL_METRICS_EXPORTER env var
  • send some requests to the express service
OTEL_EXPORTER_OTLP_ENDPOINT="http://...:4318/" \
OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer ...." \
  node --require '@opentelemetry/auto-instrumentations-node/register' index.js

Expected Result

The collector gets metrics from the HTTP instrumentation.

Actual Result

No metrics are received.

Additional Details

The node SDK has a method to resolve the metrics exporter from the environment named configureMetricProviderFromEnv and its implementation returns an empty list of MetricReaders if the ev var is not set. Implementatinon details

According to the spec the default value should be otlp so it should return a metric reader with an OTLP exporter with the protocol set in the specified protocol env vars for the signal. In this case the code is behaving like OTEL_METRICS_EXPORTER=none vas set.

Operating System and Version

N/A

Runtime and Version

N/A

david-luna avatar Apr 14 '25 08:04 david-luna