{"action":"created","comment":{"url":"https://api.github.com/repos/grafana/grafana/pulls/comments/91493256","pull_request_review_id":12001130,"id":91493256,"diff_hunk":"@@ -0,0 +1,152 @@\n+package metrics\n+\n+import (\n+\t\"github.com/grafana/grafana/pkg/log\"\n+\t\"github.com/prometheus/client_golang/prometheus\"\n+\t\"net/http\"\n+\t\"strings\"\n+)\n+\n+const (\n+\tnamespace = \"grafana\"\n+\tsubsystem = \"backend\"\n+)\n+\n+type PrometheusPublisher struct {\n+\tCounterCollectors map[string]*prometheus.CounterVec\n+\tGaugeCollectors   map[string]*prometheus.GaugeVec\n+}\n+\n+func CreatePrometheusPublisher() (*PrometheusPublisher, error) {\n+\tgo func() {\n+\t\thttp.Handle(\"/metrics\", prometheus.Handler())\n+\t\terr := http.ListenAndServe(\":9200\", nil)","path":"pkg/metrics/prometheus.go","position":23,"original_position":23,"commit_id":"037bee950d7a1ea759e6970e0c15d9595ee7d8fd","original_commit_id":"037bee950d7a1ea759e6970e0c15d9595ee7d8fd","user":{"login":"torkelo","id":10999,"avatar_url":"https://avatars.githubusercontent.com/u/10999?v=3","gravatar_id":"","url":"https://api.github.com/users/torkelo","html_url":"https://github.com/torkelo","followers_url":"https://api.github.com/users/torkelo/followers","following_url":"https://api.github.com/users/torkelo/following{/other_user}","gists_url":"https://api.github.com/users/torkelo/gists{/gist_id}","starred_url":"https://api.github.com/users/torkelo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/torkelo/subscriptions","organizations_url":"https://api.github.com/users/torkelo/orgs","repos_url":"https://api.github.com/users/torkelo/repos","events_url":"https://api.github.com/users/torkelo/events{/privacy}","received_events_url":"https://api.github.com/users/torkelo/received_events","type":"User","site_admin":false},"body":"> It doesn't, but if you want to support multiple different monitoring systems it's a good choice.\r\n\r\nGreat so how do we do it without using the lib. The internal metrics lib already supports multiple publishers. \r\n\r\n> I wouldn't agree there. It's similar complexity math both ways.\r\nI do not agree with you there. Dealing with raw counters and roll ups is very in accurate. Can not getting accurate sums over time. At least not found any way to do with existing TSDS (unless you store counter deltas). I mean theoretically it just math, but actually working with existing systems and having the same query to query against recent high res data and the same query against a long time range (targeting roll up periods). But might be wrong. \r\n\r\n> That's not particularly useful data. Those look like Dropwizard metrics\r\nDropwizard?? Could you describe in what way they are not useful? They are missing sum you say, sum of all the timing measurements? How would that be useful? Maybe if we also had histogram buckets, but we don't so not seeing your point. Sorry very lost :) \r\n\r\nBut maybe better include histogram buckets, instead of pre calculated latencies as buckets can be aggregated if you have multiple grafana instances. \r\n\r\nHow do prometheus exporter consume timings from other systems? I would love to support prometheus out of the box but maybe better to have a node exporter plugin so it can scrape the metrics endpoint and process it however prometheus wants it :) \r\n\r\n\r\n\r\n\r\n","created_at":"2016-12-08T11:12:53Z","updated_at":"2016-12-08T11:12:53Z","html_url":"https://github.com/grafana/grafana/pull/6872#discussion_r91493256","pull_request_url":"https://api.github.com/repos/grafana/grafana/pulls/6872","_links":{"self":{"href":"https://api.github.com/repos/grafana/grafana/pulls/comments/91493256"},"html":{"href":"https://github.com/grafana/grafana/pull/6872#discussion_r91493256"},"pull_request":{"href":"https://api.github.com/repos/grafana/grafana/pulls/6872"}}},"pull_request":{"url":"https://api.github.com/repos/grafana/grafana/pulls/6872","id":97066170,"html_url":"https://github.com/grafana/grafana/pull/6872","diff_url":"https://github.com/grafana/grafana/pull/6872.diff","patch_url":"https://github.com/grafana/grafana/pull/6872.patch","issue_url":"https://api.github.com/repos/grafana/grafana/issues/6872","number":6872,"state":"open","locked":false,"title":"Prometheus metric publisher","user":{"login":"mtanda","id":224552,"avatar_url":"https://avatars.githubusercontent.com/u/224552?v=3","gravatar_id":"","url":"https://api.github.com/users/mtanda","html_url":"https://github.com/mtanda","followers_url":"https://api.github.com/users/mtanda/followers","following_url":"https://api.github.com/users/mtanda/following{/other_user}","gists_url":"https://api.github.com/users/mtanda/gists{/gist_id}","starred_url":"https://api.github.com/users/mtanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtanda/subscriptions","organizations_url":"https://api.github.com/users/mtanda/orgs","repos_url":"https://api.github.com/users/mtanda/repos","events_url":"https://api.github.com/users/mtanda/events{/privacy}","received_events_url":"https://api.github.com/users/mtanda/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/grafana/grafana/issues/6742.\r\n\r\nThis is a sample output.\r\nhttps://gist.github.com/mtanda/3668d7b74cff634310037b9bf8efdeb0","created_at":"2016-12-08T06:26:07Z","updated_at":"2016-12-08T11:12:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0e336860f74dd8d719b94344cbc86e6fc1da84ec","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/grafana/grafana/pulls/6872/commits","review_comments_url":"https://api.github.com/repos/grafana/grafana/pulls/6872/comments","review_comment_url":"https://api.github.com/repos/grafana/grafana/pulls/comments{/number}","comments_url":"https://api.github.com/repos/grafana/grafana/issues/6872/comments","statuses_url":"https://api.github.com/repos/grafana/grafana/statuses/037bee950d7a1ea759e6970e0c15d9595ee7d8fd","head":{"label":"mtanda:prometheus_metric_publisher","ref":"prometheus_metric_publisher","sha":"037bee950d7a1ea759e6970e0c15d9595ee7d8fd","user":{"login":"mtanda","id":224552,"avatar_url":"https://avatars.githubusercontent.com/u/224552?v=3","gravatar_id":"","url":"https://api.github.com/users/mtanda","html_url":"https://github.com/mtanda","followers_url":"https://api.github.com/users/mtanda/followers","following_url":"https://api.github.com/users/mtanda/following{/other_user}","gists_url":"https://api.github.com/users/mtanda/gists{/gist_id}","starred_url":"https://api.github.com/users/mtanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtanda/subscriptions","organizations_url":"https://api.github.com/users/mtanda/orgs","repos_url":"https://api.github.com/users/mtanda/repos","events_url":"https://api.github.com/users/mtanda/events{/privacy}","received_events_url":"https://api.github.com/users/mtanda/received_events","type":"User","site_admin":false},"repo":{"id":33287971,"name":"grafana","full_name":"mtanda/grafana","owner":{"login":"mtanda","id":224552,"avatar_url":"https://avatars.githubusercontent.com/u/224552?v=3","gravatar_id":"","url":"https://api.github.com/users/mtanda","html_url":"https://github.com/mtanda","followers_url":"https://api.github.com/users/mtanda/followers","following_url":"https://api.github.com/users/mtanda/following{/other_user}","gists_url":"https://api.github.com/users/mtanda/gists{/gist_id}","starred_url":"https://api.github.com/users/mtanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtanda/subscriptions","organizations_url":"https://api.github.com/users/mtanda/orgs","repos_url":"https://api.github.com/users/mtanda/repos","events_url":"https://api.github.com/users/mtanda/events{/privacy}","received_events_url":"https://api.github.com/users/mtanda/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mtanda/grafana","description":"Grafana - A Graphite & InfluxDB Dashboard and Graph Editor","fork":true,"url":"https://api.github.com/repos/mtanda/grafana","forks_url":"https://api.github.com/repos/mtanda/grafana/forks","keys_url":"https://api.github.com/repos/mtanda/grafana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mtanda/grafana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mtanda/grafana/teams","hooks_url":"https://api.github.com/repos/mtanda/grafana/hooks","issue_events_url":"https://api.github.com/repos/mtanda/grafana/issues/events{/number}","events_url":"https://api.github.com/repos/mtanda/grafana/events","assignees_url":"https://api.github.com/repos/mtanda/grafana/assignees{/user}","branches_url":"https://api.github.com/repos/mtanda/grafana/branches{/branch}","tags_url":"https://api.github.com/repos/mtanda/grafana/tags","blobs_url":"https://api.github.com/repos/mtanda/grafana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mtanda/grafana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mtanda/grafana/git/refs{/sha}","trees_url":"https://api.github.com/repos/mtanda/grafana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mtanda/grafana/statuses/{sha}","languages_url":"https://api.github.com/repos/mtanda/grafana/languages","stargazers_url":"https://api.github.com/repos/mtanda/grafana/stargazers","contributors_url":"https://api.github.com/repos/mtanda/grafana/contributors","subscribers_url":"https://api.github.com/repos/mtanda/grafana/subscribers","subscription_url":"https://api.github.com/repos/mtanda/grafana/subscription","commits_url":"https://api.github.com/repos/mtanda/grafana/commits{/sha}","git_commits_url":"https://api.github.com/repos/mtanda/grafana/git/commits{/sha}","comments_url":"https://api.github.com/repos/mtanda/grafana/comments{/number}","issue_comment_url":"https://api.github.com/repos/mtanda/grafana/issues/comments{/number}","contents_url":"https://api.github.com/repos/mtanda/grafana/contents/{+path}","compare_url":"https://api.github.com/repos/mtanda/grafana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mtanda/grafana/merges","archive_url":"https://api.github.com/repos/mtanda/grafana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mtanda/grafana/downloads","issues_url":"https://api.github.com/repos/mtanda/grafana/issues{/number}","pulls_url":"https://api.github.com/repos/mtanda/grafana/pulls{/number}","milestones_url":"https://api.github.com/repos/mtanda/grafana/milestones{/number}","notifications_url":"https://api.github.com/repos/mtanda/grafana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mtanda/grafana/labels{/name}","releases_url":"https://api.github.com/repos/mtanda/grafana/releases{/id}","deployments_url":"https://api.github.com/repos/mtanda/grafana/deployments","created_at":"2015-04-02T03:49:53Z","updated_at":"2016-11-17T09:21:03Z","pushed_at":"2016-12-08T05:38:46Z","git_url":"git://github.com/mtanda/grafana.git","ssh_url":"git@github.com:mtanda/grafana.git","clone_url":"https://github.com/mtanda/grafana.git","svn_url":"https://github.com/mtanda/grafana","homepage":"http://grafana.org","size":103431,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"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":"grafana:master","ref":"master","sha":"8ee85626f21826a20264206f044ba7b4f83a3a25","user":{"login":"grafana","id":7195757,"avatar_url":"https://avatars.githubusercontent.com/u/7195757?v=3","gravatar_id":"","url":"https://api.github.com/users/grafana","html_url":"https://github.com/grafana","followers_url":"https://api.github.com/users/grafana/followers","following_url":"https://api.github.com/users/grafana/following{/other_user}","gists_url":"https://api.github.com/users/grafana/gists{/gist_id}","starred_url":"https://api.github.com/users/grafana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grafana/subscriptions","organizations_url":"https://api.github.com/users/grafana/orgs","repos_url":"https://api.github.com/users/grafana/repos","events_url":"https://api.github.com/users/grafana/events{/privacy}","received_events_url":"https://api.github.com/users/grafana/received_events","type":"Organization","site_admin":false},"repo":{"id":15111821,"name":"grafana","full_name":"grafana/grafana","owner":{"login":"grafana","id":7195757,"avatar_url":"https://avatars.githubusercontent.com/u/7195757?v=3","gravatar_id":"","url":"https://api.github.com/users/grafana","html_url":"https://github.com/grafana","followers_url":"https://api.github.com/users/grafana/followers","following_url":"https://api.github.com/users/grafana/following{/other_user}","gists_url":"https://api.github.com/users/grafana/gists{/gist_id}","starred_url":"https://api.github.com/users/grafana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grafana/subscriptions","organizations_url":"https://api.github.com/users/grafana/orgs","repos_url":"https://api.github.com/users/grafana/repos","events_url":"https://api.github.com/users/grafana/events{/privacy}","received_events_url":"https://api.github.com/users/grafana/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grafana/grafana","description":"Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & Prometheus","fork":false,"url":"https://api.github.com/repos/grafana/grafana","forks_url":"https://api.github.com/repos/grafana/grafana/forks","keys_url":"https://api.github.com/repos/grafana/grafana/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grafana/grafana/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grafana/grafana/teams","hooks_url":"https://api.github.com/repos/grafana/grafana/hooks","issue_events_url":"https://api.github.com/repos/grafana/grafana/issues/events{/number}","events_url":"https://api.github.com/repos/grafana/grafana/events","assignees_url":"https://api.github.com/repos/grafana/grafana/assignees{/user}","branches_url":"https://api.github.com/repos/grafana/grafana/branches{/branch}","tags_url":"https://api.github.com/repos/grafana/grafana/tags","blobs_url":"https://api.github.com/repos/grafana/grafana/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grafana/grafana/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grafana/grafana/git/refs{/sha}","trees_url":"https://api.github.com/repos/grafana/grafana/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grafana/grafana/statuses/{sha}","languages_url":"https://api.github.com/repos/grafana/grafana/languages","stargazers_url":"https://api.github.com/repos/grafana/grafana/stargazers","contributors_url":"https://api.github.com/repos/grafana/grafana/contributors","subscribers_url":"https://api.github.com/repos/grafana/grafana/subscribers","subscription_url":"https://api.github.com/repos/grafana/grafana/subscription","commits_url":"https://api.github.com/repos/grafana/grafana/commits{/sha}","git_commits_url":"https://api.github.com/repos/grafana/grafana/git/commits{/sha}","comments_url":"https://api.github.com/repos/grafana/grafana/comments{/number}","issue_comment_url":"https://api.github.com/repos/grafana/grafana/issues/comments{/number}","contents_url":"https://api.github.com/repos/grafana/grafana/contents/{+path}","compare_url":"https://api.github.com/repos/grafana/grafana/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grafana/grafana/merges","archive_url":"https://api.github.com/repos/grafana/grafana/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grafana/grafana/downloads","issues_url":"https://api.github.com/repos/grafana/grafana/issues{/number}","pulls_url":"https://api.github.com/repos/grafana/grafana/pulls{/number}","milestones_url":"https://api.github.com/repos/grafana/grafana/milestones{/number}","notifications_url":"https://api.github.com/repos/grafana/grafana/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grafana/grafana/labels{/name}","releases_url":"https://api.github.com/repos/grafana/grafana/releases{/id}","deployments_url":"https://api.github.com/repos/grafana/grafana/deployments","created_at":"2013-12-11T15:59:56Z","updated_at":"2016-12-08T10:27:42Z","pushed_at":"2016-12-08T10:02:10Z","git_url":"git://github.com/grafana/grafana.git","ssh_url":"git@github.com:grafana/grafana.git","clone_url":"https://github.com/grafana/grafana.git","svn_url":"https://github.com/grafana/grafana","homepage":"http://grafana.org","size":152208,"stargazers_count":13356,"watchers_count":13356,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2076,"mirror_url":null,"open_issues_count":833,"forks":2076,"open_issues":833,"watchers":13356,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/grafana/grafana/pulls/6872"},"html":{"href":"https://github.com/grafana/grafana/pull/6872"},"issue":{"href":"https://api.github.com/repos/grafana/grafana/issues/6872"},"comments":{"href":"https://api.github.com/repos/grafana/grafana/issues/6872/comments"},"review_comments":{"href":"https://api.github.com/repos/grafana/grafana/pulls/6872/comments"},"review_comment":{"href":"https://api.github.com/repos/grafana/grafana/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/grafana/grafana/pulls/6872/commits"},"statuses":{"href":"https://api.github.com/repos/grafana/grafana/statuses/037bee950d7a1ea759e6970e0c15d9595ee7d8fd"}}}}
{"actor":{"display_login":"torkelo"}}