Closed Azquelt closed 10 months ago
Had a quick look at this. While repeating with the v1.29 agent is easy, it generates two spans for JAX-RS requests so all the test expectations need updating.
We are experiencing an issue when withSpan annotation is used with Java EE7 and Java EE8 using Javaagent 1.29.
With Javaagent 1.19 up to 1.24:
With Javaagent 1.25 up to/ and 1.29 with NOT Java EE 7 or Java EE 8:
With Javaagent 1.25 up to/ and 1.29 with Java EE 7 or Java EE 8:
With Javaagent 1.19 up to 1.24 annotated with withSpan:
With Javaagent 1.25 up to/ and 1.29 with NOT Java EE 7 or Java EE 8 annotated with withSpan:
With Javaagent 1.25 up to/ and 1.29 with Java EE 7 or Java EE 8 annotated with withSpan:
Whilst comparing versions 1.24 and 1.25 I found this change in the javaagent which made changes to the WithSpanInstrumentation classes.
The change for the extra span to be created happened in the 1.24 release of javaagent. There has been a fix implemented to the jax-rs annotation. This fix is for Missing jaxrs span in Open Liberty
Created an app that uses javaagent 1.29, Java EE 8 and MicoProfile 4.1 to check if this error will occur like in the tests if MPTelemetry is not enabled/installed.
I created a simple application with the following two methods:
@GET
@Path("/withspannonbean")
public String callNonBeanWithSpan() throws Exception {
Method m = RestApplication.class.getDeclaredMethod("withSpanNonBeanMethod");
System.out.println("ANNOTATIONS callNonBeanWithSpan: " + Arrays.asList(m.getAnnotations()));
Span span = Span.current();
withSpanNonBeanMethod();
return span.getSpanContext().getTraceId();
}
And
@WithSpan()
public static String withSpanNonBeanMethod() {
return Span.current().getSpanContext().getSpanId();
}
Also used the following jvm
options:
-javaagent:/path/to/opentelemetry-javaagent.jar
-Dotel.javaagent.debug=true
-Dotel.sdk.disabled=false
-Dotel.traces.exporter=logging
-Dotel.metrics.exporter=none
-Dotel.logs.exporter=none
The expected output for this scenario was:
withSpanNonBeanMethod()
The actual output was:
withSpanNonBeanMethod()
which can be seen in the message.logs
from otel.javaagent.debug
Issue opened here
Currently we're testing Telemetry Agent 1.19 with all versions of the mpTelemetry feature in
AgentTest
.However, this means: