use of zipkin2.Component in project spring-cloud-gcp by spring-cloud.
the class LabelExtractorTests method testRpcClientBasicsTraceKeys.
@Test
public void testRpcClientBasicsTraceKeys() {
LabelExtractor extractor = new LabelExtractor(new TraceKeys());
String instanceId = "localhost";
long begin = 1238912378081L;
long end = 1238912378123L;
Span span = Span.newBuilder().traceId("123").id("9999").timestamp(begin).duration(end - begin).putTag("http.host", "localhost").putTag("custom-tag", "hello").localEndpoint(Endpoint.newBuilder().serviceName("hello-service").build()).build();
Map<String, String> labels = extractor.extract(span);
Assert.assertNotNull("span shouldn't be null", span);
Assert.assertEquals("localhost", labels.get("/http/host"));
Assert.assertEquals("spring-cloud-gcp-trace", labels.get("/agent"));
Assert.assertEquals("hello-service", labels.get("/component"));
Assert.assertEquals("hello", labels.get("cloud.spring.io/custom-tag"));
}
Aggregations