Polish "Use unknown_service as default application name for OpenTelemetry"

See gh-38219
This commit is contained in:
Moritz Halbritter 2024-01-10 11:36:34 +01:00
parent 470029aff1
commit 3e705e8d56
3 changed files with 3 additions and 3 deletions

View File

@ -41,7 +41,7 @@ class OtlpPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapter<Ot
/**
* Default value for application name if {@code spring.application.name} is not set.
*/
private static final String DEFAULT_APPLICATION_NAME = "application";
private static final String DEFAULT_APPLICATION_NAME = "unknown_service";
private final OpenTelemetryProperties openTelemetryProperties;

View File

@ -136,7 +136,7 @@ class OtlpPropertiesConfigAdapterTests {
@Test
void shouldUseDefaultApplicationNameIfApplicationNameIsNotSet() {
assertThat(createAdapter().resourceAttributes()).containsEntry("service.name", "application");
assertThat(createAdapter().resourceAttributes()).containsEntry("service.name", "unknown_service");
}
private OtlpPropertiesConfigAdapter createAdapter() {

View File

@ -183,7 +183,7 @@ class OpenTelemetryAutoConfigurationTests {
exporter.await(Duration.ofSeconds(10));
SpanData spanData = exporter.getExportedSpans().get(0);
Map<AttributeKey<?>, Object> expectedAttributes = Resource.getDefault()
.merge(Resource.create(Attributes.of(ResourceAttributes.SERVICE_NAME, "application")))
.merge(Resource.create(Attributes.of(ResourceAttributes.SERVICE_NAME, "unknown_service")))
.getAttributes()
.asMap();
assertThat(spanData.getResource().getAttributes().asMap()).isEqualTo(expectedAttributes);