@Nullable static io.zipkin.Span invert(Span input) { try { byte[] bytes = scalaCodec.writeValueAsBytes(input); return Codec.JSON.readSpan(bytes); } catch (JsonProcessingException e) { e.printStackTrace(); return null; } }
@Nullable static Span convert(io.zipkin.Span input) { byte[] bytes = Codec.JSON.writeSpan(input); try { return JsonSpan.invert(scalaCodec.readValue(bytes, JsonSpan.class)); } catch (IOException e) { e.printStackTrace(); return null; } }
protected Runnable allSpansWereRegisteredInZipkinWithTraceIdEqualTo(long traceId) { return () -> { ResponseEntity<String> response = checkStateOfTheTraceId(traceId); log.info( "Response from the Zipkin query service about the trace id [{}] for trace with id [{}]", response, traceId); then(response.getStatusCode()).isEqualTo(HttpStatus.OK); then(response.hasBody()).isTrue(); List<Span> spans = Codec.JSON.readSpans(response.getBody().getBytes()); List<String> serviceNamesNotFoundInZipkin = serviceNamesNotFoundInZipkin(spans); List<String> spanNamesNotFoundInZipkin = annotationsNotFoundInZipkin(spans); log.info("The following services were not found in Zipkin {}", serviceNamesNotFoundInZipkin); log.info("The following annotations were not found in Zipkin {}", spanNamesNotFoundInZipkin); then(serviceNamesNotFoundInZipkin).isEmpty(); then(spanNamesNotFoundInZipkin).isEmpty(); log.info("Zipkin tracing is working! Sleuth is working! Let's be happy!"); }; }