{"action":"created","comment":{"url":"https://api.github.com/repos/optimizely/tcollector/pulls/comments/23569199","id":23569199,"diff_hunk":"@@ -16,23 +21,23 @@ def format_tsd_key(metric_key, metric_value, timestamp, tags={}):\n     output = '{} {} {} {}'.format(metric_key, timestamp, metric_value, expanded_tags)\n     return output\n \n-def format_kafka_broker_offset_tsd_key(topic, partition, offset):\n+def format_kafka_broker_offset_tsd_key(env, topic, partition, offset):\n     metric = 'kafka.broker.offset'\n-    tags = dict(topic=topic, partition=partition)\n+    tags = dict(env=env, topic=topic, partition=partition)\n     timestamp = int(time.time())\n     return format_tsd_key(metric, offset, timestamp, tags)\n \n \n-def format_kafka_consumer_lag_tsd_key(consumer_group, topic, lag):\n+def format_kafka_consumer_lag_tsd_key(env, consumer_group, topic, lag):\n     metric = 'kafka.lag'\n-    tags = dict(consumer_group=consumer_group, topic=topic)\n+    tags = dict(env=env, consumer_group=consumer_group, topic=topic)\n     timestamp = int(time.time())\n     return format_tsd_key(metric, lag, timestamp, tags)\n \n \n-def format_kafka_consumer_offset_tsd_key(consumer_group, topic, partition, offset):\n+def format_kafka_consumer_offset_tsd_key(env, consumer_group, topic, partition, offset):\n     metric = 'kafka.consumer.offset'\n-    tags = dict(consumer_group=consumer_group, topic=topic, partition=partition)\n+    tags = dict(env=env, consumer_group=consumer_group, topic=topic, partition=partition)\n     timestamp = int(time.time())\n     return format_tsd_key(metric, offset, timestamp, tags)","path":"collectors/30/kafka_offset_collector.py","position":46,"original_position":46,"commit_id":"efc0fc02a6d3d3dcd19eae2195dacffb1150e200","original_commit_id":"efc0fc02a6d3d3dcd19eae2195dacffb1150e200","user":{"login":"dogaan","id":1986349,"avatar_url":"https://avatars.githubusercontent.com/u/1986349?v=3","gravatar_id":"","url":"https://api.github.com/users/dogaan","html_url":"https://github.com/dogaan","followers_url":"https://api.github.com/users/dogaan/followers","following_url":"https://api.github.com/users/dogaan/following{/other_user}","gists_url":"https://api.github.com/users/dogaan/gists{/gist_id}","starred_url":"https://api.github.com/users/dogaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dogaan/subscriptions","organizations_url":"https://api.github.com/users/dogaan/orgs","repos_url":"https://api.github.com/users/dogaan/repos","events_url":"https://api.github.com/users/dogaan/events{/privacy}","received_events_url":"https://api.github.com/users/dogaan/received_events","type":"User","site_admin":false},"body":"I think getting rid of these helper methods and calling `format_tsd_key` directly would be a good idea since they're all doing the same thing. \r\nIt would also make it easier to see where each metric is being reported from. \r\n(They all have 1 caller each so there isn't any code reuse.)","created_at":"2015-01-26T22:12:21Z","updated_at":"2015-01-26T22:12:21Z","html_url":"https://github.com/optimizely/tcollector/pull/28#discussion_r23569199","pull_request_url":"https://api.github.com/repos/optimizely/tcollector/pulls/28","_links":{"self":{"href":"https://api.github.com/repos/optimizely/tcollector/pulls/comments/23569199"},"html":{"href":"https://github.com/optimizely/tcollector/pull/28#discussion_r23569199"},"pull_request":{"href":"https://api.github.com/repos/optimizely/tcollector/pulls/28"}}},"pull_request":{"url":"https://api.github.com/repos/optimizely/tcollector/pulls/28","id":27547606,"html_url":"https://github.com/optimizely/tcollector/pull/28","diff_url":"https://github.com/optimizely/tcollector/pull/28.diff","patch_url":"https://github.com/optimizely/tcollector/pull/28.patch","issue_url":"https://api.github.com/repos/optimizely/tcollector/issues/28","number":28,"state":"open","locked":false,"title":"added storm kafka progress","user":{"login":"neilfulwiler","id":1045029,"avatar_url":"https://avatars.githubusercontent.com/u/1045029?v=3","gravatar_id":"","url":"https://api.github.com/users/neilfulwiler","html_url":"https://github.com/neilfulwiler","followers_url":"https://api.github.com/users/neilfulwiler/followers","following_url":"https://api.github.com/users/neilfulwiler/following{/other_user}","gists_url":"https://api.github.com/users/neilfulwiler/gists{/gist_id}","starred_url":"https://api.github.com/users/neilfulwiler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilfulwiler/subscriptions","organizations_url":"https://api.github.com/users/neilfulwiler/orgs","repos_url":"https://api.github.com/users/neilfulwiler/repos","events_url":"https://api.github.com/users/neilfulwiler/events{/privacy}","received_events_url":"https://api.github.com/users/neilfulwiler/received_events","type":"User","site_admin":false},"body":"@mdodsworth some super ugly monitoring for storm lag - which actually doesn't look the same as other kafka consumer lags","created_at":"2015-01-17T00:32:19Z","updated_at":"2015-01-26T22:12:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f9f1775e04b5662cd13de11ccd76aa5bd341993","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/optimizely/tcollector/pulls/28/commits","review_comments_url":"https://api.github.com/repos/optimizely/tcollector/pulls/28/comments","review_comment_url":"https://api.github.com/repos/optimizely/tcollector/pulls/comments/{number}","comments_url":"https://api.github.com/repos/optimizely/tcollector/issues/28/comments","statuses_url":"https://api.github.com/repos/optimizely/tcollector/statuses/efc0fc02a6d3d3dcd19eae2195dacffb1150e200","head":{"label":"optimizely:monitor-kafka-storm-lag","ref":"monitor-kafka-storm-lag","sha":"efc0fc02a6d3d3dcd19eae2195dacffb1150e200","user":{"login":"optimizely","id":1274132,"avatar_url":"https://avatars.githubusercontent.com/u/1274132?v=3","gravatar_id":"","url":"https://api.github.com/users/optimizely","html_url":"https://github.com/optimizely","followers_url":"https://api.github.com/users/optimizely/followers","following_url":"https://api.github.com/users/optimizely/following{/other_user}","gists_url":"https://api.github.com/users/optimizely/gists{/gist_id}","starred_url":"https://api.github.com/users/optimizely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimizely/subscriptions","organizations_url":"https://api.github.com/users/optimizely/orgs","repos_url":"https://api.github.com/users/optimizely/repos","events_url":"https://api.github.com/users/optimizely/events{/privacy}","received_events_url":"https://api.github.com/users/optimizely/received_events","type":"Organization","site_admin":false},"repo":{"id":13505232,"name":"tcollector","full_name":"optimizely/tcollector","owner":{"login":"optimizely","id":1274132,"avatar_url":"https://avatars.githubusercontent.com/u/1274132?v=3","gravatar_id":"","url":"https://api.github.com/users/optimizely","html_url":"https://github.com/optimizely","followers_url":"https://api.github.com/users/optimizely/followers","following_url":"https://api.github.com/users/optimizely/following{/other_user}","gists_url":"https://api.github.com/users/optimizely/gists{/gist_id}","starred_url":"https://api.github.com/users/optimizely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimizely/subscriptions","organizations_url":"https://api.github.com/users/optimizely/orgs","repos_url":"https://api.github.com/users/optimizely/repos","events_url":"https://api.github.com/users/optimizely/events{/privacy}","received_events_url":"https://api.github.com/users/optimizely/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/optimizely/tcollector","description":"Data collection framework for OpenTSDB","fork":true,"url":"https://api.github.com/repos/optimizely/tcollector","forks_url":"https://api.github.com/repos/optimizely/tcollector/forks","keys_url":"https://api.github.com/repos/optimizely/tcollector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optimizely/tcollector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optimizely/tcollector/teams","hooks_url":"https://api.github.com/repos/optimizely/tcollector/hooks","issue_events_url":"https://api.github.com/repos/optimizely/tcollector/issues/events{/number}","events_url":"https://api.github.com/repos/optimizely/tcollector/events","assignees_url":"https://api.github.com/repos/optimizely/tcollector/assignees{/user}","branches_url":"https://api.github.com/repos/optimizely/tcollector/branches{/branch}","tags_url":"https://api.github.com/repos/optimizely/tcollector/tags","blobs_url":"https://api.github.com/repos/optimizely/tcollector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optimizely/tcollector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optimizely/tcollector/git/refs{/sha}","trees_url":"https://api.github.com/repos/optimizely/tcollector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optimizely/tcollector/statuses/{sha}","languages_url":"https://api.github.com/repos/optimizely/tcollector/languages","stargazers_url":"https://api.github.com/repos/optimizely/tcollector/stargazers","contributors_url":"https://api.github.com/repos/optimizely/tcollector/contributors","subscribers_url":"https://api.github.com/repos/optimizely/tcollector/subscribers","subscription_url":"https://api.github.com/repos/optimizely/tcollector/subscription","commits_url":"https://api.github.com/repos/optimizely/tcollector/commits{/sha}","git_commits_url":"https://api.github.com/repos/optimizely/tcollector/git/commits{/sha}","comments_url":"https://api.github.com/repos/optimizely/tcollector/comments{/number}","issue_comment_url":"https://api.github.com/repos/optimizely/tcollector/issues/comments/{number}","contents_url":"https://api.github.com/repos/optimizely/tcollector/contents/{+path}","compare_url":"https://api.github.com/repos/optimizely/tcollector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optimizely/tcollector/merges","archive_url":"https://api.github.com/repos/optimizely/tcollector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optimizely/tcollector/downloads","issues_url":"https://api.github.com/repos/optimizely/tcollector/issues{/number}","pulls_url":"https://api.github.com/repos/optimizely/tcollector/pulls{/number}","milestones_url":"https://api.github.com/repos/optimizely/tcollector/milestones{/number}","notifications_url":"https://api.github.com/repos/optimizely/tcollector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optimizely/tcollector/labels{/name}","releases_url":"https://api.github.com/repos/optimizely/tcollector/releases{/id}","created_at":"2013-10-11T17:35:33Z","updated_at":"2014-06-25T22:42:08Z","pushed_at":"2015-01-24T00:04:23Z","git_url":"git://github.com/optimizely/tcollector.git","ssh_url":"git@github.com:optimizely/tcollector.git","clone_url":"https://github.com/optimizely/tcollector.git","svn_url":"https://github.com/optimizely/tcollector","homepage":"http://opentsdb.net","size":1072,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":0,"default_branch":"master"}},"base":{"label":"optimizely:master","ref":"master","sha":"3577fb06fd71f0a751143e6e7aa57dfe73fe0f39","user":{"login":"optimizely","id":1274132,"avatar_url":"https://avatars.githubusercontent.com/u/1274132?v=3","gravatar_id":"","url":"https://api.github.com/users/optimizely","html_url":"https://github.com/optimizely","followers_url":"https://api.github.com/users/optimizely/followers","following_url":"https://api.github.com/users/optimizely/following{/other_user}","gists_url":"https://api.github.com/users/optimizely/gists{/gist_id}","starred_url":"https://api.github.com/users/optimizely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimizely/subscriptions","organizations_url":"https://api.github.com/users/optimizely/orgs","repos_url":"https://api.github.com/users/optimizely/repos","events_url":"https://api.github.com/users/optimizely/events{/privacy}","received_events_url":"https://api.github.com/users/optimizely/received_events","type":"Organization","site_admin":false},"repo":{"id":13505232,"name":"tcollector","full_name":"optimizely/tcollector","owner":{"login":"optimizely","id":1274132,"avatar_url":"https://avatars.githubusercontent.com/u/1274132?v=3","gravatar_id":"","url":"https://api.github.com/users/optimizely","html_url":"https://github.com/optimizely","followers_url":"https://api.github.com/users/optimizely/followers","following_url":"https://api.github.com/users/optimizely/following{/other_user}","gists_url":"https://api.github.com/users/optimizely/gists{/gist_id}","starred_url":"https://api.github.com/users/optimizely/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimizely/subscriptions","organizations_url":"https://api.github.com/users/optimizely/orgs","repos_url":"https://api.github.com/users/optimizely/repos","events_url":"https://api.github.com/users/optimizely/events{/privacy}","received_events_url":"https://api.github.com/users/optimizely/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/optimizely/tcollector","description":"Data collection framework for OpenTSDB","fork":true,"url":"https://api.github.com/repos/optimizely/tcollector","forks_url":"https://api.github.com/repos/optimizely/tcollector/forks","keys_url":"https://api.github.com/repos/optimizely/tcollector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optimizely/tcollector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optimizely/tcollector/teams","hooks_url":"https://api.github.com/repos/optimizely/tcollector/hooks","issue_events_url":"https://api.github.com/repos/optimizely/tcollector/issues/events{/number}","events_url":"https://api.github.com/repos/optimizely/tcollector/events","assignees_url":"https://api.github.com/repos/optimizely/tcollector/assignees{/user}","branches_url":"https://api.github.com/repos/optimizely/tcollector/branches{/branch}","tags_url":"https://api.github.com/repos/optimizely/tcollector/tags","blobs_url":"https://api.github.com/repos/optimizely/tcollector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optimizely/tcollector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optimizely/tcollector/git/refs{/sha}","trees_url":"https://api.github.com/repos/optimizely/tcollector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optimizely/tcollector/statuses/{sha}","languages_url":"https://api.github.com/repos/optimizely/tcollector/languages","stargazers_url":"https://api.github.com/repos/optimizely/tcollector/stargazers","contributors_url":"https://api.github.com/repos/optimizely/tcollector/contributors","subscribers_url":"https://api.github.com/repos/optimizely/tcollector/subscribers","subscription_url":"https://api.github.com/repos/optimizely/tcollector/subscription","commits_url":"https://api.github.com/repos/optimizely/tcollector/commits{/sha}","git_commits_url":"https://api.github.com/repos/optimizely/tcollector/git/commits{/sha}","comments_url":"https://api.github.com/repos/optimizely/tcollector/comments{/number}","issue_comment_url":"https://api.github.com/repos/optimizely/tcollector/issues/comments/{number}","contents_url":"https://api.github.com/repos/optimizely/tcollector/contents/{+path}","compare_url":"https://api.github.com/repos/optimizely/tcollector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optimizely/tcollector/merges","archive_url":"https://api.github.com/repos/optimizely/tcollector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optimizely/tcollector/downloads","issues_url":"https://api.github.com/repos/optimizely/tcollector/issues{/number}","pulls_url":"https://api.github.com/repos/optimizely/tcollector/pulls{/number}","milestones_url":"https://api.github.com/repos/optimizely/tcollector/milestones{/number}","notifications_url":"https://api.github.com/repos/optimizely/tcollector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optimizely/tcollector/labels{/name}","releases_url":"https://api.github.com/repos/optimizely/tcollector/releases{/id}","created_at":"2013-10-11T17:35:33Z","updated_at":"2014-06-25T22:42:08Z","pushed_at":"2015-01-24T00:04:23Z","git_url":"git://github.com/optimizely/tcollector.git","ssh_url":"git@github.com:optimizely/tcollector.git","clone_url":"https://github.com/optimizely/tcollector.git","svn_url":"https://github.com/optimizely/tcollector","homepage":"http://opentsdb.net","size":1072,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/optimizely/tcollector/pulls/28"},"html":{"href":"https://github.com/optimizely/tcollector/pull/28"},"issue":{"href":"https://api.github.com/repos/optimizely/tcollector/issues/28"},"comments":{"href":"https://api.github.com/repos/optimizely/tcollector/issues/28/comments"},"review_comments":{"href":"https://api.github.com/repos/optimizely/tcollector/pulls/28/comments"},"review_comment":{"href":"https://api.github.com/repos/optimizely/tcollector/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/optimizely/tcollector/pulls/28/commits"},"statuses":{"href":"https://api.github.com/repos/optimizely/tcollector/statuses/efc0fc02a6d3d3dcd19eae2195dacffb1150e200"}}}}