-
Notifications
You must be signed in to change notification settings - Fork 62
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
Expose gRPC prometheus metrics #371
base: master
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: laozc 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 |
Hi @laozc. Thanks for your PR. I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, I left a few comments.
974e701
to
8adf0cf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments.
/ok-to-test
8adf0cf
to
536ab0d
Compare
65686bb
to
1d2293d
Compare
fdca099
to
8dc99b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wrote a few comments in the setup of the server and on inlining the code. The approach looks good to me, thanks.
pkg/server/metrics/metrics.go
Outdated
} | ||
} | ||
|
||
func ExportMetrics(metricsAddress string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Exported function should be documented.
cmd/csi-proxy/main.go
Outdated
|
||
enableMetrics := *metricsBindAddr != "" | ||
if enableMetrics { | ||
metrics.ExportMetrics(*metricsBindAddr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I want to enable metrics and by some reason ExportMetrics
fails then this line won't fail and continue silently.
What about metrics.ExportMetrics
returning an error that's checked while setting up CSI Proxy? I think we should panic with the error returned.
} | ||
l, err := net.Listen("tcp", metricsAddress) | ||
if err != nil { | ||
klog.Warningf("failed to get listener for metrics endpoint: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please return an error here.
pkg/server/metrics/metrics.go
Outdated
} | ||
} | ||
|
||
func ExportMetrics(metricsAddress string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is setting up a metrics server, what about naming it as such? e.g. SetupMetricsServer
pkg/server/metrics/metrics.go
Outdated
klog.Warningf("failed to get listener for metrics endpoint: %v", err) | ||
return | ||
} | ||
serve(l, serveMetrics) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to have an additional function? What about inlining the contents of serve
here? Same for inlining serveMetrics
What type of PR is this?
/kind feature
What this PR does / why we need it:
Expose gRPC prometheus metrics to capture performance for volume operations
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: