use of zipkin.Span in project zipkin by openzipkin.
the class CassandraSpanConsumerTest method logTimestampMissingOnClientSend.
@Test
public void logTimestampMissingOnClientSend() {
Span span = Span.builder().traceId(1L).parentId(1L).id(2L).name("query").addAnnotation(Annotation.create(0L, CLIENT_SEND, APP_ENDPOINT)).addAnnotation(Annotation.create(0L, CLIENT_RECV, APP_ENDPOINT)).build();
accept(span);
verify(mockAppender).doAppend(considerSwitchStrategyLog());
}
use of zipkin.Span in project zipkin by openzipkin.
the class StrictTraceIdFalseTest method canSearchByLower64Bits.
@Test
public void canSearchByLower64Bits() throws IOException {
Span span = Span.builder().traceIdHigh(1L).traceId(2L).id(2L).name("test-span").addAnnotation(Annotation.create(System.currentTimeMillis() * 1000L, "hello", Endpoint.create("foo-service", 127 << 24 | 1))).build();
byte[] spansInJson = Codec.JSON.writeSpans(Collections.singletonList(span));
client.newCall(new Request.Builder().url("http://localhost:" + zipkin.port() + "/api/v1/spans").post(RequestBody.create(MediaType.parse("application/json"), spansInJson)).build()).execute();
Response response = client.newCall(new Request.Builder().url("http://localhost:" + zipkin.port() + "/api/v1/trace/" + Util.toLowerHex(span.traceId)).build()).execute();
assertEquals(span, Codec.JSON.readSpans(response.body().bytes()).get(0));
}
use of zipkin.Span in project zipkin by openzipkin.
the class ZipkinServerIntegrationTest method getBy128BitId.
@Test
public void getBy128BitId() throws Exception {
Span span1 = TRACE.get(0).toBuilder().traceIdHigh(1L).build();
Span span2 = span1.toBuilder().traceIdHigh(2L).build();
performAsync(post("/api/v1/spans").content(Codec.JSON.writeSpans(asList(span1, span2)))).andExpect(status().isAccepted());
// sleep as the the storage operation is async
Thread.sleep(1500);
// Tosses high bits
mockMvc.perform(get(format("/api/v1/trace/%016x%016x", span2.traceIdHigh, span2.traceId))).andExpect(status().isOk()).andExpect(content().string(new String(Codec.JSON.writeSpans(asList(span2)), UTF_8)));
}
use of zipkin.Span in project zipkin by openzipkin.
the class CassandraUtilTest method annotationKeys_skipsCoreAndAddressAnnotations.
@Test
public void annotationKeys_skipsCoreAndAddressAnnotations() throws Exception {
Span span = TestObjects.TRACE.get(1);
assertThat(span.annotations).extracting(a -> a.value).matches(Constants.CORE_ANNOTATIONS::containsAll);
assertThat(span.binaryAnnotations).extracting(b -> b.key).containsOnly(Constants.SERVER_ADDR, Constants.CLIENT_ADDR);
assertThat(CassandraUtil.annotationKeys(span)).isEmpty();
}
use of zipkin.Span in project zipkin by openzipkin.
the class CassandraUtilTest method annotationKeys_skipsBinaryAnnotationsLongerThan256chars.
@Test
public void annotationKeys_skipsBinaryAnnotationsLongerThan256chars() throws Exception {
// example long value
String arn = "arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012";
// example too long value
String url = "http://webservices.amazon.com/onca/xml?AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE&AssociateTag=mytag-20&ItemId=0679722769&Operation=ItemLookup&ResponseGroup=Images%2CItemAttributes%2COffers%2CReviews&Service=AWSECommerceService&Timestamp=2014-08-18T12%3A00%3A00Z&Version=2013-08-01&Signature=j7bZM0LXZ9eXeZruTqWm2DIvDYVUU3wxPPpp%2BiXxzQc%3D";
Span span = TestObjects.TRACE.get(1).toBuilder().binaryAnnotations(ImmutableList.of(BinaryAnnotation.create("aws.arn", arn, TestObjects.WEB_ENDPOINT), BinaryAnnotation.create(TraceKeys.HTTP_URL, url, TestObjects.WEB_ENDPOINT))).build();
assertThat(CassandraUtil.annotationKeys(span)).containsOnly("web:aws.arn:" + arn);
}
Aggregations