use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.
the class KryoTest method kryoJavaSerialization_dependencyLink.
@Test
public void kryoJavaSerialization_dependencyLink() {
Kryo kryo = new Kryo();
kryo.register(DependencyLink.class, new JavaSerializer());
DependencyLink link = DependencyLink.newBuilder().parent("client").child("server").callCount(2L).errorCount(23L).build();
Output output = new Output(4096);
kryo.writeObject(output, link);
output.flush();
byte[] serialized = output.getBuffer();
assertThat(kryo.readObject(new Input(serialized), DependencyLink.class)).isEqualTo(link);
}
use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.
the class SpanConverterTest method server.
@Test
public void server() {
Span v2 = Span.newBuilder().traceId("1").id("2").name("get").kind(Kind.SERVER).localEndpoint(BACKEND).remoteEndpoint(FRONTEND).timestamp(1472470996199000L).duration(207000L).putTag("http.path", "/api").putTag("finagle.version", "6.45.0").build();
V1Span v1 = V1Span.newBuilder().traceId(1L).id(2L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "sr", BACKEND).addAnnotation(1472470996406000L, "ss", BACKEND).addBinaryAnnotation("http.path", "/api", BACKEND).addBinaryAnnotation("finagle.version", "6.45.0", BACKEND).addBinaryAnnotation("ca", FRONTEND).build();
assertThat(v2SpanConverter.convert(v2)).usingRecursiveComparison().isEqualTo(v1);
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.
the class Trace method compareEndpoint.
/**
* Put spans with null endpoints first, so that their data can be attached to the first span with
* the same ID and endpoint. It is possible that a server can get the same request on a different
* port. Not addressing this.
*/
static int compareEndpoint(Endpoint left, Endpoint right) {
if (left == null) {
// nulls first
return (right == null) ? 0 : -1;
} else if (right == null) {
return 1;
}
int byService = nullSafeCompareTo(left.serviceName(), right.serviceName(), false);
if (byService != 0)
return byService;
int byIpV4 = nullSafeCompareTo(left.ipv4(), right.ipv4(), false);
if (byIpV4 != 0)
return byIpV4;
return nullSafeCompareTo(left.ipv6(), right.ipv6(), false);
}
use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.
the class SpanConverterTest method redundantServiceNameOnAddressAnnotations_server.
/**
* On server spans, ignore service name on remote address binary annotation that appear loopback
* based on the service name. This could happen when finagle service labels are used incorrectly,
* which as common in early instrumentation.
*
* <p>This prevents an uncorrectable scenario which results in extra (loopback) links on server
* spans.
*/
@Test
public void redundantServiceNameOnAddressAnnotations_server() {
Span v2 = Span.newBuilder().traceId("1").parentId("2").id("3").kind(Kind.SERVER).name("get").localEndpoint(FRONTEND).timestamp(1472470996199000L).duration(207000L).build();
V1Span v1 = V1Span.newBuilder().traceId(1L).parentId(2L).id(3L).name("get").timestamp(1472470996199000L).duration(207000L).addAnnotation(1472470996199000L, "sr", FRONTEND).addAnnotation(1472470996406000L, "ss", FRONTEND).addBinaryAnnotation("ca", FRONTEND).addBinaryAnnotation("sa", FRONTEND).build();
assertThat(v1SpanConverter.convert(v1)).containsExactly(v2);
}
use of zipkin2.Span.Kind.SERVER in project zipkin by openzipkin.
the class ITElasticsearchClientInitialization method doesntHangWhenAllDown.
/**
* blocking a little is ok, but blocking forever is not.
*/
@Test(timeout = 3000L)
public void doesntHangWhenAllDown() throws IOException {
TestPropertyValues.of("spring.config.name=zipkin-server", "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.timeout:1000", "zipkin.storage.elasticsearch.hosts:127.0.0.1:1234,127.0.0.1:5678").applyTo(context);
Access.registerElasticsearch(context);
context.refresh();
try (ElasticsearchStorage storage = context.getBean(ElasticsearchStorage.class)) {
CheckResult result = storage.check();
assertThat(result.ok()).isFalse();
}
}
Aggregations