-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apply filters on prometheus 'up' metrics #16568
Conversation
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
@@ -173,19 +179,15 @@ func (m *MetricSet) skipFamily(family *dto.MetricFamily) bool { | |||
// This would mean that we want to keep only the metrics that start with node_ prefix but | |||
// are not related to disk so we exclude node_disk_* metrics from them. | |||
|
|||
if family == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I see what you did here.
I'm not sure if it isn't safer to keep the family == nil
check here, but split the whole method body into two methods: skipFamily
and skipFamilyName
. WDYT? It might prevent next developers from making mistakes (nil structure).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's doesn't blow up any system tests, please consider these changes approved. Thanks!
(cherry picked from commit ae34415)
We cannot make the regexp matching work. So if we want to exclude all metrics ending in e.g. This PR also did not add any tests wrt. regexp matching. |
Hi! Tests had been added on the PR(#16420) that originally added this functionality (https://github.com/elastic/beats/pull/16420/files#diff-5945e5b443352401ece4bbac9bbb653cR205).
For such questions please refer to https://discuss.elastic.co/tags/c/elastic-stack/81/metricbeat. |
There are no regexp tests, I added some myself and they do work correctly locally on the master build. But it does fail to process/match regex excludes using metricbeat 7.9.1 on CentOS (installed using the RPM). Even the example regex ( I will propose a PR adding those regex matching examples to the tests. |
Closes #16564