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

Update metrics to align with Prometheus best practices #2248

Merged
merged 4 commits into from
Dec 6, 2024

Conversation

torredil
Copy link
Member

@torredil torredil commented Nov 27, 2024

What type of PR is this?

/kind cleanup

What is this PR about? / Why do we need it?

This PR updates the metrics registered by the node plugin to align with Prometheus best practices by:

  • Adding a aws_ebs_csi namespace prefix.
  • Following Prometheus conventions such as adding _total suffix for counter metrics.
  • Using base units (seconds) instead of microseconds.

It also introduces a new parameter controller.deprecatedMetrics to disable registering the existing controller metrics that use an outdated namespace, such as:

cloudprovider_aws_api_request_duration_seconds_bucket{request="AttachVolume",le="0.005"} 0

Metrics using the new namespace will be registered by default if controller.enableMetrics is configured:

aws_ebs_csi_api_request_duration_seconds_bucket{request="AttachVolume",le="0.005"} 0

How was this change tested?

  • make verify && make test
  • Manually
  • CI

Does this PR introduce a user-facing change?

BREAKING CHANGE: Node plugin metrics have been renamed to follow Prometheus best practices:
- Added "aws_ebs_csi_" prefix.
- Added "_total" suffix for counters.
- Changed time units from microseconds to seconds for all counters.

Controller plugin metrics now use the "aws_ebs_csi_" prefix instead of "cloudprovider_aws_".
Old metric names can be disabled via the controller.deprecatedMetrics parameter.

Note for reviewers:

Please note that time units have been changed from microseconds to seconds for all counters. The read/write IO latency histograms is observed in microseconds (the buckets for these histograms are retrieved directly from the log page which record the data in microseconds).

Signed-off-by: torredil <torredil@amazon.com>
Signed-off-by: torredil <torredil@amazon.com>
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 27, 2024
@torredil torredil changed the title Update metrics to align with Prometheus best practices WIP: Update metrics to align with Prometheus best practices Nov 27, 2024
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 27, 2024
Copy link

Code Coverage Diff

File Old Coverage New Coverage Delta
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/cloud/handlers.go 6.5% 5.4% -1.0

@torredil torredil force-pushed the update-metrics-85123 branch from b270857 to 4060d93 Compare November 27, 2024 18:47
@torredil torredil changed the title WIP: Update metrics to align with Prometheus best practices Update metrics to align with Prometheus best practices Nov 27, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 27, 2024
@torredil
Copy link
Member Author

cc: @SuperQ

@torredil torredil force-pushed the update-metrics-85123 branch 4 times, most recently from b22ca7f to 4afddd6 Compare November 27, 2024 19:50
Signed-off-by: torredil <torredil@amazon.com>
@torredil torredil force-pushed the update-metrics-85123 branch from 4afddd6 to ca9a65b Compare November 29, 2024 17:55
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 29, 2024
@ConnorJC3 ConnorJC3 force-pushed the update-metrics-85123 branch from ca9a65b to 9b843c7 Compare December 6, 2024 16:13
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 6, 2024
@ConnorJC3 ConnorJC3 force-pushed the update-metrics-85123 branch from 9b843c7 to 91f3d73 Compare December 6, 2024 16:15
@ConnorJC3
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ConnorJC3

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 6, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 6, 2024
Copy link
Member

@ElijahQuinones ElijahQuinones left a comment

Choose a reason for hiding this comment

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

/LGTM all metrics in seconds

Signed-off-by: torredil <torredil@amazon.com>
Co-authored-by: Connor Catlett <conncatl@amazon.com>
@ConnorJC3 ConnorJC3 force-pushed the update-metrics-85123 branch from 91f3d73 to 212f289 Compare December 6, 2024 16:32
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 6, 2024
@AndrewSirenko
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 6, 2024
@k8s-ci-robot k8s-ci-robot merged commit 064f186 into kubernetes-sigs:master Dec 6, 2024
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants