From 19c9298c4844875e527cda3c981afcc8c88efbb4 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Tue, 5 Nov 2024 22:57:40 +1300 Subject: [PATCH] Don't add attributes unless there is an annotation. --- lib/traces/provider/async/task.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/traces/provider/async/task.rb b/lib/traces/provider/async/task.rb index 27a8276d..80b9d6ab 100644 --- a/lib/traces/provider/async/task.rb +++ b/lib/traces/provider/async/task.rb @@ -15,9 +15,11 @@ def schedule(&block) super do Traces.trace_context = trace_context - attributes = { - "annotation" => self.annotation, - } + if annotation = self.annotation + attributes = { + "annotation" => annotation + } + end Traces.trace('async.task', attributes: attributes) do yield