Skip to content

Commit 9e83898

Browse files
add support for missing list properties in spring starter (#12434)
Co-authored-by: Jean Bisutti <[email protected]>
1 parent 780cdf4 commit 9e83898

File tree

12 files changed

+386
-51
lines changed

12 files changed

+386
-51
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
Comparing source compatibility of opentelemetry-spring-boot-autoconfigure-2.9.0-SNAPSHOT.jar against opentelemetry-spring-boot-autoconfigure-2.8.0.jar
2-
No changes.
2+
=== UNCHANGED CLASS: PUBLIC io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration (not serializable)
3+
=== CLASS FILE FORMAT VERSION: 52.0 <- 52.0
4+
*** MODIFIED ANNOTATION: org.springframework.boot.context.properties.EnableConfigurationProperties
5+
*** MODIFIED ELEMENT: value=io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtlpExporterProperties,io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelResourceProperties,io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelSpringProperties (<- io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtlpExporterProperties,io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelResourceProperties,io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.PropagationProperties)

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/OpenTelemetryAutoConfiguration.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.MapConverter;
1111
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.SdkEnabled;
1212
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelResourceProperties;
13+
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelSpringProperties;
1314
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtlpExporterProperties;
14-
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.PropagationProperties;
1515
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.SpringConfigProperties;
1616
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.resources.DistroVersionResourceProvider;
1717
import io.opentelemetry.instrumentation.spring.autoconfigure.internal.resources.SpringResourceProvider;
@@ -51,7 +51,7 @@
5151
@EnableConfigurationProperties({
5252
OtlpExporterProperties.class,
5353
OtelResourceProperties.class,
54-
PropagationProperties.class
54+
OtelSpringProperties.class
5555
})
5656
public class OpenTelemetryAutoConfiguration {
5757

@@ -90,7 +90,7 @@ public AutoConfiguredOpenTelemetrySdk autoConfiguredOpenTelemetrySdk(
9090
Environment env,
9191
OtlpExporterProperties otlpExporterProperties,
9292
OtelResourceProperties resourceProperties,
93-
PropagationProperties propagationProperties,
93+
OtelSpringProperties otelSpringProperties,
9494
OpenTelemetrySdkComponentLoader componentLoader) {
9595

9696
return AutoConfigureUtil.setComponentLoader(
@@ -101,7 +101,7 @@ public AutoConfiguredOpenTelemetrySdk autoConfiguredOpenTelemetrySdk(
101101
env,
102102
otlpExporterProperties,
103103
resourceProperties,
104-
propagationProperties,
104+
otelSpringProperties,
105105
c)),
106106
componentLoader)
107107
.build();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties;
7+
8+
import java.util.Collections;
9+
import java.util.List;
10+
import org.springframework.boot.context.properties.ConfigurationProperties;
11+
12+
/**
13+
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
14+
* any time.
15+
*/
16+
// yaml lists only work if you create a @ConfigurationProperties object
17+
@ConfigurationProperties(prefix = "otel")
18+
public final class OtelSpringProperties {
19+
20+
/**
21+
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
22+
* any time.
23+
*/
24+
public static final class Java {
25+
/**
26+
* This class is internal and is hence not for public use. Its APIs are unstable and can change
27+
* at any time.
28+
*/
29+
public static final class Enabled {
30+
/**
31+
* This class is internal and is hence not for public use. Its APIs are unstable and can
32+
* change at any time.
33+
*/
34+
public static final class Resource {
35+
private List<String> providers = Collections.emptyList();
36+
37+
public List<String> getProviders() {
38+
return providers;
39+
}
40+
41+
public void setProviders(List<String> providers) {
42+
this.providers = providers;
43+
}
44+
}
45+
46+
private Enabled.Resource resource = new Enabled.Resource();
47+
48+
public Enabled.Resource getResource() {
49+
return resource;
50+
}
51+
52+
public void setResource(Enabled.Resource resource) {
53+
this.resource = resource;
54+
}
55+
}
56+
57+
/**
58+
* This class is internal and is hence not for public use. Its APIs are unstable and can change
59+
* at any time.
60+
*/
61+
public static final class Disabled {
62+
/**
63+
* This class is internal and is hence not for public use. Its APIs are unstable and can
64+
* change at any time.
65+
*/
66+
public static final class Resource {
67+
private List<String> providers = Collections.emptyList();
68+
69+
public List<String> getProviders() {
70+
return providers;
71+
}
72+
73+
public void setProviders(List<String> providers) {
74+
this.providers = providers;
75+
}
76+
}
77+
78+
private Disabled.Resource resource = new Disabled.Resource();
79+
80+
public Disabled.Resource getResource() {
81+
return resource;
82+
}
83+
84+
public void setResource(Disabled.Resource resource) {
85+
this.resource = resource;
86+
}
87+
}
88+
89+
private Enabled enabled = new Enabled();
90+
private Java.Disabled disabled = new Java.Disabled();
91+
92+
public Enabled getEnabled() {
93+
return enabled;
94+
}
95+
96+
public void setEnabled(Enabled enabled) {
97+
this.enabled = enabled;
98+
}
99+
100+
public Java.Disabled getDisabled() {
101+
return disabled;
102+
}
103+
104+
public void setDisabled(Java.Disabled disabled) {
105+
this.disabled = disabled;
106+
}
107+
}
108+
109+
/**
110+
* This class is internal and is hence not for public use. Its APIs are unstable and can change at
111+
* any time.
112+
*/
113+
public static final class Experimental {
114+
/**
115+
* This class is internal and is hence not for public use. Its APIs are unstable and can change
116+
* at any time.
117+
*/
118+
public static final class Metrics {
119+
/**
120+
* This class is internal and is hence not for public use. Its APIs are unstable and can
121+
* change at any time.
122+
*/
123+
public static final class View {
124+
private List<String> config = Collections.emptyList();
125+
126+
public List<String> getConfig() {
127+
return config;
128+
}
129+
130+
public void setConfig(List<String> config) {
131+
this.config = config;
132+
}
133+
}
134+
135+
private View view = new View();
136+
137+
public View getView() {
138+
return view;
139+
}
140+
141+
public void setView(View view) {
142+
this.view = view;
143+
}
144+
}
145+
146+
/**
147+
* This class is internal and is hence not for public use. Its APIs are unstable and can change
148+
* at any time.
149+
*/
150+
public static final class Resource {
151+
/**
152+
* This class is internal and is hence not for public use. Its APIs are unstable and can
153+
* change at any time.
154+
*/
155+
public static final class Disabled {
156+
private List<String> keys = Collections.emptyList();
157+
158+
public List<String> getKeys() {
159+
return keys;
160+
}
161+
162+
public void setKeys(List<String> keys) {
163+
this.keys = keys;
164+
}
165+
}
166+
167+
private Resource.Disabled disabled = new Resource.Disabled();
168+
169+
public Resource.Disabled getDisabled() {
170+
return disabled;
171+
}
172+
173+
public void setDisabled(Resource.Disabled disabled) {
174+
this.disabled = disabled;
175+
}
176+
}
177+
178+
private Metrics metrics = new Metrics();
179+
private Resource resource = new Resource();
180+
181+
public Metrics getMetrics() {
182+
return metrics;
183+
}
184+
185+
public void setMetrics(Metrics metrics) {
186+
this.metrics = metrics;
187+
}
188+
189+
public Resource getResource() {
190+
return resource;
191+
}
192+
193+
public void setResource(Resource resource) {
194+
this.resource = resource;
195+
}
196+
}
197+
198+
private List<String> propagators = Collections.emptyList();
199+
200+
private Java java = new Java();
201+
202+
private Experimental experimental = new Experimental();
203+
204+
public List<String> getPropagators() {
205+
return propagators;
206+
}
207+
208+
public void setPropagators(List<String> propagators) {
209+
this.propagators = propagators;
210+
}
211+
212+
public Java getJava() {
213+
return java;
214+
}
215+
216+
public void setJava(Java java) {
217+
this.java = java;
218+
}
219+
220+
public Experimental getExperimental() {
221+
return experimental;
222+
}
223+
224+
public void setExperimental(Experimental experimental) {
225+
this.experimental = experimental;
226+
}
227+
228+
public List<String> getJavaEnabledResourceProviders() {
229+
return java.getEnabled().getResource().getProviders();
230+
}
231+
232+
public List<String> getJavaDisabledResourceProviders() {
233+
return java.getDisabled().getResource().getProviders();
234+
}
235+
236+
public List<String> getExperimentalMetricsViewConfig() {
237+
return experimental.getMetrics().getView().getConfig();
238+
}
239+
240+
public List<String> getExperimentalResourceDisabledKeys() {
241+
return experimental.getResource().getDisabled().getKeys();
242+
}
243+
}

instrumentation/spring/spring-boot-autoconfigure/src/main/java/io/opentelemetry/instrumentation/spring/autoconfigure/internal/properties/PropagationProperties.java

-28
This file was deleted.

0 commit comments

Comments
 (0)