Skip to content

feat(sdk-metrics): support * and ? wildcards in Allow/DenyListAttributesProcessor - #6995

Open
SaiprasadDash wants to merge 2 commits into
open-telemetry:mainfrom
SaiprasadDash:feat/wildcard-attributes-processor
Open

feat(sdk-metrics): support * and ? wildcards in Allow/DenyListAttributesProcessor#6995
SaiprasadDash wants to merge 2 commits into
open-telemetry:mainfrom
SaiprasadDash:feat/wildcard-attributes-processor

Conversation

@SaiprasadDash

Copy link
Copy Markdown

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-includeexclude

Added tests for *, ?, combined patterns, and literal regex-special characters. All existing tests continue to pass.

…deny list processors

Signed-off-by: SaiprasadDash <dashsaiprasad831@gmail.com>
@SaiprasadDash
SaiprasadDash requested a review from a team as a code owner August 11, 2026 20:42
@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 11, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: SaiprasadDash / name: SaiprasadDash (ccffc35)

@github-actions

Copy link
Copy Markdown

Welcome, contributor! Thank you for your contribution to opentelemetry-js.

Important reminders:

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Aug 11, 2026

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-08-21 01:37 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

}

function matchesAny(predicates: Predicate[], attributeName: string): boolean {
return predicates.some(predicate => predicate.match(attributeName));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JacksonWeber

Copy link
Copy Markdown
Contributor

Could you add a CHANGELOG entry for this?

@opentelemetry-pr-dashboard

This comment has been minimized.

@SaiprasadDash

Copy link
Copy Markdown
Author

Could you add a CHANGELOG entry for this?

Added under Unreleased in experimental/CHANGELOG.md — same commit.

@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.03%. Comparing base (7b06368) to head (0f00faf).
⚠️ Report is 29 commits behind head on main.

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     
Files with missing lines Coverage Δ
...ckages/sdk-metrics/src/view/AttributesProcessor.ts 100.00% <100.00%> (ø)
packages/sdk-metrics/src/view/Predicate.ts 100.00% <100.00%> (ø)

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sdk-metrics] support '*', '?' wildcards in createAllowListAttributesProcessor and createDenyListAttributesProcessor

2 participants