Skip to content

Provide more control over the OTel SpanProcessors #35560

Closed
Listed in
@mmeller-wikia

Description

@mmeller-wikia

SpringBootVersion: 3.0.6

I was hoping to configure MetricExporter in default SpanProcessor provided in OpenTelemetryAutoConfiguration
OpenTelemetry code: https://github.com/open-telemetry/opentelemetry-java/blob/0bad3c982ad05f54461e241f8a402536c6f9d4b9/sdk/trace/src/main/java/io/opentelemetry/sdk/trace/export/BatchSpanProcessor.java#L187-L219

Current workaround:
Create @Primary SpanProcessor bean and redeclare SdkTracerProvider (using custom SpanProcessor bean). One downside is that 2 SpanProcessor beans are created with dandling default one.

If possible I would like to have a simple way to overwrite SpanProcessor bean

In PR discussion: #35558

Activity

changed the title [-]OpenTelemetryAutoConfiguration: it's impossible to configure `MetricExporter` in default `SpanProcessor`[/-] [+]OpenTelemetryAutoConfiguration: it's impossible to configure MetricExporter in default SpanProcessor[/+] on May 26, 2023
changed the title [-]OpenTelemetryAutoConfiguration: it's impossible to configure MetricExporter in default SpanProcessor[/-] [+]Impossible to override OTEL default SpanProcessor bean[/+] on Jun 5, 2023
changed the title [-]Impossible to override OTEL default SpanProcessor bean[/-] [+]OpenTelemetryAutoConfiguration: it's impossible to configure MetricExporter in default SpanProcessor[/+] on Jun 5, 2023
added this to the 3.2.x milestone on Jun 7, 2023
self-assigned this
on Jun 16, 2023
mhalbritter

mhalbritter commented on Jun 16, 2023

@mhalbritter
Contributor

Just to clarify: You mean MeterProvider instead of MetricExporter, right? The code you linked only deals with MeterProvider. And judging from your comments in the PR, it has to be MeterProvider.

changed the title [-]OpenTelemetryAutoConfiguration: it's impossible to configure MetricExporter in default SpanProcessor[/-] [+]OpenTelemetryAutoConfiguration: it's impossible to configure MeterProvider in default SpanProcessor[/+] on Jun 16, 2023
mhalbritter

mhalbritter commented on Jun 16, 2023

@mhalbritter
Contributor

I implemented two changes:

  • There's now a SpanProcessors bean, which collects all available SpanProcessor beans. If you want full control over the span processors, provide your own SpanProcessors bean.
  • If a MeterProvider bean is found, it's automatically registered on the default SpanProcessor.
modified the milestones: 3.2.x, 3.2.0-M1 on Jun 16, 2023
changed the title [-]OpenTelemetryAutoConfiguration: it's impossible to configure MeterProvider in default SpanProcessor[/-] [+]Provide more control over the OTel SpanProcessors[/+] on Jun 16, 2023
mmeller-wikia

mmeller-wikia commented on Jun 20, 2023

@mmeller-wikia
Author

That's all I need :) Thank you!

mhalbritter

mhalbritter commented on Jun 21, 2023

@mhalbritter
Contributor

Thanks for the feedback and glad that this solves your problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @philwebb@wilkinsona@spring-projects-issues@mmeller-wikia@mhalbritter

      Issue actions

        Provide more control over the OTel SpanProcessors · Issue #35560 · spring-projects/spring-boot