From 8ef9825f3c751bbb54a94197297595a1fa391dc4 Mon Sep 17 00:00:00 2001 From: Tor Date: Fri, 26 Jan 2024 13:56:20 +0100 Subject: [PATCH] ref(metrics): Rename tag-field to tags (#3006) It's a list, so the name should reflect that. --- py/CHANGELOG.md | 3 +++ relay-dynamic-config/src/metrics.rs | 2 +- relay-server/src/services/project.rs | 6 +++--- tests/integration/test_metrics.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/py/CHANGELOG.md b/py/CHANGELOG.md index 36a6e4a87b..b905ec3d2c 100644 --- a/py/CHANGELOG.md +++ b/py/CHANGELOG.md @@ -3,9 +3,12 @@ ## Unreleased - Add `allow_negative` to `BuiltinMeasurementKey`. Filter out negative BuiltinMeasurements if `allow_negative` is false. ([#2982](https://github.com/getsentry/relay/pull/2982)) +- Add ability to block metric tags matching a glob pattern. ([#2973](https://github.com/getsentry/relay/pull/2973)) ## 0.8.44 +- Add ability to block metrics matching a glob pattern. ([#2954](https://github.com/getsentry/relay/pull/2954)) + ### Various fixes & improvements - release: 0.8.43 (9789f00a) by @getsentry-bot diff --git a/relay-dynamic-config/src/metrics.rs b/relay-dynamic-config/src/metrics.rs index 0f449f32a6..f566403497 100644 --- a/relay-dynamic-config/src/metrics.rs +++ b/relay-dynamic-config/src/metrics.rs @@ -43,7 +43,7 @@ pub struct TagBlock { /// Name of metric of which we want to remove certain tags. pub name: GlobPatterns, /// Pattern to match keys of tags that we want to remove. - pub tag: GlobPatterns, + pub tags: GlobPatterns, } /// Rule defining when a target tag should be set on a metric. diff --git a/relay-server/src/services/project.rs b/relay-server/src/services/project.rs index 232024e53f..31f5eb0374 100644 --- a/relay-server/src/services/project.rs +++ b/relay-server/src/services/project.rs @@ -1182,7 +1182,7 @@ fn remove_matching_bucket_tags(metric_config: &Metrics, bucket: &mut Bucket) { if tag_block.name.is_match(&bucket.name) { bucket .tags - .retain(|tag_key, _| !tag_block.tag.is_match(tag_key)); + .retain(|tag_key, _| !tag_block.tags.is_match(tag_key)); } } } @@ -1522,7 +1522,7 @@ mod tests { let metric_config = Metrics { denied_tags: vec![TagBlock { name: GlobPatterns::new(vec!["foobar".to_string()]), - tag: GlobPatterns::new(vec![tag_block_pattern.to_string()]), + tags: GlobPatterns::new(vec![tag_block_pattern.to_string()]), }], ..Default::default() }; @@ -1548,7 +1548,7 @@ mod tests { denied_tags: vec![TagBlock { // barfoo doesn't batch the 'foobar' bucket name: GlobPatterns::new(vec!["barfoo".to_string()]), - tag: GlobPatterns::new(vec![tag_block_pattern.to_string()]), + tags: GlobPatterns::new(vec![tag_block_pattern.to_string()]), }], ..Default::default() }; diff --git a/tests/integration/test_metrics.py b/tests/integration/test_metrics.py index 92e25413a2..f793209cfa 100644 --- a/tests/integration/test_metrics.py +++ b/tests/integration/test_metrics.py @@ -1639,7 +1639,7 @@ def test_block_metrics_and_tags(mini_sentry, relay, denied_names, denied_tag): "sessionMetrics": {"version": 1}, "metrics": { "deniedNames": [denied_names], - "deniedTags": [{"name": ["*"], "tag": [denied_tag]}], + "deniedTags": [{"name": ["*"], "tags": [denied_tag]}], }, } }