Open mkouba opened 10 months ago
/cc @brunobat (opentelemetry), @machi1990 (quartz), @radcortez (opentelemetry)
CC @mskacelik
Gonna have a look at it.
any news on this, @mskacelik?
Hi @brunobat, I haven't started it yet; I wanted to wait for you after your PTO. The issue is with the native Quarkus tests. The generated spans, containing information about a specific error (exception), are missing several fields compared to the JVM tests. Interestingly, when I attempted to replicate this on a Quarkus application, these fields were present even in native mode (checked in Jaeger). I will sent you a dm.
@mskacelik Any update on this issue?
@mskacelik Any update on this issue?
Hi @mkouba
I found that for these two representations of the SpanData
instance during native mode (one with raw SpanData
via toString and the second is the serialized representation of SpanData
).
List<SpanData> instance
: https://github.com/quarkusio/quarkus/blob/8012cf53931cc02f4ba95eb78f4ec2e66143bbc2/integration-tests/opentelemetry-quartz/src/main/java/io/quarkus/it/opentelemetry/quartz/ExporterResource.java#L21-L28
SpanData{spanContext=ImmutableSpanContext{traceId=dd648ce9747cb5ce5efe9bc3e3d7ca09, spanId=11ab721cc76251d4, traceFlags=01, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=true}, parentSpanContext=ImmutableSpanContext{traceId=00000000000000000000000000000000, spanId=0000000000000000, traceFlags=00, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=false}, resource=Resource{schemaUrl=https://opentelemetry.io/schemas/1.21.0, attributes={host.name="mskaceli-mac", service.name="quarkus-integration-test-opentelemetry-quartz", service.version="999-SNAPSHOT", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.31.0", webengine.name="Quarkus", webengine.version="999-SNAPSHOT"}}, instrumentationScopeInfo=InstrumentationScopeInfo{name=io.quarkus.opentelemetry, version=null, schemaUrl=null, attributes={}}, name=myFailedBasicScheduler, kind=INTERNAL, startEpochNanos=1707482727615446000, endEpochNanos=1707482727719361459, attributes={}, totalAttributeCount=0, events=[ImmutableExceptionEventData{epochNanos=1707482727719359917, exception=java.util.concurrent.CompletionException: java.lang.RuntimeException: error occurred in myFailedBasicScheduler., additionalAttributes={}, spanLimits=SpanLimitsValue{maxNumberOfAttributes=128, maxNumberOfEvents=128, maxNumberOfLinks=128, maxNumberOfAttributesPerEvent=128, maxNumberOfAttributesPerLink=128, maxAttributeValueLength=2147483647}}], totalRecordedEvents=1, links=[], totalRecordedLinks=0, status=ImmutableStatusData{statusCode=ERROR, description=}, hasEnded=true}
Map<String, Object> entry (serialized SpanData)
: https://github.com/quarkusio/quarkus/blob/8012cf53931cc02f4ba95eb78f4ec2e66143bbc2/integration-tests/opentelemetry-quartz/src/test/java/io/quarkus/it/opentelemetry/quartz/OpenTelemetryQuartzTest.java#L70-L73
{kind=INTERNAL, name=myFailedBasicScheduler, resource={attributes={empty=false}, schemaUrl=https://opentelemetry.io/schemas/1.21.0}, attributes={empty=true}, instrumentationLibraryInfo={version=null, name=io.quarkus.opentelemetry, schemaUrl=null}, instrumentationScopeInfo={version=null, name=io.quarkus.opentelemetry, attributes={empty=true}, schemaUrl=null}, status={statusCode=ERROR, description=}, parentSpanContext={valid=false, traceFlags={sampled=false}, traceIdBytes=AAAAAAAAAAAAAAAAAAAAAA==, spanIdBytes=AAAAAAAAAAA=, traceState={empty=true}, traceId=00000000000000000000000000000000, spanId=0000000000000000, sampled=false, remote=false}, parentSpanId=0000000000000000, endEpochNanos=1707482727719361459, totalRecordedEvents=1, totalRecordedLinks=0, spanContext={valid=true, traceFlags={sampled=true}, traceIdBytes=3WSM6XR8tc5e/pvD49fKCQ==, spanIdBytes=EatyHMdiUdQ=, traceState={empty=true}, traceId=dd648ce9747cb5ce5efe9bc3e3d7ca09, spanId=11ab721cc76251d4, sampled=true, remote=false}, totalAttributeCount=0, startEpochNanos=1707482727615446000, traceId=dd648ce9747cb5ce5efe9bc3e3d7ca09, spanId=11ab721cc76251d4, events=[{name=exception, attributes={empty=false}, epochNanos=1707482727719359917, totalAttributeCount=3, droppedAttributesCount=0}], links=[]}
These two representations differ in some fields/attributes, especially the second representation misses all the information about the thrown exception (spanIDs are the same).
So, I hypothesized that the serialization process does not work (in native mode); I tried adding a @RegisterForReflection
annotation for some classes (like ImmutableExceptionEventData
) or adding configuration properties for entire extensions. But nothing worked :-/.
Ok, I found something interesting.
Only the events
field behaves differently.
All the other fields are exactly the same (for all combinations failing/non-failing with JVM/native).
For the event
field here are all the possibilities in the tests (the spans that contain Exception, since those do not work):
SpanData#toString
):events=[ImmutableExceptionEventData{epochNanos=1728311743120525209, exception=java.util.concurrent.CompletionException: java.lang.RuntimeException: error occurred in myFailedBasicScheduler., additionalAttributes={}, spanLimits=SpanLimitsValue{maxNumberOfAttributes=128, maxNumberOfEvents=128, maxNumberOfLinks=128, maxNumberOfAttributesPerEvent=128, maxNumberOfAttributesPerLink=128, maxAttributeValueLength=2147483647}}]
Map.Entry<String, Object>#toString
):SpanData#toString
):events=[ImmutableExceptionEventData{epochNanos=1728312313087000875, exception=java.util.concurrent.CompletionException: java.lang.RuntimeException: error occurred in myFailedBasicScheduler., additionalAttributes={}, spanLimits=SpanLimitsValue{maxNumberOfAttributes=128, maxNumberOfEvents=128, maxNumberOfLinks=128, maxNumberOfAttributesPerEvent=128, maxNumberOfAttributesPerLink=128, maxAttributeValueLength=2147483647}}]
Map.Entry<String, Object>#toString
):events=[{attributes={empty=false}, name=exception, droppedAttributesCount=0, epochNanos=1728312313087000875, totalAttributeCount=3}]
https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk/trace/src/main/java/io/opentelemetry/sdk/trace/data/EventData.java (notice how the fields equal the serialized fields)
quarkus.index-dependency.otelsdk.group-id=io.opentelemetry
quarkus.index-dependency.otelsdk.artifact-id=opentelemetry-sdk
quarkus.index-dependency.otelapi.group-id=io.opentelemetry
quarkus.index-dependency.otelapi.artifact-id=opentelemetry-api
Also did not work.
Description
This is a follow-up of https://github.com/quarkusio/quarkus/pull/35989.
Implementation ideas
No response