Instrumentation Configuration API (ConfigProvider / ConfigProperties) is not implemented
What's missing
The OpenTelemetry specification defines an Instrumentation Configuration API
that lets instrumentation libraries read declarative configuration relevant to
them. The two central components are:
ConfigProvider — the entry point of the API. It provides access to
configuration properties relevant to instrumentation, exposes a
"get instrumentation config" operation returning the .instrumentation
configuration node, and the API is expected to offer a global default
ConfigProvider that can be accessed and set/registered.
Status: Development.
ConfigProperties — a programmatic, schemaless representation of a
configuration mapping node, with type-safe accessors for scalars, mappings,
sequences, and the set of present keys, and the ability to distinguish
"present but null" from "not set". Status: Stable.
Spec references:
The SDK spec additionally requires that:
- The SDK provides an implementation of
ConfigProvider, created from a
ConfigProperties representing the .instrumentation mapping node
(sdk.md#configprovider).
- The
Create operation returns a ConfigProvider as one of the top-level
SDK components, alongside the TracerProvider, MeterProvider,
LoggerProvider, Propagators, and Resource
(sdk.md#create).
Current state in opentelemetry-python
Python already has significant declarative-configuration support in the
opentelemetry-configuration package (parse/load_config_file,
configure_sdk, the in-memory OpenTelemetryConfiguration model, component/
plugin providers, and a configure_instrumentation helper). However, the
Instrumentation Configuration API surface itself is absent:
- There is no
ConfigProvider type anywhere in the codebase.
- There is no
ConfigProperties type (no schemaless, type-safe accessor
API for reading an arbitrary configuration mapping node).
- There is no global default
ConfigProvider with get/set/register
semantics for instrumentation libraries to access.
configure_sdk(...) returns None; the Create-equivalent path does not
return a ConfigProvider among the produced components.
The one related piece, opentelemetry.configuration.instrumentation.configure_instrumentation,
implements a push model: it walks .instrumentation.python, resolves
opentelemetry_instrumentor entry points, and calls instrument() on each.
This is not the spec's pull model, in which an instrumentation library holds
a ConfigProvider, calls "get instrumentation config", and reads its own
configuration from the returned ConfigProperties.
How this was verified
Against upstream/main:
$ git grep -l "ConfigProvider\|config_provider" upstream/main -- '*.py'
# (no results)
The public API of the configuration package is:
# opentelemetry-configuration/src/opentelemetry/configuration/__init__.py
__all__ = [
"ConfigurationError",
"OpenTelemetryConfiguration",
"configure_sdk",
"load_config_file",
]
No ConfigProvider / ConfigProperties is exported or defined.
Proposed work
- Add a
ConfigProperties type implementing the spec's accessor requirements
(scalars, nested mappings as ConfigProperties, sequences of scalars,
sequences of mappings as ConfigProperties, key-set introspection, and
present-but-null vs not-set distinction), in a Pythonic/type-safe manner.
- Add a
ConfigProvider type with a "get instrumentation config" operation
returning the ConfigProperties for the .instrumentation node (returning
an empty ConfigProperties when .instrumentation is not set), plus a
global default ConfigProvider with access and set/register semantics.
- Wire the SDK so the
Create/configure_sdk path constructs and exposes a
ConfigProvider built from the .instrumentation node, returned/available
alongside the other top-level components.
Notes
ConfigProvider is at Development stability in the spec, so the initial
implementation can be marked experimental accordingly. ConfigProperties is
Stable.
- This tracks parity with other SDKs (e.g. Java exposes
openTelemetry.getConfigProvider()), enabling instrumentation libraries to
consume declarative configuration in a spec-compliant way.
Instrumentation Configuration API (
ConfigProvider/ConfigProperties) is not implementedWhat's missing
The OpenTelemetry specification defines an Instrumentation Configuration API
that lets instrumentation libraries read declarative configuration relevant to
them. The two central components are:
ConfigProvider— the entry point of the API. It provides access toconfiguration properties relevant to instrumentation, exposes a
"get instrumentation config" operation returning the
.instrumentationconfiguration node, and the API is expected to offer a global default
ConfigProviderthat can be accessed and set/registered.Status: Development.
ConfigProperties— a programmatic, schemaless representation of aconfiguration mapping node, with type-safe accessors for scalars, mappings,
sequences, and the set of present keys, and the ability to distinguish
"present but null" from "not set". Status: Stable.
Spec references:
The SDK spec additionally requires that:
ConfigProvider, created from aConfigPropertiesrepresenting the.instrumentationmapping node(sdk.md#configprovider).
Createoperation returns aConfigProvideras one of the top-levelSDK components, alongside the
TracerProvider,MeterProvider,LoggerProvider,Propagators, andResource(sdk.md#create).
Current state in
opentelemetry-pythonPython already has significant declarative-configuration support in the
opentelemetry-configurationpackage (parse/load_config_file,configure_sdk, the in-memoryOpenTelemetryConfigurationmodel, component/plugin providers, and a
configure_instrumentationhelper). However, theInstrumentation Configuration API surface itself is absent:
ConfigProvidertype anywhere in the codebase.ConfigPropertiestype (no schemaless, type-safe accessorAPI for reading an arbitrary configuration mapping node).
ConfigProviderwith get/set/registersemantics for instrumentation libraries to access.
configure_sdk(...)returnsNone; theCreate-equivalent path does notreturn a
ConfigProvideramong the produced components.The one related piece,
opentelemetry.configuration.instrumentation.configure_instrumentation,implements a push model: it walks
.instrumentation.python, resolvesopentelemetry_instrumentorentry points, and callsinstrument()on each.This is not the spec's pull model, in which an instrumentation library holds
a
ConfigProvider, calls "get instrumentation config", and reads its ownconfiguration from the returned
ConfigProperties.How this was verified
Against
upstream/main:The public API of the configuration package is:
No
ConfigProvider/ConfigPropertiesis exported or defined.Proposed work
ConfigPropertiestype implementing the spec's accessor requirements(scalars, nested mappings as
ConfigProperties, sequences of scalars,sequences of mappings as
ConfigProperties, key-set introspection, andpresent-but-null vs not-set distinction), in a Pythonic/type-safe manner.
ConfigProvidertype with a "get instrumentation config" operationreturning the
ConfigPropertiesfor the.instrumentationnode (returningan empty
ConfigPropertieswhen.instrumentationis not set), plus aglobal default
ConfigProviderwith access and set/register semantics.Create/configure_sdkpath constructs and exposes aConfigProviderbuilt from the.instrumentationnode, returned/availablealongside the other top-level components.
Notes
ConfigProvideris at Development stability in the spec, so the initialimplementation can be marked experimental accordingly.
ConfigPropertiesisStable.
openTelemetry.getConfigProvider()), enabling instrumentation libraries toconsume declarative configuration in a spec-compliant way.