-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: Add metrics #53
base: main
Are you sure you want to change the base?
feat: Add metrics #53
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: AlexanderStocks 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 @AlexanderStocks. Thanks for your PR. I'm waiting for a kubernetes-sigs 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. |
/cc @nilekhc |
Initial setup feat: add metrics Undo changes for local testing
46243f8
to
aa85462
Compare
/ok-to-test |
PR needs rebase. 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. |
@AlexanderStocks: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
@AlexanderStocks Looks like tests are failing. Could you PTAL? |
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 rebase the PR, too.
@@ -0,0 +1,144 @@ | |||
package controller |
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.
Don't centralize metrics registering.
The common Kubernetes pattern in metrics for controllers is to delegate registering them to each controller package, like this for example:
https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/certificates/clustertrustbundlepublisher/metrics.go#L73-L78
You may want to implement your own Register()
function in pkg/metrics
.
I'd suggest you experimented with "k8s.io/component-base/metrics"
to see if it works well for the controller-runtime metrics registry.
@@ -1,10 +1,7 @@ | |||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= |
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.
separate commit for autogenerated changes, please
|
||
var ( | ||
wasSuccessfulKey = attribute.Key("successful") | ||
namespaceKey = attribute.Key("namespace") |
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.
Don't use metrics labels with unbounded value domain, this can easily lead to state explosion and thus DOSing of the prometheus registry (kubernetes/kubernetes#102523)
defer func() { | ||
wasSuccessful := err == nil | ||
if !wasSuccessful && strings.Contains(strings.ToLower(err.Error()), "validatingadmissionpolicy") { | ||
r.MetricReporter.ReportVAPDenyMetric(ctx, err.Error(), req.Namespace) |
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 am not that familiar with this repository. Why is ValidatingAdmissionPolicy deny any different from any other authorization failure?
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR adds metrics in the style of the CSI Driver to the sssc. Adds a service to access the metrics.
Which issue(s) this PR fixes:
Fixes #7
Special notes for your reviewer:
This currently does not include any test or documentation, let me know if/how you would like these added.
TODOs: