open-telemetry / open-telemetry/opentelemetry-python
Instrumentation Configuration API (ConfigProvider / ConfigProperties) is not implemented
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.6k
- Forks
- 1k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 19
Description
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
ConfigProviderthat 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:
- API: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/api.md
- SDK: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk.md
The SDK spec additionally requires that:
- The SDK provides an implementation of
ConfigProvider, created from a
ConfigPropertiesrepresenting the.instrumentationmapping node
(sdk.md#configprovider). - The
Createoperation returns aConfigProvideras one of the top-level
SDK components, alongside theTracerProvider,MeterProvider,
LoggerProvider,Propagators, andResource
(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
ConfigProvidertype anywhere in the codebase. - There is no
ConfigPropertiestype (no schemaless, type-safe accessor
API for reading an arbitrary configuration mapping node). - There is no global default
ConfigProviderwith get/set/register
semantics for instrumentation libraries to access. configure_sdk(...)returnsNone; theCreate-equivalent path does not
return aConfigProvideramong 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
ConfigPropertiestype implementing the spec's accessor requirements
(scalars, nested mappings asConfigProperties, sequences of scalars,
sequences of mappings asConfigProperties, key-set introspection, and
present-but-null vs not-set distinction), in a Pythonic/type-safe manner. - Add a
ConfigProvidertype with a "get instrumentation config" operation
returning theConfigPropertiesfor the.instrumentationnode (returning
an emptyConfigPropertieswhen.instrumentationis not set), plus a
global defaultConfigProviderwith access and set/register semantics. - Wire the SDK so the
Create/configure_sdkpath constructs and exposes a
ConfigProviderbuilt from the.instrumentationnode, returned/available
alongside the other top-level components.
Notes
ConfigProvideris at Development stability in the spec, so the initial
implementation can be marked experimental accordingly.ConfigPropertiesis
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with opentelemetry-configuration/src/opentelemetry/configuration/init.py and the configure_sdk and load_config_file entry points, then compare their configuration model with the referenced API and SDK specifications. Done means ConfigProperties and ConfigProvider exist with the specified access and global-registration behavior, and configure_sdk exposes the provider alongside the other SDK components.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100