diff --git a/translation-stackdriver/src/test/java/zipkin2/translation/stackdriver/AttributesExtractorTest.java b/translation-stackdriver/src/test/java/zipkin2/translation/stackdriver/AttributesExtractorTest.java index 66aa9fa7..93ce3fb3 100644 --- a/translation-stackdriver/src/test/java/zipkin2/translation/stackdriver/AttributesExtractorTest.java +++ b/translation-stackdriver/src/test/java/zipkin2/translation/stackdriver/AttributesExtractorTest.java @@ -148,6 +148,25 @@ public void testEndpointIsSetIpv6() { assertThat(clientLabels).doesNotContainKeys("endpoint.ipv4", "endpoint.ipv6"); } + @Test + public void testEndpointWithNullServiceName() { + Endpoint.Builder serverEndpointBuilder = Endpoint.newBuilder().port(80); + Endpoint serverEndpoint = serverEndpointBuilder.build(); + assertThat(serverEndpoint.serviceName()).isNull(); + Span serverSpan = + Span.newBuilder() + .kind(Kind.SERVER) + .traceId("4") + .name("test-span") + .id("5") + .localEndpoint(serverEndpoint) + .build(); + + AttributesExtractor extractor = new AttributesExtractor(Collections.emptyMap()); + Map serverLabels = extractor.extract(serverSpan).getAttributeMapMap(); + assertThat(serverLabels).doesNotContainKey("endpoint.serviceName"); + } + @Test public void testComponentLabelIsSet() { AttributesExtractor extractor = new AttributesExtractor(Collections.emptyMap());