Skip to content

Commit a054c61

Browse files
Added exporter conditionals on properties for otlp and jaeger; fixes gh-115
1 parent 1a05dc3 commit a054c61

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

spring-cloud-sleuth-otel-autoconfigure/src/main/java/org/springframework/cloud/sleuth/autoconfig/otel/OtelExporterConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public SpanExporter customize(SpanExporter spanExporter) {
6767

6868
@Configuration(proxyBeanMethods = false)
6969
@ConditionalOnClass(JaegerGrpcSpanExporter.class)
70+
@ConditionalOnProperty(value = "spring.sleuth.otel.exporter.jaeger.enabled", matchIfMissing = true)
7071
static class JaegerExporterConfiguration {
7172

7273
@Bean
@@ -88,6 +89,7 @@ JaegerGrpcSpanExporter otelJaegerGrpcSpanExporter(OtelExporterProperties propert
8889

8990
@Configuration(proxyBeanMethods = false)
9091
@ConditionalOnClass(OtlpGrpcSpanExporter.class)
92+
@ConditionalOnProperty(value = "spring.sleuth.otel.exporter.otlp.enabled", matchIfMissing = true)
9193
static class OtlpExporterConfiguration {
9294

9395
@Bean

spring-cloud-sleuth-otel-autoconfigure/src/main/java/org/springframework/cloud/sleuth/autoconfig/otel/OtelExporterProperties.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ public void setEnabled(boolean enabled) {
8585
*/
8686
public static class Otlp {
8787

88+
/**
89+
* Enables OTLP exporter.
90+
*/
91+
private boolean enabled = true;
92+
8893
/**
8994
* Timeout in millis.
9095
*/
@@ -124,13 +129,26 @@ public void setHeaders(Map<String, String> headers) {
124129
this.headers = headers;
125130
}
126131

132+
public boolean isEnabled() {
133+
return this.enabled;
134+
}
135+
136+
public void setEnabled(boolean enabled) {
137+
this.enabled = enabled;
138+
}
139+
127140
}
128141

129142
/**
130143
* Integrations with Jaeger exporter.
131144
*/
132145
public static class Jaeger {
133146

147+
/**
148+
* Enables Jaeger exporter.
149+
*/
150+
private boolean enabled = true;
151+
134152
/**
135153
* Timeout in millis.
136154
*/
@@ -157,6 +175,14 @@ public void setEndpoint(String endpoint) {
157175
this.endpoint = endpoint;
158176
}
159177

178+
public boolean isEnabled() {
179+
return this.enabled;
180+
}
181+
182+
public void setEnabled(boolean enabled) {
183+
this.enabled = enabled;
184+
}
185+
160186
}
161187

162188
}

0 commit comments

Comments
 (0)