{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/comments/44362546","id":44362546,"diff_hunk":"@@ -0,0 +1,454 @@\n+package consul\n+\n+import (\n+\t\"errors\"\n+\t\"fmt\"\n+\t\"strings\"\n+\t\"time\"\n+\n+\t\"github.com/armon/go-metrics\"\n+\t\"github.com/hashicorp/consul/consul/structs\"\n+)\n+\n+var (\n+\t// ErrQueryNotFound is returned if the query lookup failed.\n+\tErrQueryNotFound = errors.New(\"Query not found\")\n+)\n+\n+// Query manages the prepared query endpoint.\n+type Query struct {\n+\tsrv *Server\n+}\n+\n+// Apply is used to apply a modifying request to the data store. This should\n+// only be used for operations that modify the data.\n+func (q *Query) Apply(args *structs.QueryRequest, reply *struct{}) (err error) {\n+\tif done, err := q.srv.forward(\"Query.Apply\", args, args, reply); done {\n+\t\treturn err\n+\t}\n+\tdefer metrics.MeasureSince([]string{\"consul\", \"query\", \"apply\"}, time.Now())","path":"consul/query_endpoint.go","position":29,"original_position":29,"commit_id":"9b39b0998b5849509511bce4fdea353d1079178c","original_commit_id":"9b39b0998b5849509511bce4fdea353d1079178c","user":{"login":"armon","id":592032,"avatar_url":"https://avatars.githubusercontent.com/u/592032?v=3","gravatar_id":"","url":"https://api.github.com/users/armon","html_url":"https://github.com/armon","followers_url":"https://api.github.com/users/armon/followers","following_url":"https://api.github.com/users/armon/following{/other_user}","gists_url":"https://api.github.com/users/armon/gists{/gist_id}","starred_url":"https://api.github.com/users/armon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armon/subscriptions","organizations_url":"https://api.github.com/users/armon/orgs","repos_url":"https://api.github.com/users/armon/repos","events_url":"https://api.github.com/users/armon/events{/privacy}","received_events_url":"https://api.github.com/users/armon/received_events","type":"User","site_admin":false},"body":"Like this metric is going to be pretty confusing without deep insight","created_at":"2015-11-10T02:07:29Z","updated_at":"2015-11-10T02:07:29Z","html_url":"https://github.com/hashicorp/consul/pull/1389#discussion_r44362546","pull_request_url":"https://api.github.com/repos/hashicorp/consul/pulls/1389","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/comments/44362546"},"html":{"href":"https://github.com/hashicorp/consul/pull/1389#discussion_r44362546"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/1389"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/consul/pulls/1389","id":50029713,"html_url":"https://github.com/hashicorp/consul/pull/1389","diff_url":"https://github.com/hashicorp/consul/pull/1389.diff","patch_url":"https://github.com/hashicorp/consul/pull/1389.patch","issue_url":"https://api.github.com/repos/hashicorp/consul/issues/1389","number":1389,"state":"open","locked":false,"title":"Consul prepared queries","user":{"login":"slackpad","id":673509,"avatar_url":"https://avatars.githubusercontent.com/u/673509?v=3","gravatar_id":"","url":"https://api.github.com/users/slackpad","html_url":"https://github.com/slackpad","followers_url":"https://api.github.com/users/slackpad/followers","following_url":"https://api.github.com/users/slackpad/following{/other_user}","gists_url":"https://api.github.com/users/slackpad/gists{/gist_id}","starred_url":"https://api.github.com/users/slackpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slackpad/subscriptions","organizations_url":"https://api.github.com/users/slackpad/orgs","repos_url":"https://api.github.com/users/slackpad/repos","events_url":"https://api.github.com/users/slackpad/events{/privacy}","received_events_url":"https://api.github.com/users/slackpad/received_events","type":"User","site_admin":false},"body":"This isn't quite ready for a full review but I thought I'd post it so you guys can take a quick look to see where it's going. Here's a todo list:\r\n\r\n* [ ] Create unit tests for query_endpoint and test/iterate\r\n* [ ] Create a new HTTP endpoint with unit tests\r\n* [ ] Integrate with DNS and add unit tests\r\n* [ ] Add a few small unit tests marked as todos in the code\r\n* [ ] Write docs\r\n\r\nMost of these should be pretty quick once the first item is checked off. I'm going to rebase the last commit on there / force push, though the state store changes and the other commits up to the WIP one should be complete.","created_at":"2015-11-07T06:22:59Z","updated_at":"2015-11-10T02:07:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3c9d80e16f45c6e176178f084d5725a2e3e36a1b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/consul/pulls/1389/commits","review_comments_url":"https://api.github.com/repos/hashicorp/consul/pulls/1389/comments","review_comment_url":"https://api.github.com/repos/hashicorp/consul/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/consul/issues/1389/comments","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/9b39b0998b5849509511bce4fdea353d1079178c","head":{"label":"hashicorp:f-prepared-queries","ref":"f-prepared-queries","sha":"9b39b0998b5849509511bce4fdea353d1079178c","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":14125254,"name":"consul","full_name":"hashicorp/consul","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/consul","description":"Consul is a tool for service discovery, monitoring and configuration.","fork":false,"url":"https://api.github.com/repos/hashicorp/consul","forks_url":"https://api.github.com/repos/hashicorp/consul/forks","keys_url":"https://api.github.com/repos/hashicorp/consul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/consul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/consul/teams","hooks_url":"https://api.github.com/repos/hashicorp/consul/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/consul/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/consul/events","assignees_url":"https://api.github.com/repos/hashicorp/consul/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/consul/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/consul/tags","blobs_url":"https://api.github.com/repos/hashicorp/consul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/consul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/consul/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/consul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/consul/languages","stargazers_url":"https://api.github.com/repos/hashicorp/consul/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/consul/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/consul/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/consul/subscription","commits_url":"https://api.github.com/repos/hashicorp/consul/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/consul/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/consul/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/consul/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/consul/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/consul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/consul/merges","archive_url":"https://api.github.com/repos/hashicorp/consul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/consul/downloads","issues_url":"https://api.github.com/repos/hashicorp/consul/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/consul/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/consul/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/consul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/consul/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/consul/releases{/id}","created_at":"2013-11-04T22:15:27Z","updated_at":"2015-11-10T00:36:03Z","pushed_at":"2015-11-09T23:48:07Z","git_url":"git://github.com/hashicorp/consul.git","ssh_url":"git@github.com:hashicorp/consul.git","clone_url":"https://github.com/hashicorp/consul.git","svn_url":"https://github.com/hashicorp/consul","homepage":"http://www.consul.io","size":18505,"stargazers_count":4894,"watchers_count":4894,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":614,"mirror_url":null,"open_issues_count":339,"forks":614,"open_issues":339,"watchers":4894,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"cf1b9fe0741e373125e23c10af233a7f67427a68","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":14125254,"name":"consul","full_name":"hashicorp/consul","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/consul","description":"Consul is a tool for service discovery, monitoring and configuration.","fork":false,"url":"https://api.github.com/repos/hashicorp/consul","forks_url":"https://api.github.com/repos/hashicorp/consul/forks","keys_url":"https://api.github.com/repos/hashicorp/consul/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/consul/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/consul/teams","hooks_url":"https://api.github.com/repos/hashicorp/consul/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/consul/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/consul/events","assignees_url":"https://api.github.com/repos/hashicorp/consul/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/consul/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/consul/tags","blobs_url":"https://api.github.com/repos/hashicorp/consul/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/consul/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/consul/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/consul/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/consul/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/consul/languages","stargazers_url":"https://api.github.com/repos/hashicorp/consul/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/consul/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/consul/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/consul/subscription","commits_url":"https://api.github.com/repos/hashicorp/consul/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/consul/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/consul/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/consul/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/consul/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/consul/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/consul/merges","archive_url":"https://api.github.com/repos/hashicorp/consul/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/consul/downloads","issues_url":"https://api.github.com/repos/hashicorp/consul/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/consul/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/consul/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/consul/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/consul/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/consul/releases{/id}","created_at":"2013-11-04T22:15:27Z","updated_at":"2015-11-10T00:36:03Z","pushed_at":"2015-11-09T23:48:07Z","git_url":"git://github.com/hashicorp/consul.git","ssh_url":"git@github.com:hashicorp/consul.git","clone_url":"https://github.com/hashicorp/consul.git","svn_url":"https://github.com/hashicorp/consul","homepage":"http://www.consul.io","size":18505,"stargazers_count":4894,"watchers_count":4894,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":614,"mirror_url":null,"open_issues_count":339,"forks":614,"open_issues":339,"watchers":4894,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/1389"},"html":{"href":"https://github.com/hashicorp/consul/pull/1389"},"issue":{"href":"https://api.github.com/repos/hashicorp/consul/issues/1389"},"comments":{"href":"https://api.github.com/repos/hashicorp/consul/issues/1389/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/1389/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/consul/pulls/1389/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/consul/statuses/9b39b0998b5849509511bce4fdea353d1079178c"}}}}