[Metrics] Exclude list for tags on Metrics#7373
Conversation
…elated updates - Introduced ExcludedTagKeys property in MetricStreamConfiguration to specify optional tag keys to exclude from metrics. - Updated AggregatorStore to handle excluded tag keys during metric updates. - Enhanced MetricStreamIdentity to include excluded tag keys. - Implemented validation logic to ensure TagKeys and ExcludedTagKeys are mutually exclusive. - Added tests to verify behavior of excluded tag keys in metric views.
…lyFilteredTagCollection
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7373 +/- ##
==========================================
- Coverage 89.76% 89.70% -0.06%
==========================================
Files 276 276
Lines 14611 14686 +75
==========================================
+ Hits 13115 13174 +59
- Misses 1496 1512 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
Decisions that require review
|
| State | Behavior | New in PR? |
|---|---|---|
Both null |
All tags preserved | No |
TagKeys = [] |
All measurements collapse to zero-tag metric point | No |
ExcludedTagKeys = [] |
All tags preserved (identical to default, but goes through exclude code path) | Yes |
Both non-null (including both []) |
Validate() throws, view is dropped with a logged warning (event ID 41), instrument falls back to default behavior |
Yes |
Order sensitivity in ExcludedTagKeys
ExcludedTagKeys uses element-wise comparison (same as TagKeys). ["a","b"] and ["b","a"] produce different MetricStreamIdentity values even though the filtering behavior is identical. This is a known limitation inherited from the pre-existing TagKeys behavior.
| { | ||
| #if NET | ||
| internal readonly FrozenSet<string>? TagKeysInteresting; | ||
| internal readonly FrozenSet<string>? ExcludedTagKeysInteresting; |
There was a problem hiding this comment.
If we're excluding them, aren't they more "uninteresting"?
Not sure about the suffix and/or if we need both Excluded and Uninteresting.
I'd probably just name it ExcludedTagKeys.
| if (!excludedTagKeys.Contains(tags[n].Key)) | ||
| { | ||
| tagKeysAndValues![actualLength] = tags[n]; |
There was a problem hiding this comment.
tags[n] is accessed twice.
Co-authored-by: Martin Costello <martin@martincostello.com>
Towards #4427
Design discussion issue open-telemetry/opentelemetry-specification#4188
Changes
Adds an exclude list to MetricStreamConfiguration and
FindMetricAggregatorsExcludeTagmethod that returns the correct list for the current viewMerge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes