Missing opentelemetry-java SERVER span with nested span - Stack Overflow
I'm seeing some odd behavior with opentelemetry-java (via SmallRye OpenTelemetry). For some context, this is running in the WildFly application server, which integrates smallrye-opentelemtry for its otel support. In SR Otel, there is a ContainerRequestFilter
/ContainerResponseFilter
that implicitly adds a span to all incoming Jakarta REST requests. You can see that code here: .9.2/implementation/rest/src/main/java/io/smallrye/opentelemetry/implementation/rest/OpenTelemetryServerFilter.java
For a simple REST endpoint (e.g., something that just returns a String), we see the expected span created and exported. However, if the endpoint method creates a nested span, the span created by the filter is not exported. That method might look something like this:
@GET
@Produces(MediaType.TEXT_PLAIN)
@Path("/test")
public String testOpentelemetry(@QueryParam("question") String question) {
Span span = tracer.spanBuilder("explicit span")
.setAttribute("com.acme.string-key", "value")
.startSpan();
try {
String answer;
try {
span.setAttribute("com.acme.question", "question");
span.addEvent(question);
answer = question + " received";
span.setStatus(StatusCode.OK);
} catch (Exception e) {
e.printStackTrace();
span.recordException(e);
span.setStatus(StatusCode.ERROR);
answer = "My failure reason is:\n\n" + e.getMessage();
}
span.addEvent(answer);
return answer;
} finally {
span.end();
}
}
(This is a simple test endpoint, so it's not supposed to make sense :)
If I debug the SdkSpan
class, I can see endInternal(long endEpochNanos)
called and the span being ending, but it's not ever exported. If I comment out the span-related code, the "implicit" span is again exported.
Is there something odd about explicit spans like this verses the SpanKind.SERVER
created in the filter? What am I missing?
- 微软软件业务将全面转向免费增值模式
- 台式电脑“玩”安卓(图)
- 力压谷歌、苹果,微软凭什么成为软件霸主?
- 恶意软件侵害苹果用户!4G更易受攻击
- python - Deploy Flask, Pyspark code in azure app service - Stack Overflow
- scipy - Generalized Nonsymmetric Eigensolver Python - Stack Overflow
- reactjs - Why getting error 'Objects are not valid as a React child' in turborepo ui tests? - Stack Overflow
- algorithm - LeetCode help , 3 letter palindrome question - medium - Stack Overflow
- amazon web services - How to create a CloudWatch alarm for an EventBridge Pipe's stopped state in AWS? - Stack Overflow
- reactjs - How to import svg icons in Nextjs 15 - Stack Overflow
- c++ - How to create a class setup where two classes each holds an instance of the other? - Stack Overflow
- reactjs - NextAuth cookie not being sent when I use the development server, but being sent when I use HoppscotchBrowser to send
- python - Windows java.io.EOFException error when trying to show spark dataframe - Stack Overflow
- c# - Make custom file property columns show by default in Windows File Explorer - Stack Overflow
- javascript - How to properly handle AES encryption in React Native and generate Random Key for AES encryption? - Stack Overflow
- outlook - Unable to send email using Microsoft Graph API: Error 550 5.7.708 - Stack Overflow
- How to I get excel to look up values in the nth column based on a number in a cell? - Stack Overflow