Search in sources :

Example 1 with SqsEndpoint

use of org.apache.camel.component.aws.sqs.SqsEndpoint in project opentelemetry-java-instrumentation by open-telemetry.

the class CamelPropagationUtilTest method shouldNotFailExtractingNullAwsParentForSqsEndpoint.

@Test
public void shouldNotFailExtractingNullAwsParentForSqsEndpoint() {
    // given
    Endpoint endpoint = new SqsEndpoint("", new SqsComponent(), new SqsConfiguration());
    Map<String, Object> exchangeHeaders = Collections.singletonMap("AWSTraceHeader", null);
    // when
    Context parent = CamelPropagationUtil.extractParent(exchangeHeaders, endpoint);
    // then
    Span parentSpan = Span.fromContext(parent);
    SpanContext parentSpanContext = parentSpan.getSpanContext();
    assertThat(parentSpanContext.isValid()).isEqualTo(false);
}
Also used : Context(io.opentelemetry.context.Context) SpanContext(io.opentelemetry.api.trace.SpanContext) SqsComponent(org.apache.camel.component.aws.sqs.SqsComponent) SpanContext(io.opentelemetry.api.trace.SpanContext) HttpEndpoint(org.apache.camel.component.http.HttpEndpoint) SqsEndpoint(org.apache.camel.component.aws.sqs.SqsEndpoint) Endpoint(org.apache.camel.Endpoint) SqsConfiguration(org.apache.camel.component.aws.sqs.SqsConfiguration) SqsEndpoint(org.apache.camel.component.aws.sqs.SqsEndpoint) Span(io.opentelemetry.api.trace.Span) Test(org.junit.jupiter.api.Test)

Example 2 with SqsEndpoint

use of org.apache.camel.component.aws.sqs.SqsEndpoint in project opentelemetry-java-instrumentation by open-telemetry.

the class CamelPropagationUtilTest method shouldExtractAwsParentForSqsEndpoint.

@Test
public void shouldExtractAwsParentForSqsEndpoint() {
    // given
    Endpoint endpoint = new SqsEndpoint("", new SqsComponent(), new SqsConfiguration());
    Map<String, Object> exchangeHeaders = Collections.singletonMap("AWSTraceHeader", "Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8;Sampled=1\n");
    // when
    Context parent = CamelPropagationUtil.extractParent(exchangeHeaders, endpoint);
    // then
    Span parentSpan = Span.fromContext(parent);
    SpanContext parentSpanContext = parentSpan.getSpanContext();
    assertThat(parentSpanContext.getTraceId()).isEqualTo("5759e988bd862e3fe1be46a994272793");
    assertThat(parentSpanContext.getSpanId()).isEqualTo("53995c3f42cd8ad8");
}
Also used : Context(io.opentelemetry.context.Context) SpanContext(io.opentelemetry.api.trace.SpanContext) SqsComponent(org.apache.camel.component.aws.sqs.SqsComponent) SpanContext(io.opentelemetry.api.trace.SpanContext) HttpEndpoint(org.apache.camel.component.http.HttpEndpoint) SqsEndpoint(org.apache.camel.component.aws.sqs.SqsEndpoint) Endpoint(org.apache.camel.Endpoint) SqsConfiguration(org.apache.camel.component.aws.sqs.SqsConfiguration) SqsEndpoint(org.apache.camel.component.aws.sqs.SqsEndpoint) Span(io.opentelemetry.api.trace.Span) Test(org.junit.jupiter.api.Test)

Aggregations

Span (io.opentelemetry.api.trace.Span)2 SpanContext (io.opentelemetry.api.trace.SpanContext)2 Context (io.opentelemetry.context.Context)2 Endpoint (org.apache.camel.Endpoint)2 SqsComponent (org.apache.camel.component.aws.sqs.SqsComponent)2 SqsConfiguration (org.apache.camel.component.aws.sqs.SqsConfiguration)2 SqsEndpoint (org.apache.camel.component.aws.sqs.SqsEndpoint)2 HttpEndpoint (org.apache.camel.component.http.HttpEndpoint)2 Test (org.junit.jupiter.api.Test)2