open-telemetry / opentelemetry-js

OpenTelemetry JavaScript Client

Home Page:https://opentelemetry.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[sdk-node] implement enviornment configuration for auto-paired `PeriodicExportingMetricReader`

pichlermarc opened this issue · comments

Description

The specification defines that PeriodicExporingMetricReaders that are auto-paired with an exporter can be configured via environment variables.

For this issue to be considered done we need to:

  • implement #4551
  • in @opentelmetry/sdk-node, where the automatic pairing from #4551 is implemented, read the env vars from OTEL_METRIC_EXPORT_INTERVAL/OTEL_METRIC_EXPORT_TIMEOUT and configure the auto-paired PeriodicExportingMetricReader accordingly. Use defaults if the env vars are unset.

Additional infomation

Original feature-request:

The specification defines that PeriodicExporingMetricReaders that are auto-paired with an exporter can be configured via environment variables.

Does the spec actually say anything about this only applying when auto-paired? The BatchSpanProcessor reads from the environment variables directly

this._maxExportBatchSize =
typeof config?.maxExportBatchSize === 'number'
? config.maxExportBatchSize
: env.OTEL_BSP_MAX_EXPORT_BATCH_SIZE;

so the environment variables are applied globally. I'm guessing this is related to the yaml config file conversation and the related concern around precedence