Make auto-configured BatchSpanProcessor back off when the user defines their own
Closes gh-44601
This commit is contained in:
parent
00b2fe7d95
commit
3fc07644ee
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -115,6 +115,7 @@ public class OpenTelemetryTracingAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
BatchSpanProcessor otelSpanProcessor(SpanExporters spanExporters,
|
||||
ObjectProvider<SpanExportingPredicate> spanExportingPredicates, ObjectProvider<SpanReporter> spanReporters,
|
||||
ObjectProvider<SpanFilter> spanFilters, ObjectProvider<MeterProvider> meterProvider) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -51,6 +51,7 @@ import io.opentelemetry.sdk.trace.SdkTracerProvider;
|
||||
import io.opentelemetry.sdk.trace.SpanLimits;
|
||||
import io.opentelemetry.sdk.trace.SpanProcessor;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
import io.opentelemetry.sdk.trace.export.BatchSpanProcessor;
|
||||
import io.opentelemetry.sdk.trace.export.SpanExporter;
|
||||
import io.opentelemetry.sdk.trace.samplers.Sampler;
|
||||
import org.assertj.core.api.InstanceOfAssertFactories;
|
||||
@ -172,6 +173,8 @@ class OpenTelemetryTracingAutoConfigurationTests {
|
||||
assertThat(context).hasSingleBean(SpanProcessors.class);
|
||||
assertThat(context).hasBean("customSpanExporters");
|
||||
assertThat(context).hasSingleBean(SpanExporters.class);
|
||||
assertThat(context).hasBean("customBatchSpanProcessor");
|
||||
assertThat(context).hasSingleBean(BatchSpanProcessor.class);
|
||||
});
|
||||
}
|
||||
|
||||
@ -401,6 +404,11 @@ class OpenTelemetryTracingAutoConfigurationTests {
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
private static final class CustomConfiguration {
|
||||
|
||||
@Bean
|
||||
BatchSpanProcessor customBatchSpanProcessor() {
|
||||
return mock(BatchSpanProcessor.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
SpanProcessors customSpanProcessors() {
|
||||
return SpanProcessors.of(mock(SpanProcessor.class));
|
||||
|
Loading…
x
Reference in New Issue
Block a user