Skip to content

Commit fdcc8d9

Browse files
committed
Rename OtlpProperties to OtlpMetricsProperties
See gh-41460
1 parent 9ef82dc commit fdcc8d9

File tree

5 files changed

+32
-30
lines changed

5 files changed

+32
-30
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/otlp/OtlpMetricsExportAutoConfiguration.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@
5050
@ConditionalOnBean(Clock.class)
5151
@ConditionalOnClass(OtlpMeterRegistry.class)
5252
@ConditionalOnEnabledMetricsExport("otlp")
53-
@EnableConfigurationProperties({ OtlpProperties.class, OpenTelemetryProperties.class })
53+
@EnableConfigurationProperties({ OtlpMetricsProperties.class, OpenTelemetryProperties.class })
5454
public class OtlpMetricsExportAutoConfiguration {
5555

56-
private final OtlpProperties properties;
56+
private final OtlpMetricsProperties properties;
5757

58-
OtlpMetricsExportAutoConfiguration(OtlpProperties properties) {
58+
OtlpMetricsExportAutoConfiguration(OtlpMetricsProperties properties) {
5959
this.properties = properties;
6060
}
6161

@@ -69,7 +69,7 @@ OtlpMetricsConnectionDetails otlpMetricsConnectionDetails() {
6969
@ConditionalOnMissingBean
7070
OtlpConfig otlpConfig(OpenTelemetryProperties openTelemetryProperties,
7171
OtlpMetricsConnectionDetails connectionDetails, Environment environment) {
72-
return new OtlpPropertiesConfigAdapter(this.properties, openTelemetryProperties, connectionDetails,
72+
return new OtlpMetricsPropertiesConfigAdapter(this.properties, openTelemetryProperties, connectionDetails,
7373
environment);
7474
}
7575

@@ -89,13 +89,13 @@ public OtlpMeterRegistry otlpMeterRegistryVirtualThreads(OtlpConfig otlpConfig,
8989
}
9090

9191
/**
92-
* Adapts {@link OtlpProperties} to {@link OtlpMetricsConnectionDetails}.
92+
* Adapts {@link OtlpMetricsProperties} to {@link OtlpMetricsConnectionDetails}.
9393
*/
9494
static class PropertiesOtlpMetricsConnectionDetails implements OtlpMetricsConnectionDetails {
9595

96-
private final OtlpProperties properties;
96+
private final OtlpMetricsProperties properties;
9797

98-
PropertiesOtlpMetricsConnectionDetails(OtlpProperties properties) {
98+
PropertiesOtlpMetricsConnectionDetails(OtlpMetricsProperties properties) {
9999
this.properties = properties;
100100
}
101101

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
* @since 3.0.0
3636
*/
3737
@ConfigurationProperties(prefix = "management.otlp.metrics.export")
38-
public class OtlpProperties extends StepRegistryProperties {
38+
public class OtlpMetricsProperties extends StepRegistryProperties {
3939

4040
/**
41-
* URI of the OLTP server.
41+
* URI of the OTLP server.
4242
*/
4343
private String url = "http://localhost:4318/v1/metrics";
4444

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@
3232
import org.springframework.util.StringUtils;
3333

3434
/**
35-
* Adapter to convert {@link OtlpProperties} to an {@link OtlpConfig}.
35+
* Adapter to convert {@link OtlpMetricsProperties} to an {@link OtlpConfig}.
3636
*
3737
* @author Eddú Meléndez
3838
* @author Jonatan Ivanov
3939
* @author Moritz Halbritter
4040
*/
41-
class OtlpPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<OtlpProperties> implements OtlpConfig {
41+
class OtlpMetricsPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<OtlpMetricsProperties>
42+
implements OtlpConfig {
4243

4344
/**
4445
* Default value for application name if {@code spring.application.name} is not set.
@@ -51,8 +52,9 @@ class OtlpPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<Ot
5152

5253
private final Environment environment;
5354

54-
OtlpPropertiesConfigAdapter(OtlpProperties properties, OpenTelemetryProperties openTelemetryProperties,
55-
OtlpMetricsConnectionDetails connectionDetails, Environment environment) {
55+
OtlpMetricsPropertiesConfigAdapter(OtlpMetricsProperties properties,
56+
OpenTelemetryProperties openTelemetryProperties, OtlpMetricsConnectionDetails connectionDetails,
57+
Environment environment) {
5658
super(properties);
5759
this.connectionDetails = connectionDetails;
5860
this.openTelemetryProperties = openTelemetryProperties;
@@ -71,15 +73,15 @@ public String url() {
7173

7274
@Override
7375
public AggregationTemporality aggregationTemporality() {
74-
return get(OtlpProperties::getAggregationTemporality, OtlpConfig.super::aggregationTemporality);
76+
return get(OtlpMetricsProperties::getAggregationTemporality, OtlpConfig.super::aggregationTemporality);
7577
}
7678

7779
@Override
7880
@SuppressWarnings("removal")
7981
public Map<String, String> resourceAttributes() {
8082
Map<String, String> resourceAttributes = this.openTelemetryProperties.getResourceAttributes();
8183
Map<String, String> result = new HashMap<>((!CollectionUtils.isEmpty(resourceAttributes)) ? resourceAttributes
82-
: get(OtlpProperties::getResourceAttributes, OtlpConfig.super::resourceAttributes));
84+
: get(OtlpMetricsProperties::getResourceAttributes, OtlpConfig.super::resourceAttributes));
8385
result.computeIfAbsent("service.name", (key) -> getApplicationName());
8486
result.computeIfAbsent("service.group", (key) -> getApplicationGroup());
8587
return Collections.unmodifiableMap(result);
@@ -96,27 +98,27 @@ private String getApplicationGroup() {
9698

9799
@Override
98100
public Map<String, String> headers() {
99-
return get(OtlpProperties::getHeaders, OtlpConfig.super::headers);
101+
return get(OtlpMetricsProperties::getHeaders, OtlpConfig.super::headers);
100102
}
101103

102104
@Override
103105
public HistogramFlavor histogramFlavor() {
104-
return get(OtlpProperties::getHistogramFlavor, OtlpConfig.super::histogramFlavor);
106+
return get(OtlpMetricsProperties::getHistogramFlavor, OtlpConfig.super::histogramFlavor);
105107
}
106108

107109
@Override
108110
public int maxScale() {
109-
return get(OtlpProperties::getMaxScale, OtlpConfig.super::maxScale);
111+
return get(OtlpMetricsProperties::getMaxScale, OtlpConfig.super::maxScale);
110112
}
111113

112114
@Override
113115
public int maxBucketCount() {
114-
return get(OtlpProperties::getMaxBucketCount, OtlpConfig.super::maxBucketCount);
116+
return get(OtlpMetricsProperties::getMaxBucketCount, OtlpConfig.super::maxBucketCount);
115117
}
116118

117119
@Override
118120
public TimeUnit baseTimeUnit() {
119-
return get(OtlpProperties::getBaseTimeUnit, OtlpConfig.super::baseTimeUnit);
121+
return get(OtlpMetricsProperties::getBaseTimeUnit, OtlpConfig.super::baseTimeUnit);
120122
}
121123

122124
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
import static org.assertj.core.api.Assertions.entry;
3434

3535
/**
36-
* Tests for {@link OtlpPropertiesConfigAdapter}.
36+
* Tests for {@link OtlpMetricsPropertiesConfigAdapter}.
3737
*
3838
* @author Eddú Meléndez
3939
* @author Moritz Halbritter
4040
*/
41-
class OtlpPropertiesConfigAdapterTests {
41+
class OtlpMetricsPropertiesConfigAdapterTests {
4242

43-
private OtlpProperties properties;
43+
private OtlpMetricsProperties properties;
4444

4545
private OpenTelemetryProperties openTelemetryProperties;
4646

@@ -50,7 +50,7 @@ class OtlpPropertiesConfigAdapterTests {
5050

5151
@BeforeEach
5252
void setUp() {
53-
this.properties = new OtlpProperties();
53+
this.properties = new OtlpMetricsProperties();
5454
this.openTelemetryProperties = new OpenTelemetryProperties();
5555
this.environment = new MockEnvironment();
5656
this.connectionDetails = new PropertiesOtlpMetricsConnectionDetails(this.properties);
@@ -199,9 +199,9 @@ void shouldUseDefaultApplicationGroupIfApplicationGroupIsNotSet() {
199199
assertThat(createAdapter().resourceAttributes()).doesNotContainKey("service.group");
200200
}
201201

202-
private OtlpPropertiesConfigAdapter createAdapter() {
203-
return new OtlpPropertiesConfigAdapter(this.properties, this.openTelemetryProperties, this.connectionDetails,
204-
this.environment);
202+
private OtlpMetricsPropertiesConfigAdapter createAdapter() {
203+
return new OtlpMetricsPropertiesConfigAdapter(this.properties, this.openTelemetryProperties,
204+
this.connectionDetails, this.environment);
205205
}
206206

207207
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@
2424
import static org.assertj.core.api.Assertions.assertThat;
2525

2626
/**
27-
* Tests for {@link OtlpProperties}.
27+
* Tests for {@link OtlpMetricsProperties}.
2828
*
2929
* @author Eddú Meléndez
3030
*/
31-
class OtlpPropertiesTests extends StepRegistryPropertiesTests {
31+
class OtlpMetricsPropertiesTests extends StepRegistryPropertiesTests {
3232

3333
@Test
3434
void defaultValuesAreConsistent() {
35-
OtlpProperties properties = new OtlpProperties();
35+
OtlpMetricsProperties properties = new OtlpMetricsProperties();
3636
OtlpConfig config = OtlpConfig.DEFAULT;
3737
assertStepRegistryDefaultValues(properties, config);
3838
assertThat(properties.getUrl()).isEqualTo(config.url());

0 commit comments

Comments
 (0)