Skip to content

Commit

Permalink
Add convenient interface for getting and setting tags using [] and …
Browse files Browse the repository at this point in the history
…`[]=` respectively.

Fixes #2075.
  • Loading branch information
ioquatix authored and marcotc committed Jun 30, 2022
1 parent 4f3c210 commit 91010c6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/datadog/tracing/metadata/tagging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ def clear_tag(key)
meta.delete(key)
end

# Convenient interface for setting a single tag.
alias []= set_tag

# Convenient interface for getting a single tag.
alias [] get_tag

# Return the metric with the given key, nil if it doesn't exist.
def get_metric(key)
metrics[key] || meta[key]
Expand Down

0 comments on commit 91010c6

Please sign in to comment.