-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
server,tests: add additional lease metrics and test #18711
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,11 +49,58 @@ var ( | |
// 1 second -> 3 months | ||
Buckets: prometheus.ExponentialBuckets(1, 2, 24), | ||
}) | ||
|
||
leaseAttached = prometheus.NewCounter(prometheus.CounterOpts{ | ||
Namespace: "etcd_debugging", | ||
Subsystem: "lease", | ||
Name: "attach_total", | ||
Help: "The number of leases that are attached to a lease item.", | ||
}) | ||
|
||
leaseDetached = prometheus.NewCounter(prometheus.CounterOpts{ | ||
Namespace: "etcd_debugging", | ||
Subsystem: "lease", | ||
Name: "detach_total", | ||
Help: "The number of leases that are detached from a lease item.", | ||
}) | ||
Comment on lines
+53
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like we can consolidate the two metrics (leaseAttached and leaseDetached) into one something like below,
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have enough background about cardinality but my understanding is that, adding a key multiplies the cardinalities. But if not, then the idea sounds good. @ahrtr thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, it's true. Indeed, It isn't a good idea to add label "lease_id". The prometheus official document clearly clarifies it https://prometheus.io/docs/practices/naming/#labels There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have background in metrics cardinality. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This seems like a good idea. Thoughts? @serathius
Logs are great but sometimes it's difficult to miss a trend, when there's log. Makes it easier to setup a trigger based on logs, than the trend of metrics, if that makes sense. |
||
|
||
initLeaseCount = prometheus.NewCounter(prometheus.CounterOpts{ | ||
Namespace: "etcd_debugging", | ||
Subsystem: "lease", | ||
Name: "initial_lease_count", | ||
Help: "Reports an initial lease count.", | ||
}) | ||
|
||
leaseGrantError = prometheus.NewGaugeVec(prometheus.GaugeOpts{ | ||
Namespace: "etcd_debugging", | ||
Subsystem: "lease", | ||
Name: "grant_errors", | ||
Help: "Error count by type to count for lease grants.", | ||
}, []string{"error"}) | ||
|
||
leaseRevokeError = prometheus.NewGaugeVec(prometheus.GaugeOpts{ | ||
Namespace: "etcd_debugging", | ||
Subsystem: "lease", | ||
Name: "revoke_errors", | ||
Help: "Error count by type to count for lease revokes.", | ||
}, []string{"error"}) | ||
|
||
leaseRenewError = prometheus.NewGaugeVec(prometheus.GaugeOpts{ | ||
Namespace: "etcd_debugging", | ||
Subsystem: "lease", | ||
Name: "renew_errors", | ||
Help: "Error count by type to count for lease renewals.", | ||
}, []string{"error"}) | ||
) | ||
|
||
func init() { | ||
prometheus.MustRegister(leaseGranted) | ||
prometheus.MustRegister(leaseRevoked) | ||
prometheus.MustRegister(leaseRenewed) | ||
prometheus.MustRegister(leaseTotalTTLs) | ||
prometheus.MustRegister(leaseAttached) | ||
prometheus.MustRegister(leaseDetached) | ||
prometheus.MustRegister(leaseGrantError) | ||
prometheus.MustRegister(leaseRevokeError) | ||
prometheus.MustRegister(leaseRenewError) | ||
} |
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.
What's the purpose of metrics about lease attachements? What you are trying to measure? number of keys per lease?
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.
Precisely, yes.