diff --git a/lib/traces/provider/async/task.rb b/lib/traces/provider/async/task.rb index 27a8276..80b9d6a 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