use of brave.propagation.TraceContextOrSamplingFlags in project brave by openzipkin.
the class TracerTest method nextSpan_extractedTraceId_extra.
@Test
public void nextSpan_extractedTraceId_extra() {
TraceIdContext traceIdContext = TraceIdContext.newBuilder().traceId(1L).build();
TraceContextOrSamplingFlags extracted = TraceContextOrSamplingFlags.create(traceIdContext).toBuilder().addExtra(1L).build();
assertThat(tracer.nextSpan(extracted).context().extra()).containsExactly(1L);
}
use of brave.propagation.TraceContextOrSamplingFlags in project brave by openzipkin.
the class BraveTracer method extract.
@Override
public <C> BraveSpanContext extract(Format<C> format, C carrier) {
if (format != Format.Builtin.HTTP_HEADERS) {
throw new UnsupportedOperationException(format.toString());
}
TraceContextOrSamplingFlags extracted = extractor.extract(new TextMapView(propagationKeys, (TextMap) carrier));
TraceContext context = extracted.context() != null ? tracer.joinSpan(extracted.context()).context() : tracer.nextSpan(extracted).context();
return new BraveSpanContext(context);
}
Aggregations