Skip to content

feat(config): wire id_generator from declarative configuration to TracerProvider #5334

Description

@MikeGoldsmith

What

The OTel declarative configuration spec v1.1.0 added an `id_generator` field on `TracerProvider` (with a single built-in `random`). Python does not yet honor it.

Scope

Once the schema bump (#5333) lands so the generated `models.py` includes `IdGenerator` on `TracerProvider`:

  1. Add `_create_id_generator` in `opentelemetry-sdk/src/opentelemetry/sdk/_configuration/_tracer_provider.py` using the existing `_resolve_component` helper.
  2. Built-in `random` resolves to `RandomIdGenerator`; unknown names load from the `opentelemetry_id_generator` entry point group (the same group `OTEL_PYTHON_ID_GENERATOR` uses today).
  3. Thread `id_generator` through `create_tracer_provider`. When the config block omits it, pass `None` so the SDK applies its own `RandomIdGenerator` default.
  4. Tests cover: built-in, plugin via entry point, empty/unknown raising `ConfigurationError`, absent → SDK default.

Why

Closes the parity gap with Java / JS (e.g. open-telemetry/opentelemetry-js#6782 lands the same wiring there). Without this, users who supply a YAML cannot pick an ID generator.

Dependencies

Refs #3631

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions