Skip to content

Commit

Permalink
CCOL-2039: Update datadog span tagging
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Pereira committed Dec 6, 2023
1 parent 1e5d3a5 commit 74364f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/deimos/active_record_consume/batch_consumption.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions lib/deimos/tracing/datadog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 74364f6

Please sign in to comment.