{"action":"created","issue":{"url":"https://api.github.com/repos/coreos/etcd/issues/2670","labels_url":"https://api.github.com/repos/coreos/etcd/issues/2670/labels{/name}","comments_url":"https://api.github.com/repos/coreos/etcd/issues/2670/comments","events_url":"https://api.github.com/repos/coreos/etcd/issues/2670/events","html_url":"https://github.com/coreos/etcd/issues/2670","id":68208341,"number":2670,"title":"index / events API","user":{"login":"schmichael","id":113362,"avatar_url":"https://avatars.githubusercontent.com/u/113362?v=3","gravatar_id":"","url":"https://api.github.com/users/schmichael","html_url":"https://github.com/schmichael","followers_url":"https://api.github.com/users/schmichael/followers","following_url":"https://api.github.com/users/schmichael/following{/other_user}","gists_url":"https://api.github.com/users/schmichael/gists{/gist_id}","starred_url":"https://api.github.com/users/schmichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schmichael/subscriptions","organizations_url":"https://api.github.com/users/schmichael/orgs","repos_url":"https://api.github.com/users/schmichael/repos","events_url":"https://api.github.com/users/schmichael/events{/privacy}","received_events_url":"https://api.github.com/users/schmichael/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-13T22:30:08Z","updated_at":"2015-04-16T16:09:56Z","closed_at":"2015-04-16T16:09:56Z","body":"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.\r\n\r\nFor example if I want to know what happened between indexes 20 and 30:\r\n\r\n```\r\nhttp localhost:4001/v2/keys/ recursive==true waitIndex==20\r\nhttp localhost:4001/v2/keys/ recursive==true waitIndex==21\r\nhttp localhost:4001/v2/keys/ recursive==true waitIndex==22\r\n...etc...\r\nhttp localhost:4001/v2/keys/ recursive==true waitIndex==30\r\n```\r\n\r\nA new API to view a history for a given window could simplify this:\r\n\r\n```\r\nhttp localhost:4001/v2/index/ start==20 end==30\r\n```\r\n```json\r\n{\r\n    \"events\": [\r\n        {\"index\": 20, \"action\": ..., \"node\": ...},\r\n        {\"index\": 21, \"action\": ..., \"node\": ...},\r\n        ...\r\n    ]\r\n}\r\n```\r\n\r\nIf the requested range is *partially* outside of etcd's window it would reply with all available events.\r\n\r\nIf the requested range is *completely* outside of etcd's window it would reply with a 401 error code like watches."},"comment":{"url":"https://api.github.com/repos/coreos/etcd/issues/comments/93774030","html_url":"https://github.com/coreos/etcd/issues/2670#issuecomment-93774030","issue_url":"https://api.github.com/repos/coreos/etcd/issues/2670","id":93774030,"user":{"login":"schmichael","id":113362,"avatar_url":"https://avatars.githubusercontent.com/u/113362?v=3","gravatar_id":"","url":"https://api.github.com/users/schmichael","html_url":"https://github.com/schmichael","followers_url":"https://api.github.com/users/schmichael/followers","following_url":"https://api.github.com/users/schmichael/following{/other_user}","gists_url":"https://api.github.com/users/schmichael/gists{/gist_id}","starred_url":"https://api.github.com/users/schmichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schmichael/subscriptions","organizations_url":"https://api.github.com/users/schmichael/orgs","repos_url":"https://api.github.com/users/schmichael/repos","events_url":"https://api.github.com/users/schmichael/events{/privacy}","received_events_url":"https://api.github.com/users/schmichael/received_events","type":"User","site_admin":false},"created_at":"2015-04-16T16:09:55Z","updated_at":"2015-04-16T16:09:55Z","body":"Looking at #2675 it looks like WatchRequests will work for this case perfectly. I'll close this issue."}}