otel-declarative-config
OpenTelemetry Declarative Configuration
Declarative configuration replaces scattered OTEL_* environment variables and language-specific
programmatic SDK setup with a single YAML file. One file configures all SDK components: tracer
provider, meter provider, logger provider, propagators, and resource.
For the current per-language SDK status, fetch the SDK compatibility matrix (see Sources of Truth).
Sources of Truth
This skill teaches concepts. The schema itself, valid file_format strings, field names,
and SDK compatibility evolve per release — fetch from upstream rather than relying on
embedded copies. Cache results for the conversation; refetch only on schema-related errors.
| Fact | Fetch |
|---|---|
| Latest schema release tag | gh release view --repo open-telemetry/opentelemetry-configuration --json tagName,publishedAt |
| SDK ↔ schema compatibility matrix | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-configuration/main/language-support-status.md |
| Field-by-field schema docs | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-configuration/main/schema-docs.md |
| Compiled JSON Schema (validate generated YAML against this) | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-configuration/main/opentelemetry_configuration.json |
| Canonical full example | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-configuration/main/examples/otel-sdk-config.yaml |
| Migration template (every option, with comments) | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-configuration/main/examples/otel-sdk-migration-config.yaml |
| Schema CHANGELOG (breaking-change history with migration steps) | WebFetch https://raw.githubusercontent.com/open-telemetry/opentelemetry-configuration/main/CHANGELOG.md |
Workflow when generating YAML:
- Fetch
language-support-status.md→ pick thefile_formatstring for the target SDK version. - Fetch
examples/otel-sdk-config.yaml→ use as the structural template. - Overlay the user's specific values (service name, endpoint, sampling, headers).
- If validation matters, fetch
opentelemetry_configuration.jsonand validate the result.
For language-specific package versions and SDK API surface, see the Sources of Truth section
in each language's otel-<lang> skill (otel-go, otel-java, otel-js).
Activation
The standard environment variable is OTEL_CONFIG_FILE:
export OTEL_CONFIG_FILE=/app/configs/otel.yaml
When set, the SDK reads this file at startup. All other OTEL_* env vars are ignored except
those referenced via ${env:VAR} substitution inside the config file.
Language-specific activation varies — see the language sdk-setup skills for details.
Environment Variable Substitution
| Syntax | Behavior |
|---|---|
${VAR} |
Substitute with value of VAR |
${env:VAR} |
Same as ${VAR} (explicit prefix) |
${VAR:-default} |
Use default if VAR is unset or empty |
$$ |
Escape sequence, resolves to literal $ |
Rules:
- Substitution applies only to scalar values, not mapping keys
- Type coercion happens after substitution (
${BOOL}whereBOOL=truebecomes boolean) - No recursive substitution
- Invalid references produce a parse error
Configuration Precedence
Programmatic API > Environment Variables > Configuration File
(highest) (lowest)
Cross-References
- Language-specific setup:
otel-go,otel-java,otel-js(each loads its ownreferences/declarative-setup.md).
More from ollygarden/opentelemetry-agent-skills
sdk-setup
OpenTelemetry SDK initialization and configuration. Use when setting up or reviewing TracerProvider, MeterProvider, or LoggerProvider; choosing exporters, processors, or propagators; configuring OTLP transport; or extending an existing SDK setup for new signals. Use this skill whenever the task involves wiring up the OpenTelemetry SDK, even if the user only mentions "add tracing" or "set up metrics" without saying "SDK.
8telemetrygen
Construct telemetrygen commands for generating synthetic OpenTelemetry traces, metrics, and logs via OTLP. Use this skill whenever the user wants to generate test telemetry, load test a collector or backend, create synthetic OTLP data, send sample traces/metrics/logs to an endpoint, test collector pipelines or processors, validate OTTL transforms, test tail sampling, or mentions telemetrygen in any context. Also trigger when the user asks how to simulate telemetry traffic, stress test an observability stack, or produce sample data for dashboards.
8sdk-versions
OpenTelemetry SDK and package version lookup across languages. Use when choosing the latest compatible released OpenTelemetry SDK or package version and locating setup docs or examples.
8semantic-conventions
OpenTelemetry semantic convention lookup and naming guidance. Use when selecting released semantic convention groups, attributes, or span naming rules, or when checking semantic convention compliance.
8manual-instrumentation
OpenTelemetry best practices for manual instrumentation. Use when adding, changing, or reviewing OpenTelemetry instrumentation in code. Guidance to choose runtime boundaries, choose signals, apply semantic conventions, handle propagation, control cardinality, and verify the result.
8span-events-to-logs-migration
Migrate OpenTelemetry Span Events (AddEvent, RecordException) to the Logs API following the OTEP 4430 deprecation plan. Use when migrating instrumentation from span events to log-based events, reviewing code that still uses AddEvent or RecordException, or planning a migration across a codebase.
8