Repository navigation
test(spanner): unflake GrpcResultSetTest - #14901
Conversation
Use TraceWrapper.getBlankSpan() instead of hardcoding OpenCensusSpan in closeWhileStreamIsStartingInvokesOnDoneSynchronously so the parent span type always matches the active JVM tracing framework even when earlier tests enable OpenTelemetry.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates GrpcResultSetTest.java to dynamically resolve the blank span type using a shared TraceWrapper instance, rather than hardcoding an OpenCensusSpan with BlankSpan.INSTANCE. This ensures compatibility with the active JVM-global tracing framework, which may vary depending on other tests. Additionally, the unused BlankSpan import was removed. There are no review comments to address, so I have no further feedback to provide.
There was a problem hiding this comment.
Code Review
This pull request updates GrpcResultSetTest.java to dynamically resolve the parent span type based on the active tracing framework. Instead of hardcoding an OpenCensus BlankSpan, it now instantiates a TraceWrapper and retrieves a blank span from it, preventing potential type mismatches caused by JVM-global tracing state. I have no feedback to provide as there are no review comments.
Problem
GrpcResultSetTest.closeWhileStreamIsStartingInvokesOnDoneSynchronouslyhardcodesnew OpenCensusSpan(BlankSpan.INSTANCE)as the parent span passed toResumableStreamIterator, whileTraceWrapperdispatches span creation based on the JVM-globalSpannerOptions.getActiveTracingFramework().SpannerOptions.enableOpenTelemetryTraces()without resetting it afterward,TraceWrapper.spanBuilderWithExplicitParentcasts the parent span toOpenTelemetrySpanand throws aClassCastException.Solution
TraceWrapperinstance incloseWhileStreamIsStartingInvokesOnDoneSynchronouslyand passtracer.getBlankSpan()as the parent span toResumableStreamIteratorso the parent span type always matches the active tracing framework.io.opencensus.trace.BlankSpanimport.