diff --git a/lib/deimos/active_record_consume/batch_consumption.rb b/lib/deimos/active_record_consume/batch_consumption.rb index 5e5bcbf2..007e2a3a 100644 --- a/lib/deimos/active_record_consume/batch_consumption.rb +++ b/lib/deimos/active_record_consume/batch_consumption.rb @@ -28,16 +28,16 @@ def consume_batch(payloads, metadata) zip(metadata[:keys]). map { |p, k| Deimos::Message.new(p, nil, key: k) } - Deimos.config.tracer.active_span.set_tag('topic', metadata[:topic]) + tag = metadata[:topic] + Deimos.config.tracer.active_span.set_tag('topic', tag) - Deimos.instrument('ar_consumer.consume_batch', - Deimos.config.tracer.active_span.get_tag('topic')) do + Deimos.instrument('ar_consumer.consume_batch', tag) do if @compacted || self.class.config[:no_keys] update_database(compact_messages(messages)) else uncompacted_update(messages) end - end + end end protected diff --git a/lib/deimos/tracing/datadog.rb b/lib/deimos/tracing/datadog.rb index 932404d4..cc2503d1 100644 --- a/lib/deimos/tracing/datadog.rb +++ b/lib/deimos/tracing/datadog.rb @@ -45,6 +45,11 @@ def set_tag(tag, value, span=nil) (span || active_span).set_tag(tag, value) end + # :nodoc: + def get_tag(tag) + active_span.get_tag(tag) + end + end end end