diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/security/SecurityEventUtil.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/security/SecurityEventUtil.java index e162fb57b89e5..674ded182b212 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/security/SecurityEventUtil.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/security/SecurityEventUtil.java @@ -113,7 +113,7 @@ public void accept(String key, Object value) { private static void addEvent(String eventName, Attributes attributes) { Span span = Arc.container().select(Span.class).get(); - if (span.getSpanContext().isValid()) { + if (span.getSpanContext().isValid() && span.isRecording()) { span.addEvent(eventName, attributes, Instant.now()); } }