Add metric_patterns options to filter all metric submission with a list of regexes#11508
Conversation
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
vickenty
left a comment
There was a problem hiding this comment.
Writing a single regular expression to match a collection of strings might not be the best UX for this. Would it make sense to let the user specify a list of glob patterns instead? (We could still use a compiled regular expression under the hood).
There was a problem hiding this comment.
- We should have both an inclusion and exclusion option
- They should be a list of patterns as @vickenty and @fanny-jiang suggested
- We should save like this (see #5764 (comment))
|
Ah thanks everyone- I'll update the field to be a list and also model the behavior of |
exclude_metrics_filters and include_metrics_filters options to filter all metric submission with a list of regexes
vickenty
left a comment
There was a problem hiding this comment.
LGTM, just a small nit / suggestion.
| if not isinstance(filters, list): | ||
| raise ConfigurationError('Setting `{}` must be an array'.format(option_name)) | ||
|
|
||
| metrics_pattern = None |
There was a problem hiding this comment.
| metrics_pattern = None |
| if metrics_patterns: | ||
| metrics_pattern = re.compile('|'.join(metrics_patterns)) | ||
| return metrics_pattern |
There was a problem hiding this comment.
Would it make sense to return the values directly, instead of going through a variable?
| if metrics_patterns: | |
| metrics_pattern = re.compile('|'.join(metrics_patterns)) | |
| return metrics_pattern | |
| if metrics_patterns: | |
| return re.compile('|'.join(metrics_patterns)) | |
| return None |
There was a problem hiding this comment.
Sure, I agree it's a little more readable this way
ofek
left a comment
There was a problem hiding this comment.
🔥
Last thing, WDYTA naming them (ex|in)clude_metric_patterns?
exclude_metrics_filters and include_metrics_filters options to filter all metric submission with a list of regexesmetric_filters options to filter all metric submission with a list of regexes
|
Thanks, updated with the suggestion to have an overall param |
metric_filters options to filter all metric submission with a list of regexesmetric_patterns options to filter all metric submission with a list of regexes
…list of regexes (#11508) * Add option for global metrics filter * Filter before context limiter * Compile regex and check for invalid regex * Add test for invalid regex * Add exclude and include filters * move regex logic down, add more tests * Remove space * Add more invalid tests * Refactor to helper functions, address comments, and add more tests * Add another test case * Add test case for include glob * Remove duplicate logic and further extract * Don't use metric_pattern veriable * Add overall metrics_filters param * Update message and tests * Rename to metric_patterns ddcf5dc
|
hi all. i'm struggling to find how can this be added to the prometheusScrape section in helm values.yaml |
What does this PR do?
Adds instance-level options to the base check to filter all metric submission with a regex. The main option is
metric_patternswith two sub-options areexcludeandinclude.Motivation
Allow users to have more control over what metrics are submitted for each integration
Additional Notes
exclude_labelsandinclude_labels, whereexcludetakes precedence overincludeexclude_metricsReview checklist (to be filled by reviewers)
changelog/andintegration/labels attached