Search in sources :

Example 56 with Endpoint

use of org.jboss.remoting3.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 57 with Endpoint

use of org.jboss.remoting3.Endpoint in project zipkin by openzipkin.

the class V1JsonSpanReader method readAnnotation.

void readAnnotation(JsonReader reader) throws IOException {
    String nextName;
    reader.beginObject();
    Long timestamp = null;
    String value = null;
    Endpoint endpoint = null;
    while (reader.hasNext()) {
        nextName = reader.nextName();
        if (nextName.equals("timestamp")) {
            timestamp = reader.nextLong();
        } else if (nextName.equals("value")) {
            value = reader.nextString();
        } else if (nextName.equals("endpoint") && !reader.peekNull()) {
            endpoint = ENDPOINT_READER.fromJson(reader);
        } else {
            reader.skipValue();
        }
    }
    if (timestamp == null || value == null) {
        throw new IllegalArgumentException("Incomplete annotation at " + reader.getPath());
    }
    reader.endObject();
    builder.addAnnotation(timestamp, value, endpoint);
}
Also used : Endpoint(zipkin2.Endpoint)

Example 58 with Endpoint

use of org.jboss.remoting3.Endpoint in project zipkin by openzipkin.

the class V1SpanWriter method sizeInBytes.

@Override
public int sizeInBytes(V1Span value) {
    // {"traceId":"xxxxxxxxxxxxxxxx"
    int sizeInBytes = 29;
    if (value.traceIdHigh() != 0L)
        sizeInBytes += 16;
    if (value.parentId() != 0L) {
        // ,"parentId":"0123456789abcdef"
        sizeInBytes += 30;
    }
    // ,"id":"0123456789abcdef"
    sizeInBytes += 24;
    // ,"name":""
    sizeInBytes += 10;
    if (value.name() != null) {
        sizeInBytes += jsonEscapedSizeInBytes(value.name());
    }
    if (value.timestamp() != 0L) {
        // ,"timestamp":
        sizeInBytes += 13;
        sizeInBytes += asciiSizeInBytes(value.timestamp());
    }
    if (value.duration() != 0L) {
        // ,"duration":
        sizeInBytes += 12;
        sizeInBytes += asciiSizeInBytes(value.duration());
    }
    int annotationCount = value.annotations().size();
    Endpoint lastEndpoint = null;
    int lastEndpointSize = 0;
    if (annotationCount > 0) {
        // ,"annotations":[]
        sizeInBytes += 17;
        // comma to join elements
        if (annotationCount > 1)
            sizeInBytes += annotationCount - 1;
        for (int i = 0; i < annotationCount; i++) {
            V1Annotation a = value.annotations().get(i);
            Endpoint endpoint = a.endpoint();
            int endpointSize;
            if (endpoint == null) {
                endpointSize = 0;
            } else if (endpoint.equals(lastEndpoint)) {
                endpointSize = lastEndpointSize;
            } else {
                lastEndpoint = endpoint;
                endpointSize = lastEndpointSize = endpointSizeInBytes(endpoint, true);
            }
            sizeInBytes += V2SpanWriter.annotationSizeInBytes(a.timestamp(), a.value(), endpointSize);
        }
    }
    int binaryAnnotationCount = value.binaryAnnotations().size();
    if (binaryAnnotationCount > 0) {
        // ,"binaryAnnotations":[]
        sizeInBytes += 23;
        // commas
        if (binaryAnnotationCount > 1)
            sizeInBytes += binaryAnnotationCount - 1;
        for (int i = 0; i < binaryAnnotationCount; ) {
            V1BinaryAnnotation a = value.binaryAnnotations().get(i++);
            Endpoint endpoint = a.endpoint();
            int endpointSize;
            if (endpoint == null) {
                endpointSize = 0;
            } else if (endpoint.equals(lastEndpoint)) {
                endpointSize = lastEndpointSize;
            } else {
                lastEndpoint = endpoint;
                endpointSize = lastEndpointSize = endpointSizeInBytes(endpoint, true);
            }
            if (a.stringValue() != null) {
                sizeInBytes += binaryAnnotationSizeInBytes(a.key(), a.stringValue(), endpointSize);
            } else {
                // {"key":"NN","value":true,"endpoint":}
                sizeInBytes += 37;
                sizeInBytes += endpointSize;
            }
        }
    }
    // ,"debug":true
    if (Boolean.TRUE.equals(value.debug()))
        sizeInBytes += 13;
    // }
    return ++sizeInBytes;
}
Also used : Endpoint(zipkin2.Endpoint) V1BinaryAnnotation(zipkin2.v1.V1BinaryAnnotation) Endpoint(zipkin2.Endpoint) V1Annotation(zipkin2.v1.V1Annotation)

Example 59 with Endpoint

use of org.jboss.remoting3.Endpoint in project zipkin by openzipkin.

the class V2SpanWriter method endpointSizeInBytes.

static int endpointSizeInBytes(Endpoint value, boolean writeEmptyServiceName) {
    // {
    int sizeInBytes = 1;
    String serviceName = value.serviceName();
    if (serviceName == null && writeEmptyServiceName)
        serviceName = "";
    if (serviceName != null) {
        // "serviceName":""
        sizeInBytes += 16;
        sizeInBytes += jsonEscapedSizeInBytes(serviceName);
    }
    if (value.ipv4() != null) {
        // ,
        if (sizeInBytes != 1)
            sizeInBytes++;
        // "ipv4":""
        sizeInBytes += 9;
        sizeInBytes += value.ipv4().length();
    }
    if (value.ipv6() != null) {
        // ,
        if (sizeInBytes != 1)
            sizeInBytes++;
        // "ipv6":""
        sizeInBytes += 9;
        sizeInBytes += value.ipv6().length();
    }
    int port = value.portAsInt();
    if (port != 0) {
        // ,
        if (sizeInBytes != 1)
            sizeInBytes++;
        // "port":
        sizeInBytes += 7;
        sizeInBytes += asciiSizeInBytes(port);
    }
    // }
    return ++sizeInBytes;
}
Also used : Endpoint(zipkin2.Endpoint)

Example 60 with Endpoint

use of org.jboss.remoting3.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)

Aggregations

Endpoint (zipkin2.Endpoint)60 Span (zipkin2.Span)27 Test (org.junit.jupiter.api.Test)18 V1Span (zipkin2.v1.V1Span)16 Test (org.junit.Test)15 NoopHealthCheckManager (com.wavefront.agent.channel.NoopHealthCheckManager)5 SpanSampler (com.wavefront.agent.sampler.SpanSampler)5 ByteBuf (io.netty.buffer.ByteBuf)5 ChannelHandlerContext (io.netty.channel.ChannelHandlerContext)5 DefaultFullHttpRequest (io.netty.handler.codec.http.DefaultFullHttpRequest)5 FullHttpRequest (io.netty.handler.codec.http.FullHttpRequest)5 ArrayList (java.util.ArrayList)5 Span (wavefront.report.Span)5 Endpoint (org.apache.woden.wsdl20.Endpoint)4 TestObjects.newClientSpan (zipkin2.TestObjects.newClientSpan)4 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)3 IOException (java.io.IOException)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Service (org.apache.woden.wsdl20.Service)3