-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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 etcd_debugging_lease_total gauge metric #17991
Conversation
Hi @jimmy-bro. 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 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. |
server/lease/metrics.go
Outdated
leaseTotal = prometheus.NewGauge(prometheus.GaugeOpts{ | ||
Namespace: "etcd_debugging", | ||
Subsystem: "lease", | ||
Name: "total", |
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‘m wondering if active_total
would be a more suitable name for this metric.
Cause i feel like this description is more precise.
Should I write unit tests? I'm willing to write unit tests for all the metrics in https://github.com/etcd-io/etcd/blob/main/server/lease/metrics.go |
server/lease/lessor.go
Outdated
@@ -303,6 +303,7 @@ func (le *lessor) Grant(id LeaseID, ttl int64) (*Lease, error) { | |||
|
|||
leaseTotalTTLs.Observe(float64(l.ttl)) | |||
leaseGranted.Inc() | |||
leaseTotal.Inc() |
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.
should leaseTotal Inc when etcdserver restart ? the lease may recover from backend in initAndRecover
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 your mentioning @gojoy ,I already updated the commit .
When it recover from backend, the metric will reset the value through leaseTotal.Set(float64(len(le.leaseMap)))
,
I used to considered doing leaseTotal.Inc()
inside the recover for-loop, but that would likely have a significant impact.
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.
LGTM
7040a17
to
f4c5e78
Compare
/ok-to-test |
Yes please include tests, refer to #17983 for examples of unit and integration metrics tests. |
/retest |
f27d39d
to
940f3ae
Compare
The feature was discussed in #17874