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

feat: add etcd_debugging_lease_total gauge metric #17991

Closed
wants to merge 0 commits into from

Conversation

jimmy-bro
Copy link
Contributor

The feature was discussed in #17874

@k8s-ci-robot
Copy link

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 /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.

leaseTotal = prometheus.NewGauge(prometheus.GaugeOpts{
Namespace: "etcd_debugging",
Subsystem: "lease",
Name: "total",
Copy link
Contributor Author

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.

@jimmy-bro
Copy link
Contributor Author

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

@@ -303,6 +303,7 @@ func (le *lessor) Grant(id LeaseID, ttl int64) (*Lease, error) {

leaseTotalTTLs.Observe(float64(l.ttl))
leaseGranted.Inc()
leaseTotal.Inc()
Copy link

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

Copy link
Contributor Author

@jimmy-bro jimmy-bro May 14, 2024

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.

Copy link

Choose a reason for hiding this comment

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

LGTM

@jimmy-bro jimmy-bro force-pushed the metrics branch 4 times, most recently from 7040a17 to f4c5e78 Compare May 14, 2024 05:51
@jmhbnz
Copy link
Member

jmhbnz commented May 19, 2024

/ok-to-test

@jmhbnz
Copy link
Member

jmhbnz commented May 19, 2024

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

Yes please include tests, refer to #17983 for examples of unit and integration metrics tests.

@jmhbnz
Copy link
Member

jmhbnz commented May 22, 2024

/retest

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.

None yet

4 participants