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

index / events API #2670

Closed
schmichael opened this issue Apr 13, 2015 · 4 comments
Closed

index / events API #2670

schmichael opened this issue Apr 13, 2015 · 4 comments

Comments

@schmichael
Copy link
Contributor

When debugging application interactions with etcd it's often useful to view events in index order instead of as a hierarchical tree of keys. Currently this history can be constructed through a sequence of watches which increment the waitIndex over the desired window.

For example if I want to know what happened between indexes 20 and 30:

http localhost:4001/v2/keys/ recursive==true waitIndex==20
http localhost:4001/v2/keys/ recursive==true waitIndex==21
http localhost:4001/v2/keys/ recursive==true waitIndex==22
...etc...
http localhost:4001/v2/keys/ recursive==true waitIndex==30

A new API to view a history for a given window could simplify this:

http localhost:4001/v2/index/ start==20 end==30
{
    "events": [
        {"index": 20, "action": ..., "node": ...},
        {"index": 21, "action": ..., "node": ...},
        ...
    ]
}

If the requested range is partially outside of etcd's window it would reply with all available events.

If the requested range is completely outside of etcd's window it would reply with a 401 error code like watches.

@xiang90
Copy link
Contributor

xiang90 commented Apr 15, 2015

Can you please take a look at the v3 api design? I think I have covered what you want there.

v2 API is kind of feature freeze.

@xiang90
Copy link
Contributor

xiang90 commented Apr 15, 2015

I pasted it here for you

message WatchRequest {
  optional bytes key = 1;
  optional bytes end_key = 2;
  // including
  optional int64 start_index = 3;
  // excluding
  optional int64 end_index = 4;
}

You can simply range over all the key space. And it will return you events in index order.

@kelseyhightower
Copy link
Contributor

@schmichael Thanks for the feedback here. As @xiang90 mentioned this is the direction we plan to take etcd in via the proposed v3 api.

@schmichael
Copy link
Contributor Author

Looking at #2675 it looks like WatchRequests will work for this case perfectly. I'll close this issue.

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

No branches or pull requests

3 participants