feat(sdk-metrics): support * and ? wildcards in Allow/DenyListAttributesProcessor - #6995
Conversation
…deny list processors Signed-off-by: SaiprasadDash <dashsaiprasad831@gmail.com>
|
|
|
Welcome, contributor! Thank you for your contribution to opentelemetry-js. Important reminders:
|
Pull request dashboard statusWaiting on reviewers · refreshed 2026-08-21 01:37 UTC Review the latest changes. Status above doesn't look right?
|
| } | ||
|
|
||
| function matchesAny(predicates: Predicate[], attributeName: string): boolean { | ||
| return predicates.some(predicate => predicate.match(attributeName)); |
There was a problem hiding this comment.
Could we keep the exact names in a Set and only use predicates for entries that contain wildcards? This runs for every measurement, and as written the common all-literal case now scans the whole list for each attribute instead of doing a constant-time lookup.
There was a problem hiding this comment.
I’ve updated the implementation to use a Set for exact-match names, making the common all-literal case a constant-time lookup. Entries containing * or ? are handled separately through PatternPredicate. Pushed the changes in 0f00faf.
|
Could you add a CHANGELOG entry for this? |
This comment has been minimized.
This comment has been minimized.
Added under Unreleased in experimental/CHANGELOG.md — same commit. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6995 +/- ##
==========================================
- Coverage 95.07% 95.03% -0.05%
==========================================
Files 409 409
Lines 14256 14322 +66
Branches 3267 3280 +13
==========================================
+ Hits 13554 13611 +57
- Misses 702 711 +9
🚀 New features to boost your workflow:
|
Fixes #6951
Extends the existing PatternPredicate (already used by View's InstrumentSelector/MeterSelector) to also support the
?wildcard, not just*, then reuses it in createAllowListAttributesProcessor and createDenyListAttributesProcessor — matching the wildcard semantics of the OpenTelemetry IncludeExclude config type: https://opentelemetry.io/docs/specs/otel-config/types/#type-includeexcludeAdded tests for
*,?, combined patterns, and literal regex-special characters. All existing tests continue to pass.