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

Define map metrics as custom collectors #1510

Merged
merged 2 commits into from Oct 3, 2023

Conversation

lambdanis
Copy link
Contributor

@lambdanis lambdanis commented Sep 26, 2023

This PR reimplements two metrics: tetragon_map_in_use_gauge and
tetragon_map_errors_total, so that they are exposed by custom Prometheus
collectors. This means that metric values are read from BPF maps at the scrape
time, without a need for a userland tickers. From the user perspective, the
metrics are more accurate.

Additionally, the errors metric is exposed as a counter instead of a gauge.

Collect tetragon_map_in_use_gauge and tetragon_map_errors_total metrics directly from BPF maps at the scrape time. Expose the tetragon_map_errors_total metrics as a counter instead of a gauge.

@lambdanis lambdanis added the release-note/minor This PR introduces a minor user-visible change label Sep 26, 2023
@lambdanis lambdanis added the area/metrics Related to prometheus metrics label Sep 29, 2023
@lambdanis lambdanis force-pushed the pr/lambdanis/bpf-metrics branch 2 times, most recently from f6f3b32 to bdd0a0b Compare September 30, 2023 00:33
@lambdanis lambdanis changed the title [WIP] Define map metrics as custom collectors Define map metrics as custom collectors Sep 30, 2023
@lambdanis lambdanis marked this pull request as ready for review September 30, 2023 00:38
@lambdanis lambdanis requested a review from a team as a code owner September 30, 2023 00:38
@lambdanis lambdanis force-pushed the pr/lambdanis/bpf-metrics branch 4 times, most recently from 0968029 to aa045e9 Compare October 2, 2023 20:45
These types are slim helpers intended to be used in custom collectors that read
metrics directly from BPF maps.

Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
This commit reimplements two metrics: tetragon_map_in_use_gauge and
tetragon_map_errors_total, so that they are exposed by custom Prometheus
collectors. This means that metric values are read from BPF maps at the scrape
time, without a need for a userland tickers. From the user perspective, the
metrics are more accurate.

Additionally, the errors metric is exposed as a counter instead of a gauge.

Signed-off-by: Anna Kapuscinska <anna@isovalent.com>
Copy link
Contributor

@kevsecurity kevsecurity left a comment

Choose a reason for hiding this comment

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

LGTM

@lambdanis lambdanis merged commit 9405281 into cilium:main Oct 3, 2023
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/metrics Related to prometheus metrics release-note/minor This PR introduces a minor user-visible change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants