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

Obtain the lease id of a key, either via lease.put() or via separate api #151

Open
pdykes opened this issue Jun 6, 2021 · 2 comments
Open

Comments

@pdykes
Copy link

pdykes commented Jun 6, 2021

Thanks for much for your work.

One of our challenges debugging lease issues is not being able to correlate the created key via the lease put command.

a) For logging purposes, be useful to print out the lease id (visible later via etcdctl) of the lease used to create the item with the put command.
b) It would be useful if the lease creation provide the id of the lease that etcdctl sees, or had an api to get the key of a lease the key is associated with after the fact.
c) Lastly, it would be useful if etcdctl get command extracted the lease id with etcdctl if this could be passed on.

Thanks

@connor4312
Copy link
Member

For (a) and (b), you can use the lease.grant() method on the lease. This'll return the Id of the lease once the grant goes through.

I'm not clear what you're looking for in (c), can you explain a bit more?

@pdykes
Copy link
Author

pdykes commented Jun 30, 2021

Hi, sorry, was out on vacation. For c):

Be great if etcdctl is used with the get operator, and the variable is based against a lease, the following extra values other than the value be really nice (getting variables tied to leases is painful command sequence, especially for many of them):

Normal get:

etcdctl get /space/cache_testing/values/foo

/space/cache_testing/values/foo
99

(items in > are what etcdctl would return)

With extra function to show lease data, if variable created under lease:

etcdctl get /space/cache_testing/values/foo

/space/cache_testing/values/foo
99
lease: 3d524a18b6d14a5c
time to live: 250

Does that help?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants