use of io.jaegertracing.crossdock.api.ObservedSpan in project jaeger-client-java by jaegertracing.
the class TraceBehavior method observeSpan.
private ObservedSpan observeSpan() {
JaegerSpan span = (JaegerSpan) tracer.activeSpan();
if (tracer.activeSpan() == null) {
log.error("No span found");
return new ObservedSpan("no span found", false, "no span found");
}
JaegerSpanContext context = span.context();
String traceId = context.getTraceId();
boolean sampled = context.isSampled();
String baggage = span.getBaggageItem(Constants.BAGGAGE_KEY);
return new ObservedSpan(traceId, sampled, baggage);
}
use of io.jaegertracing.crossdock.api.ObservedSpan in project jaeger-client-java by jaegertracing.
the class TraceBehaviorResourceTest method validateTraceResponse.
private void validateTraceResponse(TraceResponse response, String expectedTraceId, String expectedBaggage, int expectedDownstream) {
ObservedSpan span = response.getSpan();
assertEquals(expectedTraceId, span.getTraceId());
assertEquals(expectedBaggage, span.getBaggage());
assertEquals(expectedSampled, span.isSampled());
TraceResponse downstream = response.getDownstream();
if (expectedDownstream > 0) {
assertNotNull(downstream);
validateTraceResponse(downstream, expectedTraceId, expectedBaggage, expectedDownstream - 1);
} else {
assertNull(downstream);
}
}
Aggregations