Skip to content

Commit 4866f1a

Browse files
committed
Switch property backing OnEnabledTracingExportCondition
It's now management.tracing.export.{name}.enabled Closes gh-47959
1 parent fd7f5c5 commit 4866f1a

File tree

8 files changed

+30
-16
lines changed

8 files changed

+30
-16
lines changed

module/spring-boot-micrometer-tracing-brave/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
"groups": [],
33
"properties": [
44
{
5-
"name": "management.zipkin.tracing.export.enabled",
5+
"name": "management.tracing.export.zipkin.enabled",
66
"type": "java.lang.Boolean",
77
"description": "Whether auto-configuration of tracing is enabled to export Zipkin traces."
8-
}
8+
},
9+
{
10+
"name": "management.zipkin.tracing.export.enabled",
11+
"deprecation": {
12+
"replacement": "management.tracing.export.zipkin.enabled",
13+
"level": "error"
14+
}
15+
}
916
]
1017
}

module/spring-boot-micrometer-tracing-brave/src/test/java/org/springframework/boot/micrometer/tracing/brave/autoconfigure/zipkin/ZipkinWithBraveTracingAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void shouldNotSupplyAsyncZipkinSpanHandlerIfGlobalTracingIsDisabled() {
9696

9797
@Test
9898
void shouldNotSupplyAsyncZipkinSpanHandlerIfZipkinTracingIsDisabled() {
99-
this.contextRunner.withPropertyValues("management.zipkin.tracing.export.enabled=false")
99+
this.contextRunner.withPropertyValues("management.tracing.export.zipkin.enabled=false")
100100
.withUserConfiguration(SenderConfiguration.class)
101101
.run((context) -> assertThat(context).doesNotHaveBean(AsyncZipkinSpanHandler.class));
102102
}

module/spring-boot-micrometer-tracing-opentelemetry/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
"groups": [],
33
"properties": [
44
{
5-
"name": "management.otlp.tracing.export.enabled",
5+
"name": "management.tracing.export.otlp.enabled",
66
"type": "java.lang.Boolean",
77
"description": "Whether auto-configuration of tracing is enabled to export OTLP traces."
8+
},
9+
{
10+
"name": "management.otlp.tracing.export.enabled",
11+
"deprecation": {
12+
"replacement": "management.tracing.export.otlp.enabled",
13+
"level": "error"
14+
}
815
}
916
]
1017
}

module/spring-boot-micrometer-tracing-opentelemetry/src/test/java/org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/otlp/OtlpTracingAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ void shouldNotSupplyBeansIfGlobalTracingIsDisabled() {
136136

137137
@Test
138138
void shouldNotSupplyBeansIfOtlpTracingIsDisabled() {
139-
this.contextRunner.withPropertyValues("management.otlp.tracing.export.enabled=false")
139+
this.contextRunner.withPropertyValues("management.tracing.export.otlp.enabled=false")
140140
.run((context) -> assertThat(context).doesNotHaveBean(SpanExporter.class));
141141
}
142142

module/spring-boot-micrometer-tracing-opentelemetry/src/test/java/org/springframework/boot/micrometer/tracing/opentelemetry/autoconfigure/zipkin/ZipkinWithOpenTelemetryTracingAutoConfigurationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void shouldNotSupplyZipkinSpanExporterIfGlobalTracingIsDisabled() {
135135

136136
@Test
137137
void shouldNotSupplyZipkinSpanExporterIfZipkinTracingIsDisabled() {
138-
this.contextRunner.withPropertyValues("management.zipkin.tracing.export.enabled=false")
138+
this.contextRunner.withPropertyValues("management.tracing.export.zipkin.enabled=false")
139139
.withUserConfiguration(SenderConfiguration.class)
140140
.run((context) -> assertThat(context).doesNotHaveBean(ZipkinSpanExporter.class));
141141
}

module/spring-boot-micrometer-tracing/src/main/java/org/springframework/boot/micrometer/tracing/autoconfigure/ConditionalOnEnabledTracingExport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* {@link Conditional @Conditional} that checks whether tracing is enabled. It matches if
2929
* the value of the {@code management.tracing.export.enabled} property is {@code true} or
3030
* if it is not configured. If the {@link #value() tracing exporter name} is set, the
31-
* {@code management.<name>.tracing.export.enabled} property can be used to control the
31+
* {@code management.tracing.export.<name>.enabled} property can be used to control the
3232
* behavior for the specific tracing exporter. In that case, the exporter specific
3333
* property takes precedence over the global property.
3434
*

module/spring-boot-micrometer-tracing/src/main/java/org/springframework/boot/micrometer/tracing/autoconfigure/OnEnabledTracingExportCondition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class OnEnabledTracingExportCondition extends SpringBootCondition {
3737

3838
private static final String GLOBAL_PROPERTY = "management.tracing.export.enabled";
3939

40-
private static final String EXPORTER_PROPERTY = "management.%s.tracing.export.enabled";
40+
private static final String EXPORTER_PROPERTY = "management.tracing.export.%s.enabled";
4141

4242
@Override
4343
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {

module/spring-boot-micrometer-tracing/src/test/java/org/springframework/boot/micrometer/tracing/autoconfigure/OnEnabledTracingExportConditionTests.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,44 +69,44 @@ void shouldMatchIfGlobalPropertyIsTrue() {
6969
void shouldNotMatchIfExporterPropertyIsFalse() {
7070
OnEnabledTracingExportCondition condition = new OnEnabledTracingExportCondition();
7171
ConditionOutcome outcome = condition.getMatchOutcome(
72-
mockConditionContext(Map.of("management.zipkin.tracing.export.enabled", "false")),
72+
mockConditionContext(Map.of("management.tracing.export.zipkin.enabled", "false")),
7373
mockMetadata("zipkin"));
7474
assertThat(outcome.isMatch()).isFalse();
7575
assertThat(outcome.getMessage())
76-
.isEqualTo("@ConditionalOnEnabledTracingExport management.zipkin.tracing.export.enabled is false");
76+
.isEqualTo("@ConditionalOnEnabledTracingExport management.tracing.export.zipkin.enabled is false");
7777
}
7878

7979
@Test
8080
void shouldMatchIfExporterPropertyIsTrue() {
8181
OnEnabledTracingExportCondition condition = new OnEnabledTracingExportCondition();
8282
ConditionOutcome outcome = condition.getMatchOutcome(
83-
mockConditionContext(Map.of("management.zipkin.tracing.export.enabled", "true")),
83+
mockConditionContext(Map.of("management.tracing.export.zipkin.enabled", "true")),
8484
mockMetadata("zipkin"));
8585
assertThat(outcome.isMatch()).isTrue();
8686
assertThat(outcome.getMessage())
87-
.isEqualTo("@ConditionalOnEnabledTracingExport management.zipkin.tracing.export.enabled is true");
87+
.isEqualTo("@ConditionalOnEnabledTracingExport management.tracing.export.zipkin.enabled is true");
8888
}
8989

9090
@Test
9191
void exporterPropertyShouldOverrideGlobalPropertyIfTrue() {
9292
OnEnabledTracingExportCondition condition = new OnEnabledTracingExportCondition();
9393
ConditionOutcome outcome = condition.getMatchOutcome(mockConditionContext(Map
94-
.of("management.tracing.export.enabled", "false", "management.zipkin.tracing.export.enabled", "true")),
94+
.of("management.tracing.export.enabled", "false", "management.tracing.export.zipkin.enabled", "true")),
9595
mockMetadata("zipkin"));
9696
assertThat(outcome.isMatch()).isTrue();
9797
assertThat(outcome.getMessage())
98-
.isEqualTo("@ConditionalOnEnabledTracingExport management.zipkin.tracing.export.enabled is true");
98+
.isEqualTo("@ConditionalOnEnabledTracingExport management.tracing.export.zipkin.enabled is true");
9999
}
100100

101101
@Test
102102
void exporterPropertyShouldOverrideGlobalPropertyIfFalse() {
103103
OnEnabledTracingExportCondition condition = new OnEnabledTracingExportCondition();
104104
ConditionOutcome outcome = condition.getMatchOutcome(mockConditionContext(Map
105-
.of("management.tracing.export.enabled", "true", "management.zipkin.tracing.export.enabled", "false")),
105+
.of("management.tracing.export.enabled", "true", "management.tracing.export.zipkin.enabled", "false")),
106106
mockMetadata("zipkin"));
107107
assertThat(outcome.isMatch()).isFalse();
108108
assertThat(outcome.getMessage())
109-
.isEqualTo("@ConditionalOnEnabledTracingExport management.zipkin.tracing.export.enabled is false");
109+
.isEqualTo("@ConditionalOnEnabledTracingExport management.tracing.export.zipkin.enabled is false");
110110
}
111111

112112
private ConditionContext mockConditionContext() {

0 commit comments

Comments
 (0)