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

Fix hubble metrics label ordering with contextOptions #21732

Merged
merged 3 commits into from
Oct 17, 2022

Conversation

chancez
Copy link
Contributor

@chancez chancez commented Oct 13, 2022

This fixes an issue introduced by d4d7368 in #21079 where metrics labels for drop, dns, and tcp metrics are incorrect when using any contextOptions. This is because the order labels are registered in, was different from the order the labels are used when incrementing the counters.

I had to refactor DNS a little bit because the logic was so complicated, and I tried to make it less "stateful" with the labels, which is part of the reason that one got done incorrectly in the first place. drop/tcp were simpler.

I'm not sure this actually needs a release note because I don't think the contextLabels PR has made it into a release yet, but I added one anyways.

Fix hubble metrics label ordering with contextOptions

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Oct 13, 2022
@chancez chancez force-pushed the pr/chancez/hubble_metrics_label_order branch from b23c843 to 6f6f8bc Compare October 13, 2022 23:22
@rolinh
Copy link
Member

rolinh commented Oct 14, 2022

The commit messages are empty. Would you mind adding the context around these changes from your PR description to the commits as well?

I'm not sure this actually needs a release note because I don't think the contextLabels PR has made it into a release yet, but I added one anyways.

If the PR fixes something that isn't yet in any release, then you should use the release-note/misc label and not the release-note/bug one but a release note is required in any case.

@rolinh rolinh added the release-note/misc This PR makes changes that have no direct user impact. label Oct 14, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Oct 14, 2022
@rolinh rolinh added area/metrics Impacts statistics / metrics gathering, eg via Prometheus. dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Oct 14, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Oct 14, 2022
@rolinh rolinh added sig/hubble Impacts hubble server or relay dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Oct 14, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Oct 14, 2022
@chancez chancez marked this pull request as ready for review October 14, 2022 15:28
@chancez chancez requested a review from a team as a code owner October 14, 2022 15:28
@chancez chancez requested a review from kaworu October 14, 2022 15:28
@chancez
Copy link
Contributor Author

chancez commented Oct 14, 2022

/test

Job 'Cilium-PR-K8s-1.24-kernel-4.19' failed:

Click to show.

Test Name

K8sDatapathConfig Host firewall With VXLAN

Failure Output

FAIL: Failed to reach 192.168.56.12:80 from testclient-l7lnt

If it is a flake and a GitHub issue doesn't already exist to track it, comment /mlh new-flake Cilium-PR-K8s-1.24-kernel-4.19 so I can create one.

@chancez
Copy link
Contributor Author

chancez commented Oct 14, 2022

/mlh new-flake Cilium-PR-K8s-1.24-kernel-4.19

👍 created #21740

@chancez
Copy link
Contributor Author

chancez commented Oct 14, 2022

/test-1.24-4.19

@chancez chancez force-pushed the pr/chancez/hubble_metrics_label_order branch from 6f6f8bc to 9f6bdec Compare October 14, 2022 18:47
Label names and label values need to be in the same order.

Context label names were at the end of the labels list, but at the
beginning of the label values so the label names were mismatched with
their label values.

Signed-off-by: Chance Zibolski <chance.zibolski@gmail.com>
Label names and label values need to be in the same order.

Refactor DNS metrics handler to be a bit simpler, with less branches and
fix the label order mismatch between label names and label values.

Signed-off-by: Chance Zibolski <chance.zibolski@gmail.com>
Label names and label values need to be in the same order.

Label names were at the end of the list while hte values were at the
beginning, this fixes it so they both are at the beginning.

Signed-off-by: Chance Zibolski <chance.zibolski@gmail.com>
@chancez chancez force-pushed the pr/chancez/hubble_metrics_label_order branch from 9f6bdec to 8300d26 Compare October 14, 2022 18:48
Copy link
Member

@rolinh rolinh left a comment

Choose a reason for hiding this comment

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

Thanks!

@chancez
Copy link
Contributor Author

chancez commented Oct 14, 2022

/test

@michi-covalent
Copy link
Contributor

marking ready to merge, 2 approvals from sig-hubble members.

@michi-covalent michi-covalent added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Oct 17, 2022
@qmonnet qmonnet merged commit df6a89c into master Oct 17, 2022
@qmonnet qmonnet deleted the pr/chancez/hubble_metrics_label_order branch October 17, 2022 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics Impacts statistics / metrics gathering, eg via Prometheus. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact. sig/hubble Impacts hubble server or relay
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants