I think it can work if you pass the active span initiated by Camel to the
bean methods. For example:

public class Bean1 {
    @Traced
    public void methodA(Span span) {
        // Do something
    }
}

Then in the Camel route:

from("direct:start)
      .process(e -> {
            OpenTracingSpanAdapter adapter = (OpenTracingSpanAdapter)
ActiveSpanManager.getSpan(exchange);
            Span span = adapter.getOpenTracingSpan();
            bean1.methodA(span);
      });

That should be enough for the OpenTracing CDI interceptor to pick up the
propagated span and use it as the parent.

There's probably a more elegant way of achieving this and maybe we can do
some changes in Camel / Camel Quarkus to make it simpler in future, but I'd
have to research it more.

--
James

On Tue, 6 Jul 2021 at 13:59, Dennis Holunder <dennish...@gmail.com> wrote:

> Hello,
>
> I have some @ApplicationScoped and @Traced Beans which methods are
> called from the camel route (camel-quarkus). The traces are sent to
> jaeger, but they don't have a common parent span. How can I start a
> span for an exchange, so that all subsequent calls to the beans would
> have the same parent span?
>
> In the example I'd want to achieve the trace containing two spans
> (methodA, methodB)
>
> from("direct:start)
>     .split()
>       .process(start stracing)
>       .process(e -> bean1.methodA)
>       .process(e -> bean2.methodB)
>    .end()
>
>
>
> Thanks!
>

Reply via email to