{"action":"created","comment":{"url":"https://api.github.com/repos/Clever/gearadmin/pulls/comments/25964864","id":25964864,"diff_hunk":"@@ -0,0 +1,61 @@\n+package main\n+\n+import (\n+\t\"flag\"\n+\t\"fmt\"\n+\t\"log\"\n+\t\"net\"\n+\t\"net/url\"\n+\t\"os\"\n+\t\"time\"\n+\n+\t\"github.com/Clever/gearadmin\"\n+\t\"gopkg.in/Clever/kayvee-go.v1\"\n+)\n+\n+func logMetrics(g gearadmin.GearmanAdmin) {\n+\tstatuses, err := g.Status()\n+\tif err != nil {\n+\t\tlog.Fatalf(\"error retrieving gearman status: %s\", err)\n+\t}\n+\tfor _, status := range statuses {\n+\t\tfmt.Println(kayvee.FormatLog(\"gearlogger\", \"info\", \"status\", map[string]interface{}{\n+\t\t\t\"type\":     \"gauge\",\n+\t\t\t\"function\": status.Function,\n+\t\t\t\"running\":  status.Running,\n+\t\t\t\"total\":    status.Total,\n+\t\t\t\"workers\":  status.AvailableWorkers,\n+\t\t}))\n+\t}\n+}\n+\n+func main() {\n+\thost := flag.String(\"host\", \"tcp://localhost:4730\", \"gearman host\")\n+\tinterval := flag.Duration(\"interval\", time.Minute, \"interval to log at\")\n+\tflag.Parse()\n+\n+\tvar gearmand *url.URL\n+\tvar err error\n+\tif os.Getenv(\"GEARMAN_HOST\") != \"\" {\n+\t\tgearmand, err = url.Parse(os.Getenv(\"GEARMAN_HOST\"))\n+\t} else {\n+\t\tgearmand, err = url.Parse(*host)\n+\t}\n+\n+\tif err != nil {\n+\t\tlog.Fatalf(\"error parsing gearman url %s: %s\", *host, err)","path":"cmd/gearlogger/main.go","position":null,"original_position":46,"commit_id":"3f871b96a58da36044774354236ac16b935e37e3","original_commit_id":"ab67f559c5fad3de9473705397bbe5082fa83092","user":{"login":"azylman","id":790102,"avatar_url":"https://avatars.githubusercontent.com/u/790102?v=3","gravatar_id":"","url":"https://api.github.com/users/azylman","html_url":"https://github.com/azylman","followers_url":"https://api.github.com/users/azylman/followers","following_url":"https://api.github.com/users/azylman/following{/other_user}","gists_url":"https://api.github.com/users/azylman/gists{/gist_id}","starred_url":"https://api.github.com/users/azylman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azylman/subscriptions","organizations_url":"https://api.github.com/users/azylman/orgs","repos_url":"https://api.github.com/users/azylman/repos","events_url":"https://api.github.com/users/azylman/events{/privacy}","received_events_url":"https://api.github.com/users/azylman/received_events","type":"User","site_admin":false},"body":"nice https://github.com/Clever/gearadmin/commit/3f871b96a58da36044774354236ac16b935e37e3","created_at":"2015-03-06T18:22:40Z","updated_at":"2015-03-06T18:22:40Z","html_url":"https://github.com/Clever/gearadmin/pull/5#discussion_r25964864","pull_request_url":"https://api.github.com/repos/Clever/gearadmin/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/Clever/gearadmin/pulls/comments/25964864"},"html":{"href":"https://github.com/Clever/gearadmin/pull/5#discussion_r25964864"},"pull_request":{"href":"https://api.github.com/repos/Clever/gearadmin/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/Clever/gearadmin/pulls/5","id":30609687,"html_url":"https://github.com/Clever/gearadmin/pull/5","diff_url":"https://github.com/Clever/gearadmin/pull/5.diff","patch_url":"https://github.com/Clever/gearadmin/pull/5.patch","issue_url":"https://api.github.com/repos/Clever/gearadmin/issues/5","number":5,"state":"open","locked":false,"title":"add gearlogger command","user":{"login":"azylman","id":790102,"avatar_url":"https://avatars.githubusercontent.com/u/790102?v=3","gravatar_id":"","url":"https://api.github.com/users/azylman","html_url":"https://github.com/azylman","followers_url":"https://api.github.com/users/azylman/followers","following_url":"https://api.github.com/users/azylman/following{/other_user}","gists_url":"https://api.github.com/users/azylman/gists{/gist_id}","starred_url":"https://api.github.com/users/azylman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azylman/subscriptions","organizations_url":"https://api.github.com/users/azylman/orgs","repos_url":"https://api.github.com/users/azylman/repos","events_url":"https://api.github.com/users/azylman/events{/privacy}","received_events_url":"https://api.github.com/users/azylman/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-06T00:11:32Z","updated_at":"2015-03-06T18:22:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"24f1e425e8a5158adafe34171c8ea59accf39612","assignee":{"login":"schimmy","id":603357,"avatar_url":"https://avatars.githubusercontent.com/u/603357?v=3","gravatar_id":"","url":"https://api.github.com/users/schimmy","html_url":"https://github.com/schimmy","followers_url":"https://api.github.com/users/schimmy/followers","following_url":"https://api.github.com/users/schimmy/following{/other_user}","gists_url":"https://api.github.com/users/schimmy/gists{/gist_id}","starred_url":"https://api.github.com/users/schimmy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schimmy/subscriptions","organizations_url":"https://api.github.com/users/schimmy/orgs","repos_url":"https://api.github.com/users/schimmy/repos","events_url":"https://api.github.com/users/schimmy/events{/privacy}","received_events_url":"https://api.github.com/users/schimmy/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/Clever/gearadmin/pulls/5/commits","review_comments_url":"https://api.github.com/repos/Clever/gearadmin/pulls/5/comments","review_comment_url":"https://api.github.com/repos/Clever/gearadmin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Clever/gearadmin/issues/5/comments","statuses_url":"https://api.github.com/repos/Clever/gearadmin/statuses/3f871b96a58da36044774354236ac16b935e37e3","head":{"label":"Clever:gearlogger","ref":"gearlogger","sha":"3f871b96a58da36044774354236ac16b935e37e3","user":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"repo":{"id":15888299,"name":"gearadmin","full_name":"Clever/gearadmin","owner":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Clever/gearadmin","description":"Go bindings to the gearman admin protocol.","fork":false,"url":"https://api.github.com/repos/Clever/gearadmin","forks_url":"https://api.github.com/repos/Clever/gearadmin/forks","keys_url":"https://api.github.com/repos/Clever/gearadmin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Clever/gearadmin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Clever/gearadmin/teams","hooks_url":"https://api.github.com/repos/Clever/gearadmin/hooks","issue_events_url":"https://api.github.com/repos/Clever/gearadmin/issues/events{/number}","events_url":"https://api.github.com/repos/Clever/gearadmin/events","assignees_url":"https://api.github.com/repos/Clever/gearadmin/assignees{/user}","branches_url":"https://api.github.com/repos/Clever/gearadmin/branches{/branch}","tags_url":"https://api.github.com/repos/Clever/gearadmin/tags","blobs_url":"https://api.github.com/repos/Clever/gearadmin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Clever/gearadmin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Clever/gearadmin/git/refs{/sha}","trees_url":"https://api.github.com/repos/Clever/gearadmin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Clever/gearadmin/statuses/{sha}","languages_url":"https://api.github.com/repos/Clever/gearadmin/languages","stargazers_url":"https://api.github.com/repos/Clever/gearadmin/stargazers","contributors_url":"https://api.github.com/repos/Clever/gearadmin/contributors","subscribers_url":"https://api.github.com/repos/Clever/gearadmin/subscribers","subscription_url":"https://api.github.com/repos/Clever/gearadmin/subscription","commits_url":"https://api.github.com/repos/Clever/gearadmin/commits{/sha}","git_commits_url":"https://api.github.com/repos/Clever/gearadmin/git/commits{/sha}","comments_url":"https://api.github.com/repos/Clever/gearadmin/comments{/number}","issue_comment_url":"https://api.github.com/repos/Clever/gearadmin/issues/comments{/number}","contents_url":"https://api.github.com/repos/Clever/gearadmin/contents/{+path}","compare_url":"https://api.github.com/repos/Clever/gearadmin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Clever/gearadmin/merges","archive_url":"https://api.github.com/repos/Clever/gearadmin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Clever/gearadmin/downloads","issues_url":"https://api.github.com/repos/Clever/gearadmin/issues{/number}","pulls_url":"https://api.github.com/repos/Clever/gearadmin/pulls{/number}","milestones_url":"https://api.github.com/repos/Clever/gearadmin/milestones{/number}","notifications_url":"https://api.github.com/repos/Clever/gearadmin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Clever/gearadmin/labels{/name}","releases_url":"https://api.github.com/repos/Clever/gearadmin/releases{/id}","created_at":"2014-01-14T01:45:48Z","updated_at":"2015-01-11T10:42:21Z","pushed_at":"2015-03-06T18:22:21Z","git_url":"git://github.com/Clever/gearadmin.git","ssh_url":"git@github.com:Clever/gearadmin.git","clone_url":"https://github.com/Clever/gearadmin.git","svn_url":"https://github.com/Clever/gearadmin","homepage":null,"size":252,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"Clever:master","ref":"master","sha":"24bb3bffb82cc94a5c2df192d483667130d55942","user":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"repo":{"id":15888299,"name":"gearadmin","full_name":"Clever/gearadmin","owner":{"login":"Clever","id":1885509,"avatar_url":"https://avatars.githubusercontent.com/u/1885509?v=3","gravatar_id":"","url":"https://api.github.com/users/Clever","html_url":"https://github.com/Clever","followers_url":"https://api.github.com/users/Clever/followers","following_url":"https://api.github.com/users/Clever/following{/other_user}","gists_url":"https://api.github.com/users/Clever/gists{/gist_id}","starred_url":"https://api.github.com/users/Clever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Clever/subscriptions","organizations_url":"https://api.github.com/users/Clever/orgs","repos_url":"https://api.github.com/users/Clever/repos","events_url":"https://api.github.com/users/Clever/events{/privacy}","received_events_url":"https://api.github.com/users/Clever/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Clever/gearadmin","description":"Go bindings to the gearman admin protocol.","fork":false,"url":"https://api.github.com/repos/Clever/gearadmin","forks_url":"https://api.github.com/repos/Clever/gearadmin/forks","keys_url":"https://api.github.com/repos/Clever/gearadmin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Clever/gearadmin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Clever/gearadmin/teams","hooks_url":"https://api.github.com/repos/Clever/gearadmin/hooks","issue_events_url":"https://api.github.com/repos/Clever/gearadmin/issues/events{/number}","events_url":"https://api.github.com/repos/Clever/gearadmin/events","assignees_url":"https://api.github.com/repos/Clever/gearadmin/assignees{/user}","branches_url":"https://api.github.com/repos/Clever/gearadmin/branches{/branch}","tags_url":"https://api.github.com/repos/Clever/gearadmin/tags","blobs_url":"https://api.github.com/repos/Clever/gearadmin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Clever/gearadmin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Clever/gearadmin/git/refs{/sha}","trees_url":"https://api.github.com/repos/Clever/gearadmin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Clever/gearadmin/statuses/{sha}","languages_url":"https://api.github.com/repos/Clever/gearadmin/languages","stargazers_url":"https://api.github.com/repos/Clever/gearadmin/stargazers","contributors_url":"https://api.github.com/repos/Clever/gearadmin/contributors","subscribers_url":"https://api.github.com/repos/Clever/gearadmin/subscribers","subscription_url":"https://api.github.com/repos/Clever/gearadmin/subscription","commits_url":"https://api.github.com/repos/Clever/gearadmin/commits{/sha}","git_commits_url":"https://api.github.com/repos/Clever/gearadmin/git/commits{/sha}","comments_url":"https://api.github.com/repos/Clever/gearadmin/comments{/number}","issue_comment_url":"https://api.github.com/repos/Clever/gearadmin/issues/comments{/number}","contents_url":"https://api.github.com/repos/Clever/gearadmin/contents/{+path}","compare_url":"https://api.github.com/repos/Clever/gearadmin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Clever/gearadmin/merges","archive_url":"https://api.github.com/repos/Clever/gearadmin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Clever/gearadmin/downloads","issues_url":"https://api.github.com/repos/Clever/gearadmin/issues{/number}","pulls_url":"https://api.github.com/repos/Clever/gearadmin/pulls{/number}","milestones_url":"https://api.github.com/repos/Clever/gearadmin/milestones{/number}","notifications_url":"https://api.github.com/repos/Clever/gearadmin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Clever/gearadmin/labels{/name}","releases_url":"https://api.github.com/repos/Clever/gearadmin/releases{/id}","created_at":"2014-01-14T01:45:48Z","updated_at":"2015-01-11T10:42:21Z","pushed_at":"2015-03-06T18:22:21Z","git_url":"git://github.com/Clever/gearadmin.git","ssh_url":"git@github.com:Clever/gearadmin.git","clone_url":"https://github.com/Clever/gearadmin.git","svn_url":"https://github.com/Clever/gearadmin","homepage":null,"size":252,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Clever/gearadmin/pulls/5"},"html":{"href":"https://github.com/Clever/gearadmin/pull/5"},"issue":{"href":"https://api.github.com/repos/Clever/gearadmin/issues/5"},"comments":{"href":"https://api.github.com/repos/Clever/gearadmin/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/Clever/gearadmin/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/Clever/gearadmin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Clever/gearadmin/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/Clever/gearadmin/statuses/3f871b96a58da36044774354236ac16b935e37e3"}}}}