open telemetry: Use Span.current().isRecording() rather than isValid()

Change to use isRecording() to determine if ProfileStream should be
created for collecting profiling events
This commit is contained in:
robin.bygrave
2026-05-14 16:20:28 +12:00
parent 0652167101
commit e5aeda9d4e
@@ -63,7 +63,7 @@ public final class OtelProfileHandler implements SpiProfileHandler, Plugin {
*/
@Override
public @Nullable ProfileStream createProfileStream(@Nullable ProfileLocation location, @Nullable String label) {
if (!Span.current().getSpanContext().isValid()) {
if (!Span.current().isRecording()) {
// No active OTel trace context — don't create spans to avoid noise
return null;
}