Search in sources :

Example 56 with SpanContext

use of io.opentelemetry.api.trace.SpanContext in project splunk-otel-java by signalfx.

the class SpanContextualizer method updateContext.

/**
 * This updates the tracked thread context for a given span. This must only be called with
 * ContextAttached events.
 */
public void updateContext(RecordedEvent event) {
    String traceId = event.getString("traceId");
    String spanId = event.getString("spanId");
    long javaThreadId = event.getThread().getJavaThreadId();
    logger.debug("Set thread context: [{}] {} {} at {}", javaThreadId, traceId, spanId, event.getStartTime());
    if (traceId == null || spanId == null) {
        threadSpans.remove(javaThreadId);
    } else {
        TraceFlags traceFlags = TraceFlags.fromByte(event.getByte("traceFlags"));
        SpanContext spanContext = SpanContext.create(traceId, spanId, traceFlags, TraceState.getDefault());
        SpanLinkage linkage = new SpanLinkage(spanContext, javaThreadId);
        threadSpans.put(javaThreadId, linkage);
    }
}
Also used : TraceFlags(io.opentelemetry.api.trace.TraceFlags) SpanContext(io.opentelemetry.api.trace.SpanContext)

Example 57 with SpanContext

use of io.opentelemetry.api.trace.SpanContext in project smallrye-reactive-messaging by smallrye.

the class BatchTracingPropagationTest method createTracingSpan.

private Iterable<Header> createTracingSpan(List<SpanContext> spanContexts, String topic) {
    RecordHeaders proposedHeaders = new RecordHeaders();
    final Span span = KafkaConnector.TRACER.spanBuilder(topic).setSpanKind(SpanKind.PRODUCER).startSpan();
    final Context context = span.storeInContext(Context.current());
    GlobalOpenTelemetry.getPropagators().getTextMapPropagator().inject(context, proposedHeaders, (headers, key, value) -> {
        if (headers != null) {
            headers.remove(key).add(key, value.getBytes(StandardCharsets.UTF_8));
        }
    });
    spanContexts.add(span.getSpanContext());
    return proposedHeaders;
}
Also used : Context(io.opentelemetry.context.Context) SpanContext(io.opentelemetry.api.trace.SpanContext) RecordHeaders(org.apache.kafka.common.header.internals.RecordHeaders) Span(io.opentelemetry.api.trace.Span)

Example 58 with SpanContext

use of io.opentelemetry.api.trace.SpanContext in project smallrye-reactive-messaging by smallrye.

the class BatchTracingPropagationTest method testFromKafkaToAppWithParentSpan.

@Test
public void testFromKafkaToAppWithParentSpan() {
    String parentTopic = topic + "-parent";
    String stuffTopic = topic + "-stuff";
    MyAppReceivingData bean = runApplication(getKafkaSinkConfigForMyAppReceivingData(parentTopic), MyAppReceivingData.class);
    List<SpanContext> producedSpanContexts = new CopyOnWriteArrayList<>();
    companion.produceIntegers().usingGenerator(i -> new ProducerRecord<>(parentTopic, null, null, "a-key", i, createTracingSpan(producedSpanContexts, stuffTopic)), 10);
    await().until(() -> bean.list().size() >= 10);
    assertThat(bean.list()).containsExactly(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
    List<String> producedTraceIds = producedSpanContexts.stream().map(SpanContext::getTraceId).collect(Collectors.toList());
    assertThat(producedTraceIds).hasSize(10);
    assertThat(bean.tracing()).hasSizeGreaterThanOrEqualTo(10);
    assertThat(bean.tracing()).doesNotContainNull().doesNotHaveDuplicates();
    List<String> receivedTraceIds = bean.tracing().stream().map(tracingMetadata -> Span.fromContext(tracingMetadata.getCurrentContext()).getSpanContext().getTraceId()).collect(Collectors.toList());
    assertThat(receivedTraceIds).doesNotContainNull().doesNotHaveDuplicates().hasSize(10);
    assertThat(receivedTraceIds).containsExactlyInAnyOrderElementsOf(producedTraceIds);
    List<String> spanIds = new ArrayList<>();
    for (TracingMetadata tracing : bean.tracing()) {
        spanIds.add(Span.fromContext(tracing.getCurrentContext()).getSpanContext().getSpanId());
        assertThat(tracing.getPreviousContext()).isNotNull();
        Span previousSpan = Span.fromContextOrNull(tracing.getPreviousContext());
        assertThat(previousSpan).isNotNull();
        assertThat(previousSpan.getSpanContext().getTraceId()).isEqualTo(Span.fromContext(tracing.getCurrentContext()).getSpanContext().getTraceId());
        assertThat(previousSpan.getSpanContext().getSpanId()).isNotEqualTo(Span.fromContext(tracing.getCurrentContext()).getSpanContext().getSpanId());
    }
    assertThat(spanIds).doesNotContainNull().doesNotHaveDuplicates().hasSizeGreaterThanOrEqualTo(10);
    List<String> parentIds = bean.tracing().stream().map(tracingMetadata -> Span.fromContextOrNull(tracingMetadata.getPreviousContext()).getSpanContext().getSpanId()).collect(Collectors.toList());
    assertThat(producedSpanContexts.stream().map(SpanContext::getSpanId)).containsExactlyElementsOf(parentIds);
    for (SpanData data : testExporter.getFinishedSpanItems()) {
        assertThat(data.getSpanId()).isIn(spanIds);
        assertThat(data.getSpanId()).isNotEqualTo(data.getParentSpanId());
        assertThat(data.getKind()).isEqualByComparingTo(SpanKind.CONSUMER);
        assertThat(data.getParentSpanId()).isNotNull();
        assertThat(data.getParentSpanId()).isIn(parentIds);
    }
}
Also used : Sampler(io.opentelemetry.sdk.trace.samplers.Sampler) BeforeEach(org.junit.jupiter.api.BeforeEach) ProducerRecord(org.apache.kafka.clients.producer.ProducerRecord) Outgoing(org.eclipse.microprofile.reactive.messaging.Outgoing) KafkaCompanionTestBase(io.smallrye.reactive.messaging.kafka.base.KafkaCompanionTestBase) W3CTraceContextPropagator(io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator) OpenTelemetrySdk(io.opentelemetry.sdk.OpenTelemetrySdk) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Multi(io.smallrye.mutiny.Multi) ArrayList(java.util.ArrayList) AfterAll(org.junit.jupiter.api.AfterAll) RecordHeaders(org.apache.kafka.common.header.internals.RecordHeaders) ConsumerTask(io.smallrye.reactive.messaging.kafka.companion.ConsumerTask) StringDeserializer(org.apache.kafka.common.serialization.StringDeserializer) SimpleSpanProcessor(io.opentelemetry.sdk.trace.export.SimpleSpanProcessor) ContextPropagators(io.opentelemetry.context.propagation.ContextPropagators) Duration(java.time.Duration) IntegerSerializer(org.apache.kafka.common.serialization.IntegerSerializer) KafkaConnector(io.smallrye.reactive.messaging.kafka.KafkaConnector) Context(io.opentelemetry.context.Context) Awaitility.await(org.awaitility.Awaitility.await) Span(io.opentelemetry.api.trace.Span) SpanContext(io.opentelemetry.api.trace.SpanContext) Publisher(org.reactivestreams.Publisher) TracingMetadata(io.smallrye.reactive.messaging.TracingMetadata) RecordQualifiers.until(io.smallrye.reactive.messaging.kafka.companion.RecordQualifiers.until) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig) Collectors(java.util.stream.Collectors) SpanKind(io.opentelemetry.api.trace.SpanKind) StandardCharsets(java.nio.charset.StandardCharsets) SdkTracerProvider(io.opentelemetry.sdk.trace.SdkTracerProvider) GlobalOpenTelemetry(io.opentelemetry.api.GlobalOpenTelemetry) Test(org.junit.jupiter.api.Test) List(java.util.List) AfterEach(org.junit.jupiter.api.AfterEach) CompletionStage(java.util.concurrent.CompletionStage) InMemorySpanExporter(io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter) KafkaRecord(io.smallrye.reactive.messaging.kafka.KafkaRecord) Header(org.apache.kafka.common.header.Header) KafkaRecordBatch(io.smallrye.reactive.messaging.kafka.KafkaRecordBatch) IntegerDeserializer(org.apache.kafka.common.serialization.IntegerDeserializer) ApplicationScoped(javax.enterprise.context.ApplicationScoped) SpanData(io.opentelemetry.sdk.trace.data.SpanData) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Incoming(org.eclipse.microprofile.reactive.messaging.Incoming) SpanProcessor(io.opentelemetry.sdk.trace.SpanProcessor) SpanContext(io.opentelemetry.api.trace.SpanContext) SpanData(io.opentelemetry.sdk.trace.data.SpanData) TracingMetadata(io.smallrye.reactive.messaging.TracingMetadata) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Span(io.opentelemetry.api.trace.Span) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Test(org.junit.jupiter.api.Test)

Example 59 with SpanContext

use of io.opentelemetry.api.trace.SpanContext in project smallrye-reactive-messaging by smallrye.

the class TracingPropagationTest method testFromKafkaToAppToKafka.

@Test
public void testFromKafkaToAppToKafka() {
    List<Context> receivedContexts = new CopyOnWriteArrayList<>();
    String resultTopic = topic + "-result";
    String parentTopic = topic + "-parent";
    ConsumerTask<String, Integer> consumed = companion.consumeIntegers().fromTopics(resultTopic, m -> m.plug(until(10L, Duration.ofMinutes(1), null)).onItem().invoke(record -> {
        receivedContexts.add(GlobalOpenTelemetry.getPropagators().getTextMapPropagator().extract(Context.current(), record.headers(), new HeaderExtractAdapter()));
    }));
    MyAppProcessingData bean = runApplication(getKafkaSinkConfigForMyAppProcessingData(resultTopic, parentTopic), MyAppProcessingData.class);
    List<SpanContext> producedSpanContexts = new CopyOnWriteArrayList<>();
    companion.produceIntegers().usingGenerator(i -> new ProducerRecord<>(parentTopic, null, null, "a-key", i, createTracingSpan(producedSpanContexts, parentTopic)), 10);
    await().until(() -> consumed.getRecords().size() >= 10);
    List<Integer> values = new ArrayList<>();
    assertThat(consumed.getRecords()).allSatisfy(record -> {
        assertThat(record.value()).isNotNull();
        values.add(record.value());
    });
    assertThat(values).containsExactly(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    List<String> producedTraceIds = producedSpanContexts.stream().map(SpanContext::getTraceId).collect(Collectors.toList());
    assertThat(producedTraceIds).hasSize(10);
    assertThat(receivedContexts).hasSize(10);
    assertThat(receivedContexts).doesNotContainNull().doesNotHaveDuplicates();
    List<String> receivedSpanIds = receivedContexts.stream().map(context -> Span.fromContextOrNull(context).getSpanContext().getSpanId()).collect(Collectors.toList());
    assertThat(receivedSpanIds).doesNotContainNull().doesNotHaveDuplicates().hasSize(10);
    List<String> receivedTraceIds = receivedContexts.stream().map(context -> Span.fromContextOrNull(context).getSpanContext().getTraceId()).collect(Collectors.toList());
    assertThat(receivedTraceIds).doesNotContainNull().doesNotHaveDuplicates().hasSize(10);
    assertThat(receivedTraceIds).containsExactlyInAnyOrderElementsOf(producedTraceIds);
    assertThat(bean.tracing()).hasSizeGreaterThanOrEqualTo(10);
    assertThat(bean.tracing()).doesNotContainNull().doesNotHaveDuplicates();
    List<String> spanIds = new ArrayList<>();
    for (TracingMetadata tracing : bean.tracing()) {
        Span span = Span.fromContext(tracing.getCurrentContext());
        spanIds.add(span.getSpanContext().getSpanId());
        assertThat(Span.fromContextOrNull(tracing.getPreviousContext())).isNotNull();
    }
    await().atMost(Duration.ofMinutes(2)).until(() -> testExporter.getFinishedSpanItems().size() >= 10);
    List<String> outgoingParentIds = new ArrayList<>();
    List<String> incomingParentIds = new ArrayList<>();
    for (SpanData data : testExporter.getFinishedSpanItems()) {
        if (data.getKind().equals(SpanKind.CONSUMER)) {
            incomingParentIds.add(data.getParentSpanId());
            assertThat(data.getAttributes().get(SemanticAttributes.MESSAGING_KAFKA_CONSUMER_GROUP)).isNotNull();
            assertThat(data.getAttributes().get(AttributeKey.stringKey("messaging.consumer_id"))).isNotNull();
            // Need to skip the spans created during @Incoming processing
            continue;
        }
        assertThat(data.getSpanId()).isIn(receivedSpanIds);
        assertThat(data.getSpanId()).isNotEqualTo(data.getParentSpanId());
        assertThat(data.getTraceId()).isIn(producedTraceIds);
        assertThat(data.getKind()).isEqualByComparingTo(SpanKind.PRODUCER);
        outgoingParentIds.add(data.getParentSpanId());
    }
    // Assert span created on Kafka record is the parent of consumer span we create
    assertThat(producedSpanContexts.stream().map(SpanContext::getSpanId)).containsExactlyElementsOf(incomingParentIds);
    // Assert consumer span is the parent of the producer span we received in Kafka
    assertThat(spanIds.stream()).containsExactlyElementsOf(outgoingParentIds);
}
Also used : Context(io.opentelemetry.context.Context) SpanContext(io.opentelemetry.api.trace.SpanContext) Sampler(io.opentelemetry.sdk.trace.samplers.Sampler) BeforeEach(org.junit.jupiter.api.BeforeEach) ProducerRecord(org.apache.kafka.clients.producer.ProducerRecord) Outgoing(org.eclipse.microprofile.reactive.messaging.Outgoing) KafkaCompanionTestBase(io.smallrye.reactive.messaging.kafka.base.KafkaCompanionTestBase) W3CTraceContextPropagator(io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator) OpenTelemetrySdk(io.opentelemetry.sdk.OpenTelemetrySdk) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SemanticAttributes(io.opentelemetry.semconv.trace.attributes.SemanticAttributes) Multi(io.smallrye.mutiny.Multi) MapBasedConfig(io.smallrye.reactive.messaging.test.common.config.MapBasedConfig) ArrayList(java.util.ArrayList) AfterAll(org.junit.jupiter.api.AfterAll) RecordHeaders(org.apache.kafka.common.header.internals.RecordHeaders) ConsumerTask(io.smallrye.reactive.messaging.kafka.companion.ConsumerTask) StringDeserializer(org.apache.kafka.common.serialization.StringDeserializer) SimpleSpanProcessor(io.opentelemetry.sdk.trace.export.SimpleSpanProcessor) ContextPropagators(io.opentelemetry.context.propagation.ContextPropagators) Duration(java.time.Duration) IntegerSerializer(org.apache.kafka.common.serialization.IntegerSerializer) KafkaConnector(io.smallrye.reactive.messaging.kafka.KafkaConnector) Context(io.opentelemetry.context.Context) Awaitility.await(org.awaitility.Awaitility.await) Span(io.opentelemetry.api.trace.Span) SpanContext(io.opentelemetry.api.trace.SpanContext) Publisher(org.reactivestreams.Publisher) TracingMetadata(io.smallrye.reactive.messaging.TracingMetadata) RecordQualifiers.until(io.smallrye.reactive.messaging.kafka.companion.RecordQualifiers.until) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig) Collectors(java.util.stream.Collectors) SpanKind(io.opentelemetry.api.trace.SpanKind) StandardCharsets(java.nio.charset.StandardCharsets) SdkTracerProvider(io.opentelemetry.sdk.trace.SdkTracerProvider) GlobalOpenTelemetry(io.opentelemetry.api.GlobalOpenTelemetry) Test(org.junit.jupiter.api.Test) List(java.util.List) Message(org.eclipse.microprofile.reactive.messaging.Message) AfterEach(org.junit.jupiter.api.AfterEach) CompletionStage(java.util.concurrent.CompletionStage) InMemorySpanExporter(io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter) Header(org.apache.kafka.common.header.Header) AttributeKey(io.opentelemetry.api.common.AttributeKey) IntegerDeserializer(org.apache.kafka.common.serialization.IntegerDeserializer) ApplicationScoped(javax.enterprise.context.ApplicationScoped) SpanData(io.opentelemetry.sdk.trace.data.SpanData) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Incoming(org.eclipse.microprofile.reactive.messaging.Incoming) SpanProcessor(io.opentelemetry.sdk.trace.SpanProcessor) SpanContext(io.opentelemetry.api.trace.SpanContext) SpanData(io.opentelemetry.sdk.trace.data.SpanData) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Span(io.opentelemetry.api.trace.Span) TracingMetadata(io.smallrye.reactive.messaging.TracingMetadata) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Test(org.junit.jupiter.api.Test)

Example 60 with SpanContext

use of io.opentelemetry.api.trace.SpanContext in project smallrye-reactive-messaging by smallrye.

the class TracingPropagationTest method testFromKafkaToAppWithParentSpan.

@Test
public void testFromKafkaToAppWithParentSpan() {
    String parentTopic = topic + "-parent";
    String stuffTopic = topic + "-stuff";
    MyAppReceivingData bean = runApplication(getKafkaSinkConfigForMyAppReceivingData(parentTopic), MyAppReceivingData.class);
    List<SpanContext> producedSpanContexts = new CopyOnWriteArrayList<>();
    companion.produceIntegers().usingGenerator(i -> new ProducerRecord<>(parentTopic, null, null, "a-key", i, createTracingSpan(producedSpanContexts, stuffTopic)), 10);
    await().until(() -> bean.list().size() >= 10);
    assertThat(bean.list()).containsExactly(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
    List<String> producedTraceIds = producedSpanContexts.stream().map(SpanContext::getTraceId).collect(Collectors.toList());
    assertThat(producedTraceIds).hasSize(10);
    assertThat(bean.tracing()).hasSizeGreaterThanOrEqualTo(10);
    assertThat(bean.tracing()).doesNotContainNull().doesNotHaveDuplicates();
    List<String> receivedTraceIds = bean.tracing().stream().map(tracingMetadata -> Span.fromContext(tracingMetadata.getCurrentContext()).getSpanContext().getTraceId()).collect(Collectors.toList());
    assertThat(receivedTraceIds).doesNotContainNull().doesNotHaveDuplicates().hasSize(10);
    assertThat(receivedTraceIds).containsExactlyInAnyOrderElementsOf(producedTraceIds);
    List<String> spanIds = new ArrayList<>();
    for (TracingMetadata tracing : bean.tracing()) {
        spanIds.add(Span.fromContext(tracing.getCurrentContext()).getSpanContext().getSpanId());
        assertThat(tracing.getPreviousContext()).isNotNull();
        Span previousSpan = Span.fromContextOrNull(tracing.getPreviousContext());
        assertThat(previousSpan).isNotNull();
        assertThat(previousSpan.getSpanContext().getTraceId()).isEqualTo(Span.fromContext(tracing.getCurrentContext()).getSpanContext().getTraceId());
        assertThat(previousSpan.getSpanContext().getSpanId()).isNotEqualTo(Span.fromContext(tracing.getCurrentContext()).getSpanContext().getSpanId());
    }
    assertThat(spanIds).doesNotContainNull().doesNotHaveDuplicates().hasSizeGreaterThanOrEqualTo(10);
    List<String> parentIds = bean.tracing().stream().map(tracingMetadata -> Span.fromContextOrNull(tracingMetadata.getPreviousContext()).getSpanContext().getSpanId()).collect(Collectors.toList());
    assertThat(producedSpanContexts.stream().map(SpanContext::getSpanId)).containsExactlyElementsOf(parentIds);
    for (SpanData data : testExporter.getFinishedSpanItems()) {
        assertThat(data.getSpanId()).isIn(spanIds);
        assertThat(data.getSpanId()).isNotEqualTo(data.getParentSpanId());
        assertThat(data.getKind()).isEqualByComparingTo(SpanKind.CONSUMER);
        assertThat(data.getParentSpanId()).isNotNull();
        assertThat(data.getParentSpanId()).isIn(parentIds);
    }
}
Also used : Sampler(io.opentelemetry.sdk.trace.samplers.Sampler) BeforeEach(org.junit.jupiter.api.BeforeEach) ProducerRecord(org.apache.kafka.clients.producer.ProducerRecord) Outgoing(org.eclipse.microprofile.reactive.messaging.Outgoing) KafkaCompanionTestBase(io.smallrye.reactive.messaging.kafka.base.KafkaCompanionTestBase) W3CTraceContextPropagator(io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator) OpenTelemetrySdk(io.opentelemetry.sdk.OpenTelemetrySdk) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SemanticAttributes(io.opentelemetry.semconv.trace.attributes.SemanticAttributes) Multi(io.smallrye.mutiny.Multi) MapBasedConfig(io.smallrye.reactive.messaging.test.common.config.MapBasedConfig) ArrayList(java.util.ArrayList) AfterAll(org.junit.jupiter.api.AfterAll) RecordHeaders(org.apache.kafka.common.header.internals.RecordHeaders) ConsumerTask(io.smallrye.reactive.messaging.kafka.companion.ConsumerTask) StringDeserializer(org.apache.kafka.common.serialization.StringDeserializer) SimpleSpanProcessor(io.opentelemetry.sdk.trace.export.SimpleSpanProcessor) ContextPropagators(io.opentelemetry.context.propagation.ContextPropagators) Duration(java.time.Duration) IntegerSerializer(org.apache.kafka.common.serialization.IntegerSerializer) KafkaConnector(io.smallrye.reactive.messaging.kafka.KafkaConnector) Context(io.opentelemetry.context.Context) Awaitility.await(org.awaitility.Awaitility.await) Span(io.opentelemetry.api.trace.Span) SpanContext(io.opentelemetry.api.trace.SpanContext) Publisher(org.reactivestreams.Publisher) TracingMetadata(io.smallrye.reactive.messaging.TracingMetadata) RecordQualifiers.until(io.smallrye.reactive.messaging.kafka.companion.RecordQualifiers.until) KafkaMapBasedConfig(io.smallrye.reactive.messaging.kafka.base.KafkaMapBasedConfig) Collectors(java.util.stream.Collectors) SpanKind(io.opentelemetry.api.trace.SpanKind) StandardCharsets(java.nio.charset.StandardCharsets) SdkTracerProvider(io.opentelemetry.sdk.trace.SdkTracerProvider) GlobalOpenTelemetry(io.opentelemetry.api.GlobalOpenTelemetry) Test(org.junit.jupiter.api.Test) List(java.util.List) Message(org.eclipse.microprofile.reactive.messaging.Message) AfterEach(org.junit.jupiter.api.AfterEach) CompletionStage(java.util.concurrent.CompletionStage) InMemorySpanExporter(io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter) Header(org.apache.kafka.common.header.Header) AttributeKey(io.opentelemetry.api.common.AttributeKey) IntegerDeserializer(org.apache.kafka.common.serialization.IntegerDeserializer) ApplicationScoped(javax.enterprise.context.ApplicationScoped) SpanData(io.opentelemetry.sdk.trace.data.SpanData) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Incoming(org.eclipse.microprofile.reactive.messaging.Incoming) SpanProcessor(io.opentelemetry.sdk.trace.SpanProcessor) SpanContext(io.opentelemetry.api.trace.SpanContext) SpanData(io.opentelemetry.sdk.trace.data.SpanData) TracingMetadata(io.smallrye.reactive.messaging.TracingMetadata) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Span(io.opentelemetry.api.trace.Span) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Test(org.junit.jupiter.api.Test)

Aggregations

SpanContext (io.opentelemetry.api.trace.SpanContext)62 Test (org.junit.jupiter.api.Test)33 Span (io.opentelemetry.api.trace.Span)31 Context (io.opentelemetry.context.Context)31 SpanKind (io.opentelemetry.api.trace.SpanKind)13 TraceState (io.opentelemetry.api.trace.TraceState)12 W3CTraceContextPropagator (io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator)12 Collectors (java.util.stream.Collectors)12 Attributes (io.opentelemetry.api.common.Attributes)11 TraceFlags (io.opentelemetry.api.trace.TraceFlags)10 SemanticAttributes (io.opentelemetry.semconv.trace.attributes.SemanticAttributes)10 Instant (java.time.Instant)10 SpanId (io.opentelemetry.api.trace.SpanId)9 TraceId (io.opentelemetry.api.trace.TraceId)9 LinkData (io.opentelemetry.sdk.trace.data.LinkData)9 Mockito.when (org.mockito.Mockito.when)9 AttributesBuilder (io.opentelemetry.api.common.AttributesBuilder)8 ContextKey (io.opentelemetry.context.ContextKey)7 TextMapGetter (io.opentelemetry.context.propagation.TextMapGetter)7 InstrumentationVersion (io.opentelemetry.instrumentation.api.InstrumentationVersion)7