use of io.opentelemetry.context.propagation.ContextPropagators in project opentelemetry-java-instrumentation by open-telemetry.
the class PropagatorBasedSpanLinksExtractorTest method shouldExtractSpanLink.
@Test
void shouldExtractSpanLink() {
// given
ContextPropagators propagators = ContextPropagators.create(W3CTraceContextPropagator.getInstance());
SpanLinksExtractor<Map<String, String>> underTest = SpanLinksExtractor.fromUpstreamRequest(propagators, new MapGetter());
Map<String, String> request = singletonMap("traceparent", String.format("00-%s-%s-01", TRACE_ID, SPAN_ID));
// when
underTest.extract(spanLinks, Context.root(), request);
// then
verify(spanLinks).addLink(SpanContext.createFromRemoteParent(TRACE_ID, SPAN_ID, TraceFlags.getSampled(), TraceState.getDefault()));
}
Aggregations