From 9482f24893c39df80b4af3f79aee91e6aff5acd4 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Fri, 10 Jun 2022 15:26:55 +1200 Subject: [PATCH 1/2] Add convenient interface for getting and setting tags using `[]` and `[]=` respectively. Fixes https://github.com/DataDog/dd-trace-rb/issues/2075. --- lib/datadog/tracing/metadata/tagging.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/datadog/tracing/metadata/tagging.rb b/lib/datadog/tracing/metadata/tagging.rb index 12a66555cef..6ce64e78dc3 100644 --- a/lib/datadog/tracing/metadata/tagging.rb +++ b/lib/datadog/tracing/metadata/tagging.rb @@ -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] From aa4ab801ff81adf84a3e5e20b0d3f8dbb556b1a5 Mon Sep 17 00:00:00 2001 From: Marco Costa Date: Thu, 30 Jun 2022 11:30:39 -0700 Subject: [PATCH 2/2] =?UTF-8?q?Sacrifice=20for=20the=20linting=20gods=20?= =?UTF-8?q?=E2=98=A0=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/datadog/tracing/metadata/tagging.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/datadog/tracing/metadata/tagging.rb b/lib/datadog/tracing/metadata/tagging.rb index 6ce64e78dc3..90e8a2a33b3 100644 --- a/lib/datadog/tracing/metadata/tagging.rb +++ b/lib/datadog/tracing/metadata/tagging.rb @@ -72,10 +72,10 @@ def clear_tag(key) # 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]