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

Switch from grpc-ecosystem/go-grpc-prometheus to grpc-ecosystem/go-grpc-middleware/providers/prometheus #19195

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dims
Copy link
Contributor

@dims dims commented Jan 14, 2025

Reviving previous effort from: #17974

xref: kubernetes/kubernetes#128583

Added a new test to make sure we are not missing any expected metrics.

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

@k8s-ci-robot
Copy link

Hi @dims. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@dims dims force-pushed the switch-from-grpc-ecosystem/go-grpc-prometheus-to-grpc-ecosystem/go-grpc-middleware/providers/prometheus-take-2 branch from f7123cd to f80c5b2 Compare January 14, 2025 22:09
@ivanvc
Copy link
Member

ivanvc commented Jan 14, 2025

/ok-to-test

@dims
Copy link
Contributor Author

dims commented Jan 14, 2025

thanks @ivanvc

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 88.37209% with 5 lines in your changes missing coverage. Please review.

Project coverage is 68.88%. Comparing base (5d47d7f) to head (742ce69).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
server/etcdmain/grpc_proxy.go 0.00% 4 Missing ⚠️
server/etcdserver/api/v3rpc/metrics.go 96.55% 1 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
server/config/config.go 80.23% <ø> (ø)
server/embed/etcd.go 76.16% <100.00%> (+0.30%) ⬆️
server/etcdserver/api/v3rpc/grpc.go 100.00% <100.00%> (ø)
server/etcdserver/api/v3rpc/metrics.go 97.05% <96.55%> (-2.95%) ⬇️
server/etcdmain/grpc_proxy.go 14.44% <0.00%> (-0.08%) ⬇️

... and 27 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #19195      +/-   ##
==========================================
+ Coverage   68.76%   68.88%   +0.12%     
==========================================
  Files         420      420              
  Lines       35650    35686      +36     
==========================================
+ Hits        24514    24584      +70     
+ Misses       9714     9684      -30     
+ Partials     1422     1418       -4     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d47d7f...742ce69. Read the comment docs.

@dims
Copy link
Contributor Author

dims commented Jan 14, 2025

/test pull-etcd-integration-2-cpu-amd64

@dims
Copy link
Contributor Author

dims commented Jan 15, 2025

/assign @ahrtr @serathius

server/embed/etcd.go Outdated Show resolved Hide resolved
@ahrtr
Copy link
Member

ahrtr commented Jan 15, 2025

Thanks @dims for the PR.

I did some sanity test on this PR, and compared it with the existing main branch.

  • Confirmed that this PR can generate the same gRPC counter metrics as the existing main branch, including
    • grpc_server_handled_total
    • grpc_server_msg_received_total
    • grpc_server_msg_sent_total
    • grpc_server_started_total
  • It couldn't generate the histograms metrics, but the existing main branch can.
    • grpc_server_handling_seconds_bucket
    • grpc_server_handling_seconds_count
    • grpc_server_handling_seconds_sum

Also references:

@serathius
Copy link
Member

Do we need a test to confirm that no metric was removed?

…pc-middleware/providers/prometheus

Signed-off-by: Davanum Srinivas <[email protected]>
@dims
Copy link
Contributor Author

dims commented Jan 17, 2025

It couldn't generate the histograms metrics, but the existing main branch can.
grpc_server_handling_seconds_bucket
grpc_server_handling_seconds_count
grpc_server_handling_seconds_sum

@ahrtr did you run with --metrics 'extensive' option? or let it default to 'basic'?

@dims
Copy link
Contributor Author

dims commented Jan 17, 2025

Do we need a test to confirm that no metric was removed?

i think so for future-proofing!

@ahrtr
Copy link
Member

ahrtr commented Jan 17, 2025

@ahrtr did you run with --metrics 'extensive' option?

YES, I executed the same command on this PR and the main branch. The main branch was working as expected, but this PR did not generate the histograms metrics.

@dims dims force-pushed the switch-from-grpc-ecosystem/go-grpc-prometheus-to-grpc-ecosystem/go-grpc-middleware/providers/prometheus-take-2 branch from f80c5b2 to 03554ca Compare January 17, 2025 19:44
@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dims
Once this PR has been reviewed and has the lgtm label, please ask for approval from ahrtr. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@dims
Copy link
Contributor Author

dims commented Jan 17, 2025

@ahrtr found the issue and hopefully fixed it. Added a test as well. However, please check if i broke anything in the process of threading the option through to both the test suite and the main binary.

@dims dims force-pushed the switch-from-grpc-ecosystem/go-grpc-prometheus-to-grpc-ecosystem/go-grpc-middleware/providers/prometheus-take-2 branch 2 times, most recently from cafe302 to d3fe3e2 Compare January 17, 2025 20:09
@dims
Copy link
Contributor Author

dims commented Jan 17, 2025

/test pull-etcd-integration-2-cpu-amd64

@dims dims force-pushed the switch-from-grpc-ecosystem/go-grpc-prometheus-to-grpc-ecosystem/go-grpc-middleware/providers/prometheus-take-2 branch 3 times, most recently from f1e0118 to c4bed32 Compare January 17, 2025 23:00
@dims
Copy link
Contributor Author

dims commented Jan 17, 2025

/test pull-etcd-robustness-arm64

@dims
Copy link
Contributor Author

dims commented Jan 17, 2025

Do we need a test to confirm that no metric was removed?

@serathius Done! see new test case. If there are other metrics we can trigger them and then add to the list.

@dims dims force-pushed the switch-from-grpc-ecosystem/go-grpc-prometheus-to-grpc-ecosystem/go-grpc-middleware/providers/prometheus-take-2 branch 3 times, most recently from debfc85 to efbc3fc Compare January 18, 2025 03:40
@dims dims force-pushed the switch-from-grpc-ecosystem/go-grpc-prometheus-to-grpc-ecosystem/go-grpc-middleware/providers/prometheus-take-2 branch from efbc3fc to 742ce69 Compare January 18, 2025 03:42
@@ -177,3 +181,189 @@ func getHTTPBodyAsLines(t *testing.T, url string) []string {
resp.Body.Close()
return lines
}

func TestAllMetricsGenerated(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

The test is large already, can you move the test to separate PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants