{"action":"created","comment":{"url":"https://api.github.com/repos/juju/utils/pulls/comments/42868584","id":42868584,"diff_hunk":"@@ -0,0 +1,96 @@\n+// Copyright 2015 Canonical Ltd.\n+// Licensed under the LGPLv3, see LICENCE file for details.\n+\n+package debugstatus\n+\n+import (\n+\t\"net/http\"\n+\n+\tpprof \"github.com/juju/httpprof\"\n+\t\"github.com/juju/httprequest\"\n+)\n+\n+// Version describes the current version of the code being run.\n+type Version struct {\n+\tGitCommit string\n+\tVersion   string\n+}\n+\n+// Handler implements a type that can be used with httprequest.Handlers\n+// to serve a standard set of /debug endpoints, including\n+// the version of the system, its current health status\n+// the runtime profiling information.\n+type Handler struct {\n+\t// Check will be called to obtain the current health of the\n+\t// system. It should return a map as returned from the\n+\t// Check function.\n+\tCheck func() map[string]CheckResult","path":"debugstatus/handler.go","position":27,"original_position":27,"commit_id":"57e61562a1dac2c050b10e3e88ddc2e726ea30d4","original_commit_id":"57e61562a1dac2c050b10e3e88ddc2e726ea30d4","user":{"login":"mhilton","id":1136018,"avatar_url":"https://avatars.githubusercontent.com/u/1136018?v=3","gravatar_id":"","url":"https://api.github.com/users/mhilton","html_url":"https://github.com/mhilton","followers_url":"https://api.github.com/users/mhilton/followers","following_url":"https://api.github.com/users/mhilton/following{/other_user}","gists_url":"https://api.github.com/users/mhilton/gists{/gist_id}","starred_url":"https://api.github.com/users/mhilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhilton/subscriptions","organizations_url":"https://api.github.com/users/mhilton/orgs","repos_url":"https://api.github.com/users/mhilton/repos","events_url":"https://api.github.com/users/mhilton/events{/privacy}","received_events_url":"https://api.github.com/users/mhilton/received_events","type":"User","site_admin":false},"body":"I think the Handler shouldn't require you to set all of these things to use it. If Check of CheckPprofAllowed is nil then we should do something that isn't panicking. /debug/check could just return an empty set (not sure if that should be considered successful or not) CheckPprofAllowed could just deny access.","created_at":"2015-10-23T14:11:31Z","updated_at":"2015-10-23T14:11:31Z","html_url":"https://github.com/juju/utils/pull/165#discussion_r42868584","pull_request_url":"https://api.github.com/repos/juju/utils/pulls/165","_links":{"self":{"href":"https://api.github.com/repos/juju/utils/pulls/comments/42868584"},"html":{"href":"https://github.com/juju/utils/pull/165#discussion_r42868584"},"pull_request":{"href":"https://api.github.com/repos/juju/utils/pulls/165"}}},"pull_request":{"url":"https://api.github.com/repos/juju/utils/pulls/165","id":48583593,"html_url":"https://github.com/juju/utils/pull/165","diff_url":"https://github.com/juju/utils/pull/165.diff","patch_url":"https://github.com/juju/utils/pull/165.patch","issue_url":"https://api.github.com/repos/juju/utils/issues/165","number":165,"state":"open","locked":false,"title":"debugstatus: add Handler","user":{"login":"rogpeppe","id":66491,"avatar_url":"https://avatars.githubusercontent.com/u/66491?v=3","gravatar_id":"","url":"https://api.github.com/users/rogpeppe","html_url":"https://github.com/rogpeppe","followers_url":"https://api.github.com/users/rogpeppe/followers","following_url":"https://api.github.com/users/rogpeppe/following{/other_user}","gists_url":"https://api.github.com/users/rogpeppe/gists{/gist_id}","starred_url":"https://api.github.com/users/rogpeppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogpeppe/subscriptions","organizations_url":"https://api.github.com/users/rogpeppe/orgs","repos_url":"https://api.github.com/users/rogpeppe/repos","events_url":"https://api.github.com/users/rogpeppe/events{/privacy}","received_events_url":"https://api.github.com/users/rogpeppe/received_events","type":"User","site_admin":false},"body":"This code is already in two services and rather than add it to a third, we factor\r\nit out to here.\n\n(Review request: http://reviews.vapour.ws/r/2990/)","created_at":"2015-10-23T14:03:06Z","updated_at":"2015-10-23T14:11:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb0d72a4a0938acb8e144990e7fe6a85b03748be","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/juju/utils/pulls/165/commits","review_comments_url":"https://api.github.com/repos/juju/utils/pulls/165/comments","review_comment_url":"https://api.github.com/repos/juju/utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/juju/utils/issues/165/comments","statuses_url":"https://api.github.com/repos/juju/utils/statuses/57e61562a1dac2c050b10e3e88ddc2e726ea30d4","head":{"label":"rogpeppe:014-debugstatus-handler","ref":"014-debugstatus-handler","sha":"57e61562a1dac2c050b10e3e88ddc2e726ea30d4","user":{"login":"rogpeppe","id":66491,"avatar_url":"https://avatars.githubusercontent.com/u/66491?v=3","gravatar_id":"","url":"https://api.github.com/users/rogpeppe","html_url":"https://github.com/rogpeppe","followers_url":"https://api.github.com/users/rogpeppe/followers","following_url":"https://api.github.com/users/rogpeppe/following{/other_user}","gists_url":"https://api.github.com/users/rogpeppe/gists{/gist_id}","starred_url":"https://api.github.com/users/rogpeppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogpeppe/subscriptions","organizations_url":"https://api.github.com/users/rogpeppe/orgs","repos_url":"https://api.github.com/users/rogpeppe/repos","events_url":"https://api.github.com/users/rogpeppe/events{/privacy}","received_events_url":"https://api.github.com/users/rogpeppe/received_events","type":"User","site_admin":false},"repo":{"id":20518343,"name":"juju-utils","full_name":"rogpeppe/juju-utils","owner":{"login":"rogpeppe","id":66491,"avatar_url":"https://avatars.githubusercontent.com/u/66491?v=3","gravatar_id":"","url":"https://api.github.com/users/rogpeppe","html_url":"https://github.com/rogpeppe","followers_url":"https://api.github.com/users/rogpeppe/followers","following_url":"https://api.github.com/users/rogpeppe/following{/other_user}","gists_url":"https://api.github.com/users/rogpeppe/gists{/gist_id}","starred_url":"https://api.github.com/users/rogpeppe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rogpeppe/subscriptions","organizations_url":"https://api.github.com/users/rogpeppe/orgs","repos_url":"https://api.github.com/users/rogpeppe/repos","events_url":"https://api.github.com/users/rogpeppe/events{/privacy}","received_events_url":"https://api.github.com/users/rogpeppe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rogpeppe/juju-utils","description":"General utility functions","fork":true,"url":"https://api.github.com/repos/rogpeppe/juju-utils","forks_url":"https://api.github.com/repos/rogpeppe/juju-utils/forks","keys_url":"https://api.github.com/repos/rogpeppe/juju-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rogpeppe/juju-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rogpeppe/juju-utils/teams","hooks_url":"https://api.github.com/repos/rogpeppe/juju-utils/hooks","issue_events_url":"https://api.github.com/repos/rogpeppe/juju-utils/issues/events{/number}","events_url":"https://api.github.com/repos/rogpeppe/juju-utils/events","assignees_url":"https://api.github.com/repos/rogpeppe/juju-utils/assignees{/user}","branches_url":"https://api.github.com/repos/rogpeppe/juju-utils/branches{/branch}","tags_url":"https://api.github.com/repos/rogpeppe/juju-utils/tags","blobs_url":"https://api.github.com/repos/rogpeppe/juju-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rogpeppe/juju-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rogpeppe/juju-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/rogpeppe/juju-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rogpeppe/juju-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/rogpeppe/juju-utils/languages","stargazers_url":"https://api.github.com/repos/rogpeppe/juju-utils/stargazers","contributors_url":"https://api.github.com/repos/rogpeppe/juju-utils/contributors","subscribers_url":"https://api.github.com/repos/rogpeppe/juju-utils/subscribers","subscription_url":"https://api.github.com/repos/rogpeppe/juju-utils/subscription","commits_url":"https://api.github.com/repos/rogpeppe/juju-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/rogpeppe/juju-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/rogpeppe/juju-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/rogpeppe/juju-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/rogpeppe/juju-utils/contents/{+path}","compare_url":"https://api.github.com/repos/rogpeppe/juju-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rogpeppe/juju-utils/merges","archive_url":"https://api.github.com/repos/rogpeppe/juju-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rogpeppe/juju-utils/downloads","issues_url":"https://api.github.com/repos/rogpeppe/juju-utils/issues{/number}","pulls_url":"https://api.github.com/repos/rogpeppe/juju-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/rogpeppe/juju-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/rogpeppe/juju-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rogpeppe/juju-utils/labels{/name}","releases_url":"https://api.github.com/repos/rogpeppe/juju-utils/releases{/id}","created_at":"2014-06-05T08:54:24Z","updated_at":"2015-09-02T21:30:32Z","pushed_at":"2015-10-23T14:02:38Z","git_url":"git://github.com/rogpeppe/juju-utils.git","ssh_url":"git@github.com:rogpeppe/juju-utils.git","clone_url":"https://github.com/rogpeppe/juju-utils.git","svn_url":"https://github.com/rogpeppe/juju-utils","homepage":null,"size":922,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"juju:master","ref":"master","sha":"1fc85d7f4bc5e885cc86f68bb6ac610efee5be38","user":{"login":"juju","id":4604548,"avatar_url":"https://avatars.githubusercontent.com/u/4604548?v=3","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"repo":{"id":20486959,"name":"utils","full_name":"juju/utils","owner":{"login":"juju","id":4604548,"avatar_url":"https://avatars.githubusercontent.com/u/4604548?v=3","gravatar_id":"","url":"https://api.github.com/users/juju","html_url":"https://github.com/juju","followers_url":"https://api.github.com/users/juju/followers","following_url":"https://api.github.com/users/juju/following{/other_user}","gists_url":"https://api.github.com/users/juju/gists{/gist_id}","starred_url":"https://api.github.com/users/juju/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juju/subscriptions","organizations_url":"https://api.github.com/users/juju/orgs","repos_url":"https://api.github.com/users/juju/repos","events_url":"https://api.github.com/users/juju/events{/privacy}","received_events_url":"https://api.github.com/users/juju/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/juju/utils","description":"General utility functions","fork":false,"url":"https://api.github.com/repos/juju/utils","forks_url":"https://api.github.com/repos/juju/utils/forks","keys_url":"https://api.github.com/repos/juju/utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/juju/utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/juju/utils/teams","hooks_url":"https://api.github.com/repos/juju/utils/hooks","issue_events_url":"https://api.github.com/repos/juju/utils/issues/events{/number}","events_url":"https://api.github.com/repos/juju/utils/events","assignees_url":"https://api.github.com/repos/juju/utils/assignees{/user}","branches_url":"https://api.github.com/repos/juju/utils/branches{/branch}","tags_url":"https://api.github.com/repos/juju/utils/tags","blobs_url":"https://api.github.com/repos/juju/utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/juju/utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/juju/utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/juju/utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/juju/utils/statuses/{sha}","languages_url":"https://api.github.com/repos/juju/utils/languages","stargazers_url":"https://api.github.com/repos/juju/utils/stargazers","contributors_url":"https://api.github.com/repos/juju/utils/contributors","subscribers_url":"https://api.github.com/repos/juju/utils/subscribers","subscription_url":"https://api.github.com/repos/juju/utils/subscription","commits_url":"https://api.github.com/repos/juju/utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/juju/utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/juju/utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/juju/utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/juju/utils/contents/{+path}","compare_url":"https://api.github.com/repos/juju/utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/juju/utils/merges","archive_url":"https://api.github.com/repos/juju/utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/juju/utils/downloads","issues_url":"https://api.github.com/repos/juju/utils/issues{/number}","pulls_url":"https://api.github.com/repos/juju/utils/pulls{/number}","milestones_url":"https://api.github.com/repos/juju/utils/milestones{/number}","notifications_url":"https://api.github.com/repos/juju/utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/juju/utils/labels{/name}","releases_url":"https://api.github.com/repos/juju/utils/releases{/id}","created_at":"2014-06-04T14:30:35Z","updated_at":"2015-10-17T18:18:32Z","pushed_at":"2015-10-23T14:03:06Z","git_url":"git://github.com/juju/utils.git","ssh_url":"git@github.com:juju/utils.git","clone_url":"https://github.com/juju/utils.git","svn_url":"https://github.com/juju/utils","homepage":null,"size":1772,"stargazers_count":31,"watchers_count":31,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":6,"forks":36,"open_issues":6,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/juju/utils/pulls/165"},"html":{"href":"https://github.com/juju/utils/pull/165"},"issue":{"href":"https://api.github.com/repos/juju/utils/issues/165"},"comments":{"href":"https://api.github.com/repos/juju/utils/issues/165/comments"},"review_comments":{"href":"https://api.github.com/repos/juju/utils/pulls/165/comments"},"review_comment":{"href":"https://api.github.com/repos/juju/utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/juju/utils/pulls/165/commits"},"statuses":{"href":"https://api.github.com/repos/juju/utils/statuses/57e61562a1dac2c050b10e3e88ddc2e726ea30d4"}}}}