[jira] [Commented] (CAMEL-19469) camel-opentelemetry: Context not propagated correctly when tracing bean or processor invocations with @WithSpan

2024-03-22 Thread James Netherton (Jira)


[ 
https://issues.apache.org/jira/browse/CAMEL-19469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17829804#comment-17829804
 ] 

James Netherton commented on CAMEL-19469:
-

{quote}The OpenTelemetryTracingStrategy already creates a Span for 
Processors{quote}

True, but that wasn't the case when this issue was created. So this issue 
probably needs a retest / reassessment.

> camel-opentelemetry: Context not propagated correctly when tracing bean or 
> processor invocations with @WithSpan
> ---
>
> Key: CAMEL-19469
> URL: https://issues.apache.org/jira/browse/CAMEL-19469
> Project: Camel
>  Issue Type: Improvement
>  Components: camel-opentelemetry
>Affects Versions: 3.20.5, 4.0-M3
>Reporter: James Netherton
>Priority: Minor
>
> OpenTelemetry enables you to trace arbitrary method invocations by tagging 
> them with the @WithSpan annotation:
> https://opentelemetry.io/docs/instrumentation/java/automatic/annotations/#creating-spans-around-methods-with-withspan
> For some scenarios, the tracing context does not seem to get propagated and 
> the resulting spans end up being disassociated. For example:
> {code}
> from("timer:tick?period=5s)
> .process("myProcessor");
> {code}
> {code}
> public class MyProcessor implements Processor {
> @WithSpan
> @Override
> public void process(Exchange exchange) {
> // Useful work here...
> }
> }
> {code}
> This results in 2 spans. One for timer:tick & another for MyProcessor. The 
> problem is that the parent span for MyProcessor is not set, so they appear as 
> 2 distinct traces.
> There is a workaround where you can configure the route like this and the 
> span hierarchy ends up being correct:
> {code}
> from("timer:tick?period=5s")
> .to("direct:start");
> from("direct:start")
> .process("myProcessor");
> {code}
> There's some more background in the original issue reported on Camel Quarkus:
> https://github.com/apache/camel-quarkus/issues/4981
> There's also a reproducer project here:
> https://github.com/jamesnetherton/camel-opentelemetry-demo



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CAMEL-19469) camel-opentelemetry: Context not propagated correctly when tracing bean or processor invocations with @WithSpan

2024-03-21 Thread John Poth (Jira)


[ 
https://issues.apache.org/jira/browse/CAMEL-19469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17829634#comment-17829634
 ] 

John Poth commented on CAMEL-19469:
---

I'm also curious about the use case. The 
[OpenTelemetryTracingStrategy|https://github.com/apache/camel/blob/main/components/camel-opentelemetry/src/main/java/org/apache/camel/opentelemetry/OpenTelemetryTracingStrategy.java#L64]
 already creates a Span for Processors. It seems adding @WithSpan would just 
create another identical Span.

Unfortunately, naively putting,

{code:java}
// Some comments here
from("timer:tick?period=5s)
.process("myProcessor");

public class MyProcessor implements Processor {
@WithSpan
@Override
public void process(Exchange exchange) {
// Useful work here...
}
}
{code}

In a Unit test does not reproduce the issue and the Context is correctly 
propagated.



> camel-opentelemetry: Context not propagated correctly when tracing bean or 
> processor invocations with @WithSpan
> ---
>
> Key: CAMEL-19469
> URL: https://issues.apache.org/jira/browse/CAMEL-19469
> Project: Camel
>  Issue Type: Improvement
>  Components: camel-opentelemetry
>Affects Versions: 3.20.5, 4.0-M3
>Reporter: James Netherton
>Priority: Minor
>
> OpenTelemetry enables you to trace arbitrary method invocations by tagging 
> them with the @WithSpan annotation:
> https://opentelemetry.io/docs/instrumentation/java/automatic/annotations/#creating-spans-around-methods-with-withspan
> For some scenarios, the tracing context does not seem to get propagated and 
> the resulting spans end up being disassociated. For example:
> {code}
> from("timer:tick?period=5s)
> .process("myProcessor");
> {code}
> {code}
> public class MyProcessor implements Processor {
> @WithSpan
> @Override
> public void process(Exchange exchange) {
> // Useful work here...
> }
> }
> {code}
> This results in 2 spans. One for timer:tick & another for MyProcessor. The 
> problem is that the parent span for MyProcessor is not set, so they appear as 
> 2 distinct traces.
> There is a workaround where you can configure the route like this and the 
> span hierarchy ends up being correct:
> {code}
> from("timer:tick?period=5s")
> .to("direct:start");
> from("direct:start")
> .process("myProcessor");
> {code}
> There's some more background in the original issue reported on Camel Quarkus:
> https://github.com/apache/camel-quarkus/issues/4981
> There's also a reproducer project here:
> https://github.com/jamesnetherton/camel-opentelemetry-demo



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CAMEL-19469) camel-opentelemetry: Context not propagated correctly when tracing bean or processor invocations with @WithSpan

2023-06-21 Thread Claus Ibsen (Jira)


[ 
https://issues.apache.org/jira/browse/CAMEL-19469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17735676#comment-17735676
 ] 

Claus Ibsen commented on CAMEL-19469:
-

The @WithSpan is not a Camel annotation so not sure how Camel should deal with 
this. 

> camel-opentelemetry: Context not propagated correctly when tracing bean or 
> processor invocations with @WithSpan
> ---
>
> Key: CAMEL-19469
> URL: https://issues.apache.org/jira/browse/CAMEL-19469
> Project: Camel
>  Issue Type: Bug
>  Components: camel-opentelemetry
>Affects Versions: 3.20.5, 4.0-M3
>Reporter: James Netherton
>Priority: Minor
>
> OpenTelemetry enables you to trace arbitrary method invocations by tagging 
> them with the @WithSpan annotation:
> https://opentelemetry.io/docs/instrumentation/java/automatic/annotations/#creating-spans-around-methods-with-withspan
> For some scenarios, the tracing context does not seem to get propagated and 
> the resulting spans end up being disassociated. For example:
> {code}
> from("timer:tick?period=5s)
> .process("myProcessor");
> {code}
> {code}
> public class MyProcessor implements Processor {
> @WithSpan
> @Override
> public void process(Exchange exchange) {
> // Useful work here...
> }
> }
> {code}
> This results in 2 spans. One for timer:tick & another for MyProcessor. The 
> problem is that the parent span for MyProcessor is not set, so they appear as 
> 2 distinct traces.
> There is a workaround where you can configure the route like this and the 
> span hierarchy ends up being correct:
> {code}
> from("timer:tick?period=5s")
> .to("direct:start");
> from("direct:start")
> .process("myProcessor");
> {code}
> There's some more background in the original issue reported on Camel Quarkus:
> https://github.com/apache/camel-quarkus/issues/4981
> There's also a reproducer project here:
> https://github.com/jamesnetherton/camel-opentelemetry-demo



--
This message was sent by Atlassian Jira
(v8.20.10#820010)