{"action":"created","comment":{"url":"https://api.github.com/repos/tomwilkie/prometheus/pulls/comments/76102423","id":76102423,"diff_hunk":"@@ -205,3 +205,42 @@ func (c *consulClient) WatchPrefix(prefix string, factory func() interface{}, do\n \t\t}\n \t}\n }\n+\n+func (c *consulClient) PutBytes(key string, buf []byte) error {\n+\t_, err := c.kv.Put(&consul.KVPair{\n+\t\tKey:   key,\n+\t\tValue: buf,\n+\t}, &consul.WriteOptions{})\n+\treturn err\n+}\n+\n+type prefixedConsulClient struct {\n+\tprefix string\n+\tConsulClient","path":"frankenstein/consul_client.go","position":24,"original_position":24,"commit_id":"34fbcbdb8e6a8b103016996cf47f19ba929d9a3c","original_commit_id":"34fbcbdb8e6a8b103016996cf47f19ba929d9a3c","user":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"body":"In this case I wouldn't embed, but rather make it a private field.  That way we'll get compiler errors if someone adds a new method to ConsulClient but not to this.","created_at":"2016-08-24T17:32:55Z","updated_at":"2016-08-24T17:32:55Z","html_url":"https://github.com/tomwilkie/prometheus/pull/70#discussion_r76102423","pull_request_url":"https://api.github.com/repos/tomwilkie/prometheus/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/tomwilkie/prometheus/pulls/comments/76102423"},"html":{"href":"https://github.com/tomwilkie/prometheus/pull/70#discussion_r76102423"},"pull_request":{"href":"https://api.github.com/repos/tomwilkie/prometheus/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/tomwilkie/prometheus/pulls/70","id":82365060,"html_url":"https://github.com/tomwilkie/prometheus/pull/70","diff_url":"https://github.com/tomwilkie/prometheus/pull/70.diff","patch_url":"https://github.com/tomwilkie/prometheus/pull/70.patch","issue_url":"https://api.github.com/repos/tomwilkie/prometheus/issues/70","number":70,"state":"open","locked":false,"title":"Refactor ingester lifecycle code","user":{"login":"jml","id":125674,"avatar_url":"https://avatars.githubusercontent.com/u/125674?v=3","gravatar_id":"","url":"https://api.github.com/users/jml","html_url":"https://github.com/jml","followers_url":"https://api.github.com/users/jml/followers","following_url":"https://api.github.com/users/jml/following{/other_user}","gists_url":"https://api.github.com/users/jml/gists{/gist_id}","starred_url":"https://api.github.com/users/jml/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jml/subscriptions","organizations_url":"https://api.github.com/users/jml/orgs","repos_url":"https://api.github.com/users/jml/repos","events_url":"https://api.github.com/users/jml/events{/privacy}","received_events_url":"https://api.github.com/users/jml/received_events","type":"User","site_admin":false},"body":"Figuring out frankenstein code, and expressing my learning as refactoring:\r\n\r\n* move lifecycle code to separate file (out of `main` package)\r\n* add a `PutBytes` method to the `ConsulClient` interface\r\n* add a new `ConsulClient` implementation that prefixes keys with a constant prefix\r\n* split out \"this is how we describe the ingester\" logic from \"this is how we register/unregister\". The next (refactoring) step from here is an interface with `Register(desc IngesterDesc) error` and `Unregister(desc IngesterDesc) error` methods that hides consul.\n\n<!-- Reviewable:start -->\n---\nThis change is [<img src=\"https://reviewable.io/review_button.svg\" height=\"34\" align=\"absmiddle\" alt=\"Reviewable\"/>](https://reviewable.io/reviews/tomwilkie/prometheus/70)\n<!-- Reviewable:end -->\n","created_at":"2016-08-23T13:32:01Z","updated_at":"2016-08-24T17:32:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"54833a2a8adf245a73af35f8c9ed6af35db48cc5","assignee":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"assignees":[{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/tomwilkie/prometheus/pulls/70/commits","review_comments_url":"https://api.github.com/repos/tomwilkie/prometheus/pulls/70/comments","review_comment_url":"https://api.github.com/repos/tomwilkie/prometheus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tomwilkie/prometheus/issues/70/comments","statuses_url":"https://api.github.com/repos/tomwilkie/prometheus/statuses/34fbcbdb8e6a8b103016996cf47f19ba929d9a3c","head":{"label":"tomwilkie:ingester-lifecycle","ref":"ingester-lifecycle","sha":"34fbcbdb8e6a8b103016996cf47f19ba929d9a3c","user":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"repo":{"id":61650324,"name":"prometheus","full_name":"tomwilkie/prometheus","owner":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomwilkie/prometheus","description":"The Prometheus monitoring system and time series database.","fork":true,"url":"https://api.github.com/repos/tomwilkie/prometheus","forks_url":"https://api.github.com/repos/tomwilkie/prometheus/forks","keys_url":"https://api.github.com/repos/tomwilkie/prometheus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomwilkie/prometheus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomwilkie/prometheus/teams","hooks_url":"https://api.github.com/repos/tomwilkie/prometheus/hooks","issue_events_url":"https://api.github.com/repos/tomwilkie/prometheus/issues/events{/number}","events_url":"https://api.github.com/repos/tomwilkie/prometheus/events","assignees_url":"https://api.github.com/repos/tomwilkie/prometheus/assignees{/user}","branches_url":"https://api.github.com/repos/tomwilkie/prometheus/branches{/branch}","tags_url":"https://api.github.com/repos/tomwilkie/prometheus/tags","blobs_url":"https://api.github.com/repos/tomwilkie/prometheus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomwilkie/prometheus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomwilkie/prometheus/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomwilkie/prometheus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomwilkie/prometheus/statuses/{sha}","languages_url":"https://api.github.com/repos/tomwilkie/prometheus/languages","stargazers_url":"https://api.github.com/repos/tomwilkie/prometheus/stargazers","contributors_url":"https://api.github.com/repos/tomwilkie/prometheus/contributors","subscribers_url":"https://api.github.com/repos/tomwilkie/prometheus/subscribers","subscription_url":"https://api.github.com/repos/tomwilkie/prometheus/subscription","commits_url":"https://api.github.com/repos/tomwilkie/prometheus/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomwilkie/prometheus/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomwilkie/prometheus/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomwilkie/prometheus/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomwilkie/prometheus/contents/{+path}","compare_url":"https://api.github.com/repos/tomwilkie/prometheus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomwilkie/prometheus/merges","archive_url":"https://api.github.com/repos/tomwilkie/prometheus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomwilkie/prometheus/downloads","issues_url":"https://api.github.com/repos/tomwilkie/prometheus/issues{/number}","pulls_url":"https://api.github.com/repos/tomwilkie/prometheus/pulls{/number}","milestones_url":"https://api.github.com/repos/tomwilkie/prometheus/milestones{/number}","notifications_url":"https://api.github.com/repos/tomwilkie/prometheus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomwilkie/prometheus/labels{/name}","releases_url":"https://api.github.com/repos/tomwilkie/prometheus/releases{/id}","deployments_url":"https://api.github.com/repos/tomwilkie/prometheus/deployments","created_at":"2016-06-21T16:41:01Z","updated_at":"2016-06-21T16:41:03Z","pushed_at":"2016-08-23T15:03:13Z","git_url":"git://github.com/tomwilkie/prometheus.git","ssh_url":"git@github.com:tomwilkie/prometheus.git","clone_url":"https://github.com/tomwilkie/prometheus.git","svn_url":"https://github.com/tomwilkie/prometheus","homepage":"https://prometheus.io/","size":12822,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"frankenstein"}},"base":{"label":"tomwilkie:frankenstein","ref":"frankenstein","sha":"5a12900f921ab8b6c31ed3db4c540eb6d47be800","user":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"repo":{"id":61650324,"name":"prometheus","full_name":"tomwilkie/prometheus","owner":{"login":"tomwilkie","id":444037,"avatar_url":"https://avatars.githubusercontent.com/u/444037?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwilkie","html_url":"https://github.com/tomwilkie","followers_url":"https://api.github.com/users/tomwilkie/followers","following_url":"https://api.github.com/users/tomwilkie/following{/other_user}","gists_url":"https://api.github.com/users/tomwilkie/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwilkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwilkie/subscriptions","organizations_url":"https://api.github.com/users/tomwilkie/orgs","repos_url":"https://api.github.com/users/tomwilkie/repos","events_url":"https://api.github.com/users/tomwilkie/events{/privacy}","received_events_url":"https://api.github.com/users/tomwilkie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tomwilkie/prometheus","description":"The Prometheus monitoring system and time series database.","fork":true,"url":"https://api.github.com/repos/tomwilkie/prometheus","forks_url":"https://api.github.com/repos/tomwilkie/prometheus/forks","keys_url":"https://api.github.com/repos/tomwilkie/prometheus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tomwilkie/prometheus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tomwilkie/prometheus/teams","hooks_url":"https://api.github.com/repos/tomwilkie/prometheus/hooks","issue_events_url":"https://api.github.com/repos/tomwilkie/prometheus/issues/events{/number}","events_url":"https://api.github.com/repos/tomwilkie/prometheus/events","assignees_url":"https://api.github.com/repos/tomwilkie/prometheus/assignees{/user}","branches_url":"https://api.github.com/repos/tomwilkie/prometheus/branches{/branch}","tags_url":"https://api.github.com/repos/tomwilkie/prometheus/tags","blobs_url":"https://api.github.com/repos/tomwilkie/prometheus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tomwilkie/prometheus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tomwilkie/prometheus/git/refs{/sha}","trees_url":"https://api.github.com/repos/tomwilkie/prometheus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tomwilkie/prometheus/statuses/{sha}","languages_url":"https://api.github.com/repos/tomwilkie/prometheus/languages","stargazers_url":"https://api.github.com/repos/tomwilkie/prometheus/stargazers","contributors_url":"https://api.github.com/repos/tomwilkie/prometheus/contributors","subscribers_url":"https://api.github.com/repos/tomwilkie/prometheus/subscribers","subscription_url":"https://api.github.com/repos/tomwilkie/prometheus/subscription","commits_url":"https://api.github.com/repos/tomwilkie/prometheus/commits{/sha}","git_commits_url":"https://api.github.com/repos/tomwilkie/prometheus/git/commits{/sha}","comments_url":"https://api.github.com/repos/tomwilkie/prometheus/comments{/number}","issue_comment_url":"https://api.github.com/repos/tomwilkie/prometheus/issues/comments{/number}","contents_url":"https://api.github.com/repos/tomwilkie/prometheus/contents/{+path}","compare_url":"https://api.github.com/repos/tomwilkie/prometheus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tomwilkie/prometheus/merges","archive_url":"https://api.github.com/repos/tomwilkie/prometheus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tomwilkie/prometheus/downloads","issues_url":"https://api.github.com/repos/tomwilkie/prometheus/issues{/number}","pulls_url":"https://api.github.com/repos/tomwilkie/prometheus/pulls{/number}","milestones_url":"https://api.github.com/repos/tomwilkie/prometheus/milestones{/number}","notifications_url":"https://api.github.com/repos/tomwilkie/prometheus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tomwilkie/prometheus/labels{/name}","releases_url":"https://api.github.com/repos/tomwilkie/prometheus/releases{/id}","deployments_url":"https://api.github.com/repos/tomwilkie/prometheus/deployments","created_at":"2016-06-21T16:41:01Z","updated_at":"2016-06-21T16:41:03Z","pushed_at":"2016-08-23T15:03:13Z","git_url":"git://github.com/tomwilkie/prometheus.git","ssh_url":"git@github.com:tomwilkie/prometheus.git","clone_url":"https://github.com/tomwilkie/prometheus.git","svn_url":"https://github.com/tomwilkie/prometheus","homepage":"https://prometheus.io/","size":12822,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"frankenstein"}},"_links":{"self":{"href":"https://api.github.com/repos/tomwilkie/prometheus/pulls/70"},"html":{"href":"https://github.com/tomwilkie/prometheus/pull/70"},"issue":{"href":"https://api.github.com/repos/tomwilkie/prometheus/issues/70"},"comments":{"href":"https://api.github.com/repos/tomwilkie/prometheus/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/tomwilkie/prometheus/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/tomwilkie/prometheus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tomwilkie/prometheus/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/tomwilkie/prometheus/statuses/34fbcbdb8e6a8b103016996cf47f19ba929d9a3c"}}}}
{"actor":{"display_login":"tomwilkie"}}