Search in sources :

Example 91 with Endpoint

use of com.google.cloud.servicedirectory.v1.Endpoint in project zipkin by openzipkin.

the class V1BinaryAnnotation method hashCode.

@Override
public int hashCode() {
    int h = 1;
    h *= 1000003;
    h ^= key.hashCode();
    h *= 1000003;
    h ^= stringValue == null ? 0 : stringValue.hashCode();
    h *= 1000003;
    h ^= endpoint == null ? 0 : endpoint.hashCode();
    return h;
}
Also used : Endpoint(zipkin2.Endpoint)

Example 92 with Endpoint

use of com.google.cloud.servicedirectory.v1.Endpoint in project zipkin by openzipkin.

the class JacksonSpanDecoder method parseEndpoint.

static Endpoint parseEndpoint(JsonParser jsonParser) throws IOException {
    if (!jsonParser.isExpectedStartObjectToken()) {
        throw new IOException("Not a valid JSON object, start token: " + jsonParser.currentToken());
    }
    String serviceName = null, ipv4 = null, ipv6 = null;
    int port = 0;
    while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
        String fieldName = jsonParser.currentName();
        JsonToken value = jsonParser.nextToken();
        if (value == JsonToken.VALUE_NULL) {
            continue;
        }
        switch(fieldName) {
            case "serviceName":
                serviceName = jsonParser.getValueAsString();
                break;
            case "ipv4":
                ipv4 = jsonParser.getValueAsString();
                break;
            case "ipv6":
                ipv6 = jsonParser.getValueAsString();
                break;
            case "port":
                port = jsonParser.getValueAsInt();
                break;
            default:
                jsonParser.skipChildren();
        }
    }
    if (serviceName == null && ipv4 == null && ipv6 == null && port == 0)
        return null;
    return Endpoint.newBuilder().serviceName(serviceName).ip(ipv4).ip(ipv6).port(port).build();
}
Also used : JsonToken(com.fasterxml.jackson.core.JsonToken) UncheckedIOException(java.io.UncheckedIOException) IOException(java.io.IOException) Endpoint(zipkin2.Endpoint)

Example 93 with Endpoint

use of com.google.cloud.servicedirectory.v1.Endpoint in project zipkin by openzipkin.

the class ProtobufSpanDecoder method decodeEndpoint.

private static Endpoint decodeEndpoint(CodedInputStream input) throws IOException {
    Endpoint.Builder endpoint = Endpoint.newBuilder();
    boolean done = false;
    while (!done) {
        int tag = input.readTag();
        switch(tag) {
            case 0:
                done = true;
                break;
            case 10:
                {
                    endpoint.serviceName(input.readStringRequireUtf8());
                    break;
                }
            case 18:
            case 26:
                {
                    endpoint.parseIp(input.readByteArray());
                    break;
                }
            case 32:
                {
                    endpoint.port(input.readInt32());
                    break;
                }
            default:
                {
                    logAndSkip(input, tag);
                    break;
                }
        }
    }
    return endpoint.build();
}
Also used : Endpoint(zipkin2.Endpoint) Endpoint(zipkin2.Endpoint)

Example 94 with Endpoint

use of com.google.cloud.servicedirectory.v1.Endpoint in project zipkin by openzipkin.

the class ITDependencies method annotationNamedErrorIsntError.

/**
 * A timeline annotation named error is not a failed span. A tag/binary annotation is.
 */
@Test
protected void annotationNamedErrorIsntError(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    String traceId = newTraceId();
    Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
    Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
    List<Span> trace = asList(Span.newBuilder().traceId(traceId).id("10").timestamp((TODAY + 50) * 1000).kind(Kind.CLIENT).localEndpoint(frontend).build(), Span.newBuilder().traceId(traceId).id("10").shared(true).timestamp((TODAY + 100) * 1000).kind(Kind.SERVER).localEndpoint(backend).addAnnotation((TODAY + 72) * 1000, "error").build());
    processDependencies(trace);
    assertThat(store().getDependencies(endTs(trace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build());
}
Also used : Endpoint(zipkin2.Endpoint) Span(zipkin2.Span) V1Span(zipkin2.v1.V1Span) Test(org.junit.jupiter.api.Test)

Example 95 with Endpoint

use of com.google.cloud.servicedirectory.v1.Endpoint in project zipkin by openzipkin.

the class ITDependencies method getDependencies_linksMixedTraceId.

/**
 * This tests that dependency linking ignores the high-bits of the trace ID when grouping spans
 * for dependency links. This allows environments with 64-bit instrumentation to participate in
 * the same trace as 128-bit instrumentation.
 */
@Test
protected void getDependencies_linksMixedTraceId(TestInfo testInfo) throws Exception {
    String testSuffix = testSuffix(testInfo);
    String traceId = newTraceId();
    Endpoint frontend = suffixServiceName(TestObjects.FRONTEND, testSuffix);
    Endpoint backend = suffixServiceName(TestObjects.BACKEND, testSuffix);
    List<Span> mixedTrace = asList(Span.newBuilder().traceId(traceId).id("1").name("get").kind(Kind.SERVER).timestamp(TODAY * 1000L).duration(350 * 1000L).localEndpoint(frontend).build(), // the server dropped traceIdHigh
    Span.newBuilder().traceId(traceId.substring(16)).parentId("1").id("2").name("get").kind(Kind.SERVER).shared(true).timestamp((TODAY + 100) * 1000L).duration(250 * 1000L).localEndpoint(backend).build(), Span.newBuilder().traceId(traceId).parentId("1").id("2").kind(Kind.CLIENT).timestamp((TODAY + 50) * 1000L).duration(300 * 1000L).localEndpoint(frontend).build());
    processDependencies(mixedTrace);
    assertThat(store().getDependencies(endTs(mixedTrace), DAY).execute()).containsOnly(DependencyLink.newBuilder().parent(frontend.serviceName()).child(backend.serviceName()).callCount(1).build());
}
Also used : Endpoint(zipkin2.Endpoint) Span(zipkin2.Span) V1Span(zipkin2.v1.V1Span) Test(org.junit.jupiter.api.Test)

Aggregations

Endpoint (zipkin2.Endpoint)73 Span (zipkin2.Span)33 Test (org.junit.Test)28 Endpoint (org.jboss.remoting3.Endpoint)22 Test (org.junit.jupiter.api.Test)20 V1Span (zipkin2.v1.V1Span)16 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)10 SpanSampler (com.wavefront.agent.sampler.SpanSampler)10 ByteBuf (io.netty.buffer.ByteBuf)10 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)10 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)10 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)10 Span (wavefront.report.Span)10 IOException (java.io.IOException)8 URI (java.net.URI)8 Annotation (wavefront.report.Annotation)8 ServiceName (org.jboss.msc.service.ServiceName)7 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)6 URISyntaxException (java.net.URISyntaxException)6 Endpoint (org.apache.woden.wsdl20.Endpoint)6