{"action":"created","issue":{"url":"https://api.github.com/repos/go-kit/kit/issues/262","repository_url":"https://api.github.com/repos/go-kit/kit","labels_url":"https://api.github.com/repos/go-kit/kit/issues/262/labels{/name}","comments_url":"https://api.github.com/repos/go-kit/kit/issues/262/comments","events_url":"https://api.github.com/repos/go-kit/kit/issues/262/events","html_url":"https://github.com/go-kit/kit/issues/262","id":154915434,"number":262,"title":"metrics: Provider interface","user":{"login":"bmarini","id":13173,"avatar_url":"https://avatars.githubusercontent.com/u/13173?v=3","gravatar_id":"","url":"https://api.github.com/users/bmarini","html_url":"https://github.com/bmarini","followers_url":"https://api.github.com/users/bmarini/followers","following_url":"https://api.github.com/users/bmarini/following{/other_user}","gists_url":"https://api.github.com/users/bmarini/gists{/gist_id}","starred_url":"https://api.github.com/users/bmarini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmarini/subscriptions","organizations_url":"https://api.github.com/users/bmarini/orgs","repos_url":"https://api.github.com/users/bmarini/repos","events_url":"https://api.github.com/users/bmarini/events{/privacy}","received_events_url":"https://api.github.com/users/bmarini/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-05-15T15:55:01Z","updated_at":"2016-05-15T18:26:17Z","closed_at":"2016-05-15T18:26:17Z","body":"What do you think about adding an interface like this?\r\n\r\n``` golang\r\ntype Provider interface {\r\n\tNewCounter(name string) Counter\r\n\tNewGauge(name string) Gauge\r\n\tNewHistogram(name string) Histogram\r\n\tNewTimeHistogram(name string) TimeHistogram\r\n}\r\n```\r\n\r\nThis would allow calling code to easily add new metrics and allow the backend to be easily swapped out system wide. I'm adding this interface to my code so I can  implement a provider with expar and dogstatd backends, and some global tags for all metrics. I'm not sure how else I would do this in the calling code unless I knew all the Counters, Gauges, and Histograms I would need ahead of time and passed them all in..."},"comment":{"url":"https://api.github.com/repos/go-kit/kit/issues/comments/219302026","html_url":"https://github.com/go-kit/kit/issues/262#issuecomment-219302026","issue_url":"https://api.github.com/repos/go-kit/kit/issues/262","id":219302026,"user":{"login":"peterbourgon","id":114509,"avatar_url":"https://avatars.githubusercontent.com/u/114509?v=3","gravatar_id":"","url":"https://api.github.com/users/peterbourgon","html_url":"https://github.com/peterbourgon","followers_url":"https://api.github.com/users/peterbourgon/followers","following_url":"https://api.github.com/users/peterbourgon/following{/other_user}","gists_url":"https://api.github.com/users/peterbourgon/gists{/gist_id}","starred_url":"https://api.github.com/users/peterbourgon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterbourgon/subscriptions","organizations_url":"https://api.github.com/users/peterbourgon/orgs","repos_url":"https://api.github.com/users/peterbourgon/repos","events_url":"https://api.github.com/users/peterbourgon/events{/privacy}","received_events_url":"https://api.github.com/users/peterbourgon/received_events","type":"User","site_admin":false},"created_at":"2016-05-15T18:26:17Z","updated_at":"2016-05-15T18:26:17Z","body":"Filed #263 for those enhancements. Closing this ticket now; please feel free to reopen if you have unanswered questions :)"}}