use of zipkin2.TestObjects.FRONTEND in project java by wavefrontHQ.
the class ZipkinPortUnificationHandlerTest method testZipkinHandler.
@Test
public void testZipkinHandler() throws Exception {
ZipkinPortUnificationHandler handler = new ZipkinPortUnificationHandler("9411", new NoopHealthCheckManager(), mockTraceHandler, mockTraceSpanLogsHandler, null, () -> false, () -> false, null, new SpanSampler(new RateSampler(1.0D), () -> null), "ProxyLevelAppTag", null);
Endpoint localEndpoint1 = Endpoint.newBuilder().serviceName("frontend").ip("10.0.0.1").build();
zipkin2.Span spanServer1 = zipkin2.Span.newBuilder().traceId("2822889fe47043bd").id("2822889fe47043bd").kind(zipkin2.Span.Kind.SERVER).name("getservice").timestamp(startTime * 1000).duration(1234 * 1000).localEndpoint(localEndpoint1).putTag("http.method", "GET").putTag("http.url", "none+h1c://localhost:8881/").putTag("http.status_code", "200").build();
Endpoint localEndpoint2 = Endpoint.newBuilder().serviceName("backend").ip("10.0.0.1").build();
zipkin2.Span spanServer2 = zipkin2.Span.newBuilder().traceId("2822889fe47043bd").id("d6ab73f8a3930ae8").parentId("2822889fe47043bd").kind(zipkin2.Span.Kind.SERVER).name("getbackendservice").timestamp(startTime * 1000).duration(2234 * 1000).localEndpoint(localEndpoint2).putTag("http.method", "GET").putTag("http.url", "none+h2c://localhost:9000/api").putTag("http.status_code", "200").putTag("component", "jersey-server").putTag("application", "SpanLevelAppTag").addAnnotation(startTime * 1000, "start processing").build();
zipkin2.Span spanServer3 = zipkin2.Span.newBuilder().traceId("2822889fe47043bd").id("d6ab73f8a3930ae8").kind(zipkin2.Span.Kind.CLIENT).name("getbackendservice2").timestamp(startTime * 1000).duration(2234 * 1000).localEndpoint(localEndpoint2).putTag("http.method", "GET").putTag("http.url", "none+h2c://localhost:9000/api").putTag("http.status_code", "200").putTag("component", "jersey-server").putTag("application", "SpanLevelAppTag").putTag("emptry.tag", "").addAnnotation(startTime * 1000, "start processing").build();
List<zipkin2.Span> zipkinSpanList = ImmutableList.of(spanServer1, spanServer2, spanServer3);
// Validate all codecs i.e. JSON_V1, JSON_V2, THRIFT and PROTO3.
for (SpanBytesEncoder encoder : SpanBytesEncoder.values()) {
ByteBuf content = Unpooled.copiedBuffer(encoder.encodeList(zipkinSpanList));
// take care of mocks.
doMockLifecycle(mockTraceHandler, mockTraceSpanLogsHandler);
ChannelHandlerContext mockCtx = createNiceMock(ChannelHandlerContext.class);
doMockLifecycle(mockCtx);
FullHttpRequest httpRequest = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "http://localhost:9411/api/v1/spans", content, true);
handler.handleHttpMessage(mockCtx, httpRequest);
verify(mockTraceHandler, mockTraceSpanLogsHandler);
}
}
use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class StrictTraceIdTest method traces.
List<List<Span>> traces() {
// 64-bit trace ID
Span span1 = Span.newBuilder().traceId(CLIENT_SPAN.traceId().substring(16)).id("1").name("1").putTag("foo", "1").timestamp(TODAY * 1000L).localEndpoint(FRONTEND).build();
// 128-bit trace ID prefixed by above
Span span2 = span1.toBuilder().traceId(CLIENT_SPAN.traceId()).name("2").putTag("foo", "2").build();
// Different 128-bit trace ID prefixed by above
Span span3 = span1.toBuilder().traceId("1" + span1.traceId()).name("3").putTag("foo", "3").build();
return new ArrayList<>(asList(asList(span1), asList(span2), asList(span3)));
}
use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class V1SpanConverterTest method convert_ca.
@Test
public void convert_ca() {
V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).addAnnotation(1472470996199000L, "sr", BACKEND).addBinaryAnnotation("ca", FRONTEND).build();
Span v2 = Span.newBuilder().traceId("1").id("2").kind(Kind.SERVER).timestamp(1472470996199000L).localEndpoint(BACKEND).remoteEndpoint(FRONTEND).shared(true).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class V1SpanConverterTest method convert_ca_incorrect_value.
@Test
public void convert_ca_incorrect_value() {
V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).addAnnotation(1472470996199000L, "sr", BACKEND).addBinaryAnnotation("ca", "1", FRONTEND).build();
Span v2 = Span.newBuilder().traceId("1").id("2").kind(Kind.SERVER).timestamp(1472470996199000L).localEndpoint(BACKEND).remoteEndpoint(FRONTEND).shared(true).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of zipkin2.TestObjects.FRONTEND in project zipkin by openzipkin.
the class SpanConverterTest method producer_remote.
@Test
public void producer_remote() {
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").name("send").kind(Kind.PRODUCER).localEndpoint(FRONTEND).remoteEndpoint(kafka).timestamp(1472470996199000L).build();
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("send").timestamp(1472470996199000L).addAnnotation(1472470996199000L, "ms", FRONTEND).addBinaryAnnotation("ma", kafka).build();
assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
Aggregations