quarkus: Bug/OpenTelemetry extension - unexpected exceptions are not recorded on the span
Describe the bug
My sample application throws an unexpected exception, and I would expect that the current span would contain an event of exception
and that attributes of 'exception.messageand/or
exception.stacktrace` would be filled.
see OTEL Semantic conventions of Exceptions
Expected behavior
whenever there’s an unexpected exception, the OTEL extension should catch it log event of exception
and fill span attributes exception.message
and/or exception.stacktrace
Actual behavior
the span does not contain event of exception
and attributes exception.message
and/or exception.stacktrace
are not being filled
How to Reproduce?
I used Quick start of Vertx and added to it the following class file
package org.acme;
import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.StatusCode;
import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.core.Vertx;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import java.io.IOException;
@Path("/err")
public class ErrResource {
private final Vertx vertx;
ErrResource(Vertx vertx) { // <2>
this.vertx = vertx;
}
@GET
@Path("/genException01")
public Uni<String> genExc01() {
throw new RuntimeException("exception 01");
}
@GET
@Path("/genFailure01")
public Uni<String> genFail01() {
return Uni.createFrom().failure(new IOException("fail01"));
}
@GET
@Path("/genRecordException")
public Uni<String> genInternalRecordException() {
Span currSpan = Span.current();
currSpan.recordException(new RuntimeException("Got recorded?"));
currSpan.setStatus(StatusCode.ERROR);
return Uni.createFrom().item("exception should been recorded");
}
}
- Repro 1 - accessing /err/genFailure01
see details at https://github.com/quarkusio/quarkus/issues/30462#issuecomment-1396577651
- Repro 2 - accessing /err/genException01
see details at https://github.com/quarkusio/quarkus/issues/30462#issuecomment-1396581548
- Manual recording of exception - accessing /err/genRecordException
see details at https://github.com/quarkusio/quarkus/issues/30462#issuecomment-1396588707
it works as excepted but it means that every user has to do it manually - not ideal. I think that should be the case when unexpected exception is catched within the framework.
Output of uname -a
or ver
windows 11
Output of java -version
java 17.0.5 2022-10-18 LTS
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.15.3.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.6
Additional information
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 29 (28 by maintainers)
Commits related to this issue
- Track exceptions thrown during JAX-RS processing in the current span Fixes: #30462 Fixes: #27384 — committed to geoand/quarkus by geoand a year ago
- Track exceptions thrown during JAX-RS processing in the current span Fixes: #30462 Fixes: #27384 — committed to geoand/quarkus by geoand a year ago
- Track exceptions thrown during JAX-RS processing in the current span Fixes: #30462 Fixes: #27384 — committed to geoand/quarkus by geoand a year ago
- Track exceptions thrown during JAX-RS processing in current span Fixes: #30462 Fixes: #27384 — committed to geoand/quarkus by geoand a year ago
- Merge pull request #34521 from geoand/#30462 Track exceptions thrown during JAX-RS processing in the current span — committed to quarkusio/quarkus by geoand a year ago
- Track exceptions thrown during JAX-RS processing in current span Fixes: #30462 Fixes: #27384 (cherry picked from commit ea1a2a09b397d0286d88ae4355d66dbb16a1d831) — committed to gsmet/quarkus by geoand a year ago
- Track exceptions thrown during JAX-RS processing in current span Fixes: #30462 Fixes: #27384 — committed to danielsoro/quarkus by geoand a year ago
- Update quarkus.version to v3 (major) (mulk/mulkcms2!27) This MR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [io.quarkus:quarkus-maven-plugin](https://git... — committed to benkard/mulkcms2 by benkard a year ago
@brunobat , @geoand , @gsmet , @radcortez thanks for solving it 🙏
Here it is.
Correct, the spec does not provide for such an integration point
Cool, I’ll add something to RESTEasy Reactive and then use it in the OpenTelemetry + RR integration
Right, that’s why I think https://github.com/quarkusio/quarkus/issues/27384 is the proper issue and this one only a subcase of it and should be closed in favor of the former.