Skip to content
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

Merged
merged 4 commits into from Sep 2, 2020

Conversation

pmalek-sumo
Copy link
Contributor

Description

Fill in your description here.

Testing performed
  • ci/build.sh
  • Redeploy fluentd and fluentd-events pods
  • Confirm events, logs, and metrics are coming in

Copy link
Contributor

@frankreno frankreno left a 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
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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)

Copy link
Contributor Author

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.

Copy link
Contributor

@frankreno frankreno left a comment

Choose a reason for hiding this comment

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

LGTM

@pmalek-sumo pmalek-sumo merged commit 7b852e3 into master Sep 2, 2020
@pmalek-sumo pmalek-sumo deleted the drop-container-pod-label branch September 2, 2020 18:11
@perk-sumo perk-sumo added this to the v1.2 milestone Sep 3, 2020
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.

None yet

5 participants