private static Iterable<? extends ZipkinCompatAnnotation> spanTypeToZipkinAnnotations( Span span, ZipkinCompatEndpoint endpoint) { List<ZipkinCompatAnnotation> annotations = Lists.newArrayListWithCapacity(2); switch (span.type()) { case CLIENT_OUTGOING: annotations.add(ZipkinCompatAnnotation.of(span.getStartTimeMicroSeconds(), "cs", endpoint)); annotations.add(ZipkinCompatAnnotation.of( span.getStartTimeMicroSeconds() + nanoToMicro(span.getDurationNanoSeconds()), "cr", endpoint)); break; case SERVER_INCOMING: annotations.add(ZipkinCompatAnnotation.of(span.getStartTimeMicroSeconds(), "sr", endpoint)); annotations.add(ZipkinCompatAnnotation.of( span.getStartTimeMicroSeconds() + nanoToMicro(span.getDurationNanoSeconds()), "ss", endpoint)); break; case LOCAL: annotations.add(ZipkinCompatAnnotation.of(span.getStartTimeMicroSeconds(), "lc", endpoint)); break; default: throw new RuntimeException("Unhandled SpanType: " + span.type()); } return annotations; }
private static Iterable<? extends ZipkinCompatAnnotation> spanTypeToZipkinAnnotations( Span span, ZipkinCompatEndpoint endpoint) { List<ZipkinCompatAnnotation> annotations = Lists.newArrayListWithCapacity(2); switch (span.type()) { case CLIENT_OUTGOING: annotations.add(ZipkinCompatAnnotation.of(span.getStartTimeMicroSeconds(), "cs", endpoint)); annotations.add(ZipkinCompatAnnotation.of( span.getStartTimeMicroSeconds() + nanoToMicro(span.getDurationNanoSeconds()), "cr", endpoint)); break; case SERVER_INCOMING: annotations.add(ZipkinCompatAnnotation.of(span.getStartTimeMicroSeconds(), "sr", endpoint)); annotations.add(ZipkinCompatAnnotation.of( span.getStartTimeMicroSeconds() + nanoToMicro(span.getDurationNanoSeconds()), "ss", endpoint)); break; case LOCAL: annotations.add(ZipkinCompatAnnotation.of(span.getStartTimeMicroSeconds(), "lc", endpoint)); break; default: throw new RuntimeException("Unhandled SpanType: " + span.type()); } return annotations; }