Search in sources :

Example 41 with Endpoint

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

the class ThriftEndpointCodec method sizeInBytes.

static int sizeInBytes(Endpoint value) {
    String serviceName = value.serviceName();
    int sizeInBytes = 0;
    // IPV4
    sizeInBytes += 3 + 4;
    // PORT
    sizeInBytes += 3 + 2;
    sizeInBytes += 3 + 4 + (serviceName != null ? utf8SizeInBytes(serviceName) : 0);
    if (value.ipv6() != null)
        sizeInBytes += 3 + 4 + 16;
    // TYPE_STOP
    sizeInBytes++;
    return sizeInBytes;
}
Also used : Endpoint(zipkin2.Endpoint)

Example 42 with Endpoint

use of com.google.cloud.aiplatform.v1.Endpoint 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);
}
Also used : Endpoint(zipkin2.Endpoint)

Example 43 with Endpoint

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

the class V1JsonSpanReader method readBinaryAnnotation.

void readBinaryAnnotation(JsonReader reader) throws IOException {
    String key = null;
    Endpoint endpoint = null;
    Boolean booleanValue = null;
    String stringValue = null;
    reader.beginObject();
    while (reader.hasNext()) {
        String nextName = reader.nextName();
        if (reader.peekNull()) {
            reader.skipValue();
            continue;
        }
        if (nextName.equals("key")) {
            key = reader.nextString();
        } else if (nextName.equals("value")) {
            if (reader.peekString()) {
                stringValue = reader.nextString();
            } else if (reader.peekBoolean()) {
                booleanValue = reader.nextBoolean();
            } else {
                reader.skipValue();
            }
        } else if (nextName.equals("endpoint")) {
            endpoint = ENDPOINT_READER.fromJson(reader);
        } else {
            reader.skipValue();
        }
    }
    if (key == null) {
        throw new IllegalArgumentException("No key at " + reader.getPath());
    }
    reader.endObject();
    if (stringValue != null) {
        builder.addBinaryAnnotation(key, stringValue, endpoint);
    } else if (booleanValue != null && booleanValue && endpoint != null) {
        if (key.equals("sa") || key.equals("ca") || key.equals("ma")) {
            builder.addBinaryAnnotation(key, endpoint);
        }
    }
}
Also used : Endpoint(zipkin2.Endpoint)

Example 44 with Endpoint

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

the class V1SpanWriter method binaryAnnotationSizeInBytes.

static int binaryAnnotationSizeInBytes(String key, String value, int endpointSize) {
    // {"key":"","value":""}
    int sizeInBytes = 21;
    sizeInBytes += jsonEscapedSizeInBytes(key);
    sizeInBytes += jsonEscapedSizeInBytes(value);
    if (endpointSize != 0) {
        // ,"endpoint":
        sizeInBytes += 12;
        sizeInBytes += endpointSize;
    }
    return sizeInBytes;
}
Also used : Endpoint(zipkin2.Endpoint)

Example 45 with Endpoint

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

the class V1SpanWriter method write.

@Override
public void write(V1Span value, WriteBuffer b) {
    b.writeAscii("{\"traceId\":\"");
    if (value.traceIdHigh() != 0L)
        b.writeLongHex(value.traceIdHigh());
    b.writeLongHex(value.traceId());
    b.writeByte('"');
    if (value.parentId() != 0L) {
        b.writeAscii(",\"parentId\":\"");
        b.writeLongHex(value.parentId());
        b.writeByte('"');
    }
    b.writeAscii(",\"id\":\"");
    b.writeLongHex(value.id());
    b.writeByte('"');
    b.writeAscii(",\"name\":\"");
    if (value.name() != null)
        b.writeUtf8(jsonEscape(value.name()));
    b.writeByte('"');
    if (value.timestamp() != 0L) {
        b.writeAscii(",\"timestamp\":");
        b.writeAscii(value.timestamp());
    }
    if (value.duration() != 0L) {
        b.writeAscii(",\"duration\":");
        b.writeAscii(value.duration());
    }
    int annotationCount = value.annotations().size();
    Endpoint lastEndpoint = null;
    byte[] lastEndpointBytes = null;
    if (annotationCount > 0) {
        b.writeAscii(",\"annotations\":[");
        for (int i = 0; i < annotationCount; ) {
            V1Annotation a = value.annotations().get(i++);
            Endpoint endpoint = a.endpoint();
            byte[] endpointBytes;
            if (endpoint == null) {
                endpointBytes = null;
            } else if (endpoint.equals(lastEndpoint)) {
                endpointBytes = lastEndpointBytes;
            } else {
                lastEndpoint = endpoint;
                endpointBytes = lastEndpointBytes = legacyEndpointBytes(endpoint);
            }
            writeAnnotation(a.timestamp(), a.value(), endpointBytes, b);
            if (i < annotationCount)
                b.writeByte(',');
        }
        b.writeByte(']');
    }
    int binaryAnnotationCount = value.binaryAnnotations().size();
    if (binaryAnnotationCount > 0) {
        b.writeAscii(",\"binaryAnnotations\":[");
        for (int i = 0; i < binaryAnnotationCount; ) {
            V1BinaryAnnotation a = value.binaryAnnotations().get(i++);
            Endpoint endpoint = a.endpoint();
            byte[] endpointBytes;
            if (endpoint == null) {
                endpointBytes = null;
            } else if (endpoint.equals(lastEndpoint)) {
                endpointBytes = lastEndpointBytes;
            } else {
                lastEndpoint = endpoint;
                endpointBytes = lastEndpointBytes = legacyEndpointBytes(endpoint);
            }
            if (a.stringValue() != null) {
                writeBinaryAnnotation(a.key(), a.stringValue(), endpointBytes, b);
            } else {
                b.writeAscii("{\"key\":\"");
                b.writeAscii(a.key());
                b.writeAscii("\",\"value\":true,\"endpoint\":");
                b.write(endpointBytes);
                b.writeByte('}');
            }
            if (i < binaryAnnotationCount)
                b.writeByte(',');
        }
        b.writeByte(']');
    }
    if (Boolean.TRUE.equals(value.debug())) {
        b.writeAscii(",\"debug\":true");
    }
    b.writeByte('}');
}
Also used : Endpoint(zipkin2.Endpoint) V1BinaryAnnotation(zipkin2.v1.V1BinaryAnnotation) Endpoint(zipkin2.Endpoint) V1Annotation(zipkin2.v1.V1Annotation)

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 HashMap (java.util.HashMap)8 Annotation (wavefront.report.Annotation)8 ServiceName (org.jboss.msc.service.ServiceName)7 RateSampler (com.wavefront.sdk.entities.tracing.sampling.RateSampler)6 SaslAuthenticationFactory (org.wildfly.security.auth.server.SaslAuthenticationFactory)6