Skip to content

feat(chore): declarative configuration for trace_provider#2161

Open
xuan-cao-swi wants to merge 11 commits into
open-telemetry:mainfrom
xuan-cao-swi:otelconfig
Open

feat(chore): declarative configuration for trace_provider#2161
xuan-cao-swi wants to merge 11 commits into
open-telemetry:mainfrom
xuan-cao-swi:otelconfig

Conversation

@xuan-cao-swi

@xuan-cao-swi xuan-cao-swi commented May 25, 2026

Copy link
Copy Markdown
Contributor

Description

This PR introduces an initial declarative configuration implementation for OpenTelemetry Ruby under otelconfig, intentionally scoped to tracing only.

I followed the Go otelconfig convention for config structure and behavior where it maps well to Ruby.

Minimalist approach: no hard dependency on optional components, which optional propagators and resource detectors are resolved only if the corresponding gem has been required by the user. If an optional component is not available, configuration continues safely with warnings instead of failing startup.

Scope in this PR

  • Trace configuration only:
    • tracer provider setup
    • samplers
    • span processors
    • trace exporters
    • span limits
  • Declarative resource and propagation wiring needed for trace setup
  • Instrumentation mapping/installation flow for declarative config
  • Tests and example configuration for the implemented behavior

Try /example

Updated (2026-06-13):

  • The in-memory struct of opentelemetry configuration now is based on https://github.com/open-telemetry/opentelemetry-configuration/tree/v1.0.0-rc.3/schema. bundle exec rake generate:constants will auto-generate the struct file.
  • configuration will return RubySDK struct that contain providers, which user need to set the global provider point to the providers
    sdk = OpenTelemetry::OtelConfig.configure
    OpenTelemetry.tracer_provider = sdk.tracer_provider

@thompson-tomo thompson-tomo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other thing, how are we ensuring the loading of the the env variables are disabled when covered by declarative config?

Will the current approach support dynamic reloading of the config which is also a part of the spec?

Comment thread otelconfig/Rakefile Outdated
Comment thread otelconfig/lib/opentelemetry/components/trace.rb
Comment thread otelconfig/lib/opentelemetry/components/trace.rb
Comment thread otelconfig/lib/opentelemetry/components/trace.rb
Comment thread otelconfig/lib/opentelemetry/otelconfig/instrumentation.rb Outdated
Comment thread otelconfig/lib/opentelemetry/components/trace.rb
Comment thread otelconfig/lib/opentelemetry/otelconfig/resource.rb
Comment thread otelconfig/opentelemetry-otelconfig.gemspec Outdated
Comment thread otelconfig/opentelemetry-otelconfig.gemspec Outdated
Comment thread otelconfig/opentelemetry-otelconfig.gemspec Outdated
@xuan-cao-swi xuan-cao-swi marked this pull request as ready for review June 15, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants