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
Drop container=pod label when scraping container network metrics #879
Conversation
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.
One change as discussed
@@ -307,6 +307,9 @@ prometheus: | |||
- action: keep | |||
regex: kubelet;(?:container_network_receive_bytes_total|container_network_transmit_bytes_total) | |||
sourceLabels: [job, __name__] | |||
- action: drop |
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.
As discussed, we want to use label drop to drop the label container=POD
from the container_network_receive_bytes_total
and container_network_transmit_bytes_total
metrics. Not drop the metrics themselves.
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.
Updated, should be good now
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.
Did you test this locally and confirm that we still get the metrics in Sumo but they no longer have the container=POD
? The reason I ask is I looked at the Prometheus relabel docs - https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
This indicates that when using labelDrop
action, it matches against a regex
property. Does not explicitly state it works for sourceLabels
so just want to make sure.
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.
So I based that on this https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/api.md#relabelconfig specifically on:
sourceLabels - The source labels select values from existing labels. Their content is concatenated using the configured separator and matched against the configured regular expression for the replace, keep, and drop actions.
at the same time:
regex - Regular expression against which the extracted value is matched. Default is '(.*)'
And as I look at the metrics coming from my KOPS cluster it indeed remove the cluster
label so I cannot see it anymore (unless I make the timerange wide enough to cover my testing yesterday where I haven't managed to configure the relabel_config
yet)
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.
I obviously meant container
label, not cluster
label.
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.
LGTM
Description
Fill in your description here.
Testing performed