[
https://issues.apache.org/jira/browse/CAMEL-18661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17649455#comment-17649455
]
Babak Vahdat commented on CAMEL-18661:
--------------------------------------
Hi [~Molkova]
As per conversation
[here|https://github.com/apache/camel/pull/8911#issuecomment-1355233167] just
to let you know that the flaky test has popped up on Jenkins build as well:
https://ci-builds.apache.org/job/Camel/job/Camel%20JDK11%20Build%20(S390x)/job/main/409/testReport/junit/org.apache.camel.opentelemetry/CurrentSpanTest/testContextDoesNotLeak/
{code}
org.apache.camel.CamelExecutionException: Exception occurred during execution
on the exchange: Exchange[1E6AD74DFFAFE6E-000000000000000A]
at
org.apache.camel.CamelExecutionException.wrapCamelExecutionException(CamelExecutionException.java:45)
at
org.apache.camel.support.AbstractExchange.setException(AbstractExchange.java:597)
at
org.apache.camel.support.DefaultExchange.setException(DefaultExchange.java:27)
at
org.apache.camel.processor.MulticastProcessor$MulticastTask.aggregate(MulticastProcessor.java:445)
at
org.apache.camel.processor.MulticastProcessor$MulticastReactiveTask.lambda$run$0(MulticastProcessor.java:570)
at org.apache.camel.AsyncCallback.run(AsyncCallback.java:44)
at
org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:181)
at
org.apache.camel.impl.engine.DefaultReactiveExecutor.schedule(DefaultReactiveExecutor.java:54)
at
org.apache.camel.processor.MulticastProcessor.lambda$schedule$1(MulticastProcessor.java:336)
at
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.opentest4j.AssertionFailedError: expected: <false> but was:
<true>
at
org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
at
org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
at org.junit.jupiter.api.AssertFalse.failNotFalse(AssertFalse.java:63)
at org.junit.jupiter.api.AssertFalse.assertFalse(AssertFalse.java:36)
at org.junit.jupiter.api.AssertFalse.assertFalse(AssertFalse.java:31)
at org.junit.jupiter.api.Assertions.assertFalse(Assertions.java:228)
at
org.apache.camel.opentelemetry.CurrentSpanTest$1.lambda$configure$0(CurrentSpanTest.java:221)
at
org.apache.camel.AggregationStrategy.aggregate(AggregationStrategy.java:86)
at
org.apache.camel.processor.MulticastProcessor.doAggregateInternal(MulticastProcessor.java:882)
at
org.apache.camel.processor.MulticastProcessor.doAggregateSync(MulticastProcessor.java:863)
at
org.apache.camel.processor.MulticastProcessor.doAggregate(MulticastProcessor.java:848)
at
org.apache.camel.processor.MulticastProcessor$MulticastTask.aggregate(MulticastProcessor.java:439)
... 10 more
{code}
> Camel OpenTelemtery instrumentation does not make spans current
> ----------------------------------------------------------------
>
> Key: CAMEL-18661
> URL: https://issues.apache.org/jira/browse/CAMEL-18661
> Project: Camel
> Issue Type: Bug
> Components: camel-opentelemetry
> Affects Versions: 3.19.0
> Environment: any, functional issue
> Reporter: Liudmila
> Priority: Minor
> Fix For: 3.20.0
>
> Attachments: camel_and_service_bus.png
>
>
> I have the following application:
>
> {code:java}
> @Component
> public class SourceRoute extends EndpointRouteBuilder {
> private static final String cs = "...";
> @Override
> public void configure() {
> from(timer("tick").period(1000).repeatCount(1))
> .log("Timer triggered")
> .setBody(simple("hello"))
> .to(azureServicebus("testme").
> serviceBusType("topic").
> connectionString(cs));
> }
> } {code}
>
> And I run it with [OpenTelemtery Java
> agent|https://github.com/open-telemetry/opentelemetry-java-instrumentation/].
> Camel creates "tick" and "testme" spans.
> ServiceBus SDK is instrumented too and it creates it's own spans.
> h2. Actual behavior:
> Spans created by ServiceBus SDK are unrelated to Camel spans. I.e. ServiceBus
> spans and Camel spans are in different traces (check out the attached
> screenshot).
> h2. Expected behavior:
> Camel "testme" span is a parent of ServiceBus spans:
> * tick
> ** testme
> *** ServiceBus.message
> *** ServiceBus.send
> h2. Investigation
> If I look into the OTel instrumentation code (and debug my application). I
> can see that OTel span starts here
> https://github.com/apache/camel/blob/1175c2666821457dcb6cf0921f4076508459341a/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryTracer.java#L92
> and then is 'activated' here
> https://github.com/apache/camel/blob/main/components/camel-tracing/src/main/java/org/apache/camel/tracing/Tracer.java#L248
> But the activation code only puts trace_id and span_id on MDC.
> The proposal for Camel is to make OpenTelemtery span active (using
> Span.makeCurrent()).
> This is the only way underlying traces can be correlated to Camel spans.
> {code:java}
> try (Scope s = span.makeCurrent()) {
> // wrap processing, but always clean up the scope to avoid leaks
> } {code}
> OTel instrumentation will take care of propagating this context anywhere else.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)