Otel.Configuration.Composer (otel v0.2.0)

Copy Markdown View Source

Composes a validated declarative-config in-memory model into the per-pillar provider config maps that Otel.SDK.{Trace.TracerProvider, Metrics.MeterProvider, Logs.LoggerProvider} consume at start_link/1.

Implements spec configuration/sdk.md §Create: "Interpret configuration model and return SDK components."

Pipeline used by Otel.Configuration:

File.read!(path)
|> Otel.Configuration.Substitution.substitute!()
|> Otel.Configuration.Parser.parse_string!()
|> Otel.Configuration.Schema.validate!()
|> Otel.Configuration.Composer.compose!()

Output shape mirrors Otel.SDK.Config.{trace,metrics,logs}/0 so the wiring layer (Otel.SDK.Application) can swap config sources transparently — env-var path or declarative-file path produces the same map shape.

Stable-only policy

Per .claude/rules/workflow.md and the project's "Stable only" stance, the composer:

  • Warns + skips any */development-suffixed property at the sub-property level (e.g. resource.detection/development, meter_configuration/development).
  • Raises when the YAML asks for a feature not implemented in our SDK (e.g. pull MetricReader for Prometheus, otlp_grpc exporter, zipkin exporter). These are spec-stable but missing from this repo's SDK surface.

Component coverage

PillarSamplerProcessor / ReaderExporter
Tracealways_on, always_off, trace_id_ratio_based, parent_basedbatch, simpleotlp_http, console
Metricsn/aperiodicotlp_http, console
Logsn/abatch, simpleotlp_http, console

Resource

Built from the YAML's resource.attributes (list of {name, value, type}) and resource.attributes_list (W3C Baggage-format string), merged onto the project's telemetry.sdk.* baseline. Does not read OTEL_RESOURCE_ATTRIBUTES / OTEL_SERVICE_NAME from the process env — when OTEL_CONFIG_FILE is set, spec L332-L337 forbids reading other OTEL_* env vars except via explicit YAML substitution (attributes_list: ${OTEL_RESOURCE_ATTRIBUTES}).

Public API

FunctionRole
compose!/1SDK (Create) — model → %{trace, metrics, logs} config maps

References

  • Spec Create: opentelemetry-specification/specification/configuration/sdk.md §Create
  • Schema docs: references/opentelemetry-configuration/schema-docs.md

Summary

Functions

Composes a validated configuration model into per-pillar SDK provider configs plus the global propagator value.

Functions

compose!(model)

@spec compose!(model :: map()) :: %{
  trace: map(),
  metrics: map(),
  logs: map(),
  propagator: module() | {module(), [module()]}
}

Composes a validated configuration model into per-pillar SDK provider configs plus the global propagator value.