[WIP] Add configurable metric attributes deny list#3356
Open
creydr wants to merge 2 commits into
Open
Conversation
Add a metrics-attributes-deny config key (comma-separated) that strips the listed attribute keys from all instruments via an OTel View. This prevents unbounded metric cardinality from attributes like cloudevents.type or messaging.destination.name.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: creydr The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3356 +/- ##
==========================================
+ Coverage 74.85% 74.91% +0.06%
==========================================
Files 189 190 +1
Lines 8347 8367 +20
==========================================
+ Hits 6248 6268 +20
Misses 1854 1854
Partials 245 245 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Slices make the Config struct non-comparable, which breaks downstream code that uses == to check for empty configs. Store the raw comma-separated string and provide an AttributesDenyList() method for the parsed result.
creydr
added a commit
to creydr/knative-eventing
that referenced
this pull request
May 21, 2026
Remove eventing-specific MetricAttributesDenyList field, parsing, and filter function. Use cfg.Metrics.AttributesDenyList() and metrics.MetricAttributesDenyFilter from knative.dev/pkg instead. Rename ConfigMap key from metrics.attributes.deny to metrics-attributes-deny to match knative.dev/pkg convention. Depends on: knative/pkg#3356
Member
|
Do you think we should just remove metrics with high cardinality? cc @Cali0707 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
metrics-attributes-denyconfig key to the observability ConfigMap. When set, the listed attribute keys (comma-separated) are stripped from all metric instruments via an OTel SDK View usingattribute.NewDenyKeysFilter.This prevents unbounded metric cardinality from attributes like
cloudevents.typeormessaging.destination.namethat can cause OOM in production.The deny filter is automatically applied in
sharedmain.SetupObservabilityOrDie, so all components usingsharedmainbenefit without any component-specific code.Example configuration: