From 70b59797b1b04be149d8b66d2bec50bc24dd0c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Vav=C5=99=C3=ADk?= Date: Wed, 20 Mar 2024 15:52:09 +0100 Subject: [PATCH] Only Add OTel Security Events when span is recording --- .../runtime/tracing/security/SecurityEventUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()); } }