Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sdk] Ability to add custom TextMapPropagators when using auto-configuration #910

Open
NthPortal opened this issue Feb 6, 2025 · 1 comment
Labels
enhancement New feature or request module:sdk Features and improvements to the sdk module

Comments

@NthPortal
Copy link
Contributor

NthPortal commented Feb 6, 2025

I think it would be helpful (admittedly JVM only) to have an SPI for adding custom TextMapPropagators which can then be configured using environment variables.

Proposed SPI:

trait TextMapPropagatorProvider {
  def name: String
  def instance: TextMapPropagator[Context]
}

I've also opened open-telemetry/opentelemetry-java#7079 with a request for the equivalent in the official Java library.

I am aware that the sdk auto-configuration builder already supports custom TextMapPropagators, but purely environment-based configuration could be nice too

@NthPortal NthPortal added enhancement New feature or request module:sdk Features and improvements to the sdk module labels Feb 6, 2025
@iRevive
Copy link
Contributor

iRevive commented Feb 10, 2025

Not ideal, but you can do the following:

OpenTelemetrySdk.autoConfigured[IO](
  _.addExportersConfigurer(OtlpExportersAutoConfigure[IO])
   .addTextMapPropagatorConfigurer(AutoConfigure.Named.const("myCustomPropagator", propagator))
)

Then you can dynamically configure it: export OTEL_PROPAGATORS=myCustomPropagator.
That doesn't improve usability, but it can be helpful if you need to configure the propagator dynamically.


It will be interesting to explore the SPI topic in the SDK module. So we can finally get rid of the mandatory addExportersConfigurer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request module:sdk Features and improvements to the sdk module
Projects
None yet
Development

No branches or pull requests

2 participants