synchronized MutableSpan addBinaryAnnotation(String key, byte[] value, BinaryAnnotation.Type type) { binaryAnnotations.add(BinaryAnnotation.create(key, value, type, endpoint)); return this; }
synchronized MutableSpan setAddress(String key, InetSocketAddress ia) { binaryAnnotations.add(BinaryAnnotation.address(key, Endpoints.fromSocketAddress(ia))); return this; }
result.addBinaryAnnotation(BinaryAnnotation.create(tag.getKey(), tag.getValue(), local)); } else if (local != null && remote != null) { result.addBinaryAnnotation(BinaryAnnotation.address("ca", local)); wroteEndpoint = true; remoteEndpointType = "sa"; result.addBinaryAnnotation(BinaryAnnotation.address(remoteEndpointType, remote)); result.addBinaryAnnotation(BinaryAnnotation.create("lc", "", local));
@Override @Nullable public BinaryAnnotation fromJson(JsonReader reader) throws IOException { BinaryAnnotation.Builder result = BinaryAnnotation.builder(); String number = null; String string = null;
synchronized Span toSpan() { // fill in the host/service data for all the annotations for (Annotation ann : annotations) { Endpoint ep = Endpoints.boundEndpoint(ann.endpoint); span.addAnnotation( ann.toBuilder().endpoint(ep.toBuilder().serviceName(service).build()).build()); } for (BinaryAnnotation ann : binaryAnnotations) { Endpoint ep = Endpoints.boundEndpoint(ann.endpoint); // TODO: service name for "ca" or "sa" is likely incorrect span.addBinaryAnnotation( ann.toBuilder().endpoint(ep.toBuilder().serviceName(service).build()).build()); } return span.build(); }
protected void addAllTagsToBuilderAsBinaryAnnotations( zipkin.Span.Builder builder, Map<String,String> tagsToAdd, Endpoint zipkinEndpoint ) { for (Map.Entry<String, String> tagEntry : tagsToAdd.entrySet()) { BinaryAnnotation tagAnnotation = BinaryAnnotation.create( tagEntry.getKey(), tagEntry.getValue(), zipkinEndpoint ); builder.addBinaryAnnotation(tagAnnotation); } }
protected void addAllTagsToBuilderAsBinaryAnnotations( zipkin.Span.Builder builder, Map<String,String> tagsToAdd, Endpoint zipkinEndpoint ) { for (Map.Entry<String, String> tagEntry : tagsToAdd.entrySet()) { BinaryAnnotation tagAnnotation = BinaryAnnotation.create( tagEntry.getKey(), tagEntry.getValue(), zipkinEndpoint ); builder.addBinaryAnnotation(tagAnnotation); } }
endpoint)); } else { span.addBinaryAnnotation(BinaryAnnotation.create( a.getValue(ZIPKIN_ANNOTATIONS.A_KEY), a.getValue(ZIPKIN_ANNOTATIONS.A_VALUE),
endpoint)); } else { span.addBinaryAnnotation(BinaryAnnotation.create( a.getValue(ZIPKIN_ANNOTATIONS.A_KEY), a.getValue(ZIPKIN_ANNOTATIONS.A_VALUE),
endpoint)); } else { span.addBinaryAnnotation(BinaryAnnotation.create( a.getValue(ZIPKIN_ANNOTATIONS.A_KEY), a.getValue(ZIPKIN_ANNOTATIONS.A_VALUE),
protected zipkin.Span.Builder createNewZipkinSpanBuilderWithSpanPurposeAnnotations( Span wingtipsSpan, long startEpochMicros, long durationMicros, Endpoint zipkinEndpoint, String localComponentNamespace ) { zipkin.Span.Builder zsb = zipkin.Span.builder(); switch(wingtipsSpan.getSpanPurpose()) { case SERVER: zsb.addAnnotation(Annotation.create(startEpochMicros, Constants.SERVER_RECV, zipkinEndpoint)) .addAnnotation(Annotation.create(startEpochMicros + durationMicros, Constants.SERVER_SEND, zipkinEndpoint)); break; case CLIENT: zsb.addAnnotation(Annotation.create(startEpochMicros, Constants.CLIENT_SEND, zipkinEndpoint)) .addAnnotation(Annotation.create(startEpochMicros + durationMicros, Constants.CLIENT_RECV, zipkinEndpoint)); break; case LOCAL_ONLY: case UNKNOWN: // intentional fall-through: local and unknown span purpose are treated the same way zsb.addBinaryAnnotation(BinaryAnnotation.create(Constants.LOCAL_COMPONENT, localComponentNamespace, zipkinEndpoint)); break; default: logger.warn("Unhandled SpanPurpose type: " + wingtipsSpan.getSpanPurpose().name()); } return zsb; }
protected zipkin.Span.Builder createNewZipkinSpanBuilderWithSpanPurposeAnnotations( Span wingtipsSpan, long startEpochMicros, long durationMicros, Endpoint zipkinEndpoint, String localComponentNamespace ) { zipkin.Span.Builder zsb = zipkin.Span.builder(); switch(wingtipsSpan.getSpanPurpose()) { case SERVER: zsb.addAnnotation(Annotation.create(startEpochMicros, Constants.SERVER_RECV, zipkinEndpoint)) .addAnnotation(Annotation.create(startEpochMicros + durationMicros, Constants.SERVER_SEND, zipkinEndpoint)); break; case CLIENT: zsb.addAnnotation(Annotation.create(startEpochMicros, Constants.CLIENT_SEND, zipkinEndpoint)) .addAnnotation(Annotation.create(startEpochMicros + durationMicros, Constants.CLIENT_RECV, zipkinEndpoint)); break; case LOCAL_ONLY: case UNKNOWN: // intentional fall-through: local and unknown span purpose are treated the same way zsb.addBinaryAnnotation(BinaryAnnotation.create(Constants.LOCAL_COMPONENT, localComponentNamespace, zipkinEndpoint)); break; default: logger.warn("Unhandled SpanPurpose type: " + wingtipsSpan.getSpanPurpose().name()); } return zsb; }
endpoint)); } else { span.addBinaryAnnotation(BinaryAnnotation.create( a.getValue(ZIPKIN_ANNOTATIONS.A_KEY), a.getValue(ZIPKIN_ANNOTATIONS.A_VALUE),
BinaryAnnotation.create(Constants.LOCAL_COMPONENT, localComponentNamespace, zipkinEndpoint) );