Commit 5bc500e
committed
add MeterProvider creation from declarative config
Implements create_meter_provider() and configure_meter_provider()
following the same patterns as _tracer_provider.py.
- PeriodicExportingMetricReader with explicit interval/timeout defaults
(60s/30s) to suppress env var reading
- OTLP HTTP and gRPC metric exporters (lazy imports)
- Console metric exporter
- Temporality preference mapping (cumulative/delta/low_memory) with
explicit dicts to suppress OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- Default histogram aggregation mapping with env var suppression
- View creation with selector (instrument type/name/unit/meter info)
and stream (name/description/aggregation/attribute_keys)
- ExemplarFilter mapping; default = TraceBasedExemplarFilter (spec default)
- configure_meter_provider(None) is a no-op per spec/Java/JS behavior
- attribute_keys.excluded logs a warning (SDK View only supports inclusion)
- Pull readers raise ConfigurationError (marked _development in spec)
Assisted-by: Claude Sonnet 4.61 parent 7f51034 commit 5bc500e
3 files changed
Lines changed: 1177 additions & 0 deletions
File tree
- opentelemetry-sdk
- src/opentelemetry/sdk/_configuration
- file
- tests/_configuration
0 commit comments