{"action":"created","comment":{"url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/comments/77883064","id":77883064,"diff_hunk":"@@ -25,24 +25,26 @@ func bloomCached(bs Blockstore, ctx context.Context, bloomSize, hashCount int) (\n \tbc.total = metrics.NewCtx(ctx, \"bloom_total\",\n \t\t\"Total number of requests to bloom cache\").Counter()\n \n-\tfill := metrics.NewCtx(ctx, \"bloom_fill_ratio\",\n-\t\t\"Ratio of bloom filter fullnes, (updated once a minute)\").Gauge()\n-\n \tbc.Invalidate()\n \tgo bc.Rebuild(ctx)\n-\tgo func() {\n-\t\t<-bc.rebuildChan\n-\t\tt := time.NewTicker(1 * time.Minute)\n-\t\tfor {\n-\t\t\tselect {\n-\t\t\tcase <-ctx.Done():\n-\t\t\t\tt.Stop()\n-\t\t\t\treturn\n-\t\t\tcase <-t.C:\n-\t\t\t\tfill.Set(bc.bloom.FillRatio())\n+\tif metrics.Active() {","path":"blocks/blockstore/bloom_cache.go","position":null,"original_position":19,"commit_id":"bb405f316a3819a4dba1d972dca8a547ea80fcb0","original_commit_id":"bb405f316a3819a4dba1d972dca8a547ea80fcb0","user":{"login":"whyrusleeping","id":1243164,"avatar_url":"https://avatars.githubusercontent.com/u/1243164?v=3","gravatar_id":"","url":"https://api.github.com/users/whyrusleeping","html_url":"https://github.com/whyrusleeping","followers_url":"https://api.github.com/users/whyrusleeping/followers","following_url":"https://api.github.com/users/whyrusleeping/following{/other_user}","gists_url":"https://api.github.com/users/whyrusleeping/gists{/gist_id}","starred_url":"https://api.github.com/users/whyrusleeping/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whyrusleeping/subscriptions","organizations_url":"https://api.github.com/users/whyrusleeping/orgs","repos_url":"https://api.github.com/users/whyrusleeping/repos","events_url":"https://api.github.com/users/whyrusleeping/events{/privacy}","received_events_url":"https://api.github.com/users/whyrusleeping/received_events","type":"User","site_admin":false},"body":"Is this some sort of global? That feels very wrong to me. Why arent we checking if the context has metrics injected into it and using that as a way to tell if we have metrics enabled?","created_at":"2016-09-07T18:57:24Z","updated_at":"2016-09-07T18:57:24Z","html_url":"https://github.com/ipfs/go-ipfs/pull/3189#discussion_r77883064","pull_request_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/3189","_links":{"self":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/comments/77883064"},"html":{"href":"https://github.com/ipfs/go-ipfs/pull/3189#discussion_r77883064"},"pull_request":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/3189"}}},"pull_request":{"url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/3189","id":84020570,"html_url":"https://github.com/ipfs/go-ipfs/pull/3189","diff_url":"https://github.com/ipfs/go-ipfs/pull/3189.diff","patch_url":"https://github.com/ipfs/go-ipfs/pull/3189.patch","issue_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/3189","number":3189,"state":"open","locked":false,"title":"metrics: introduce go-metrics-interface","user":{"login":"Kubuxu","id":2259282,"avatar_url":"https://avatars.githubusercontent.com/u/2259282?v=3","gravatar_id":"","url":"https://api.github.com/users/Kubuxu","html_url":"https://github.com/Kubuxu","followers_url":"https://api.github.com/users/Kubuxu/followers","following_url":"https://api.github.com/users/Kubuxu/following{/other_user}","gists_url":"https://api.github.com/users/Kubuxu/gists{/gist_id}","starred_url":"https://api.github.com/users/Kubuxu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kubuxu/subscriptions","organizations_url":"https://api.github.com/users/Kubuxu/orgs","repos_url":"https://api.github.com/users/Kubuxu/repos","events_url":"https://api.github.com/users/Kubuxu/events{/privacy}","received_events_url":"https://api.github.com/users/Kubuxu/received_events","type":"User","site_admin":false},"body":"It makes introducing metrics much easier.\r\n\r\nThe interface itself doesn't depend on prometheus, that means it is very light and without it (or other implementation) acts as a general noop.\r\n\r\nImporting go-metrics-prometheus injects prometheus implementation.\r\n\r\nUsage:\r\nThere are three most improtant functions in go-metrics-interface:\r\n\r\n* `metrics.New(name, helptext)` - creates new metrics with given name and helptext\r\n* `metrics.NewCtx(ctx, name, helptext)` - creates new metrics with given name and helptext in scope defined in the context\r\n* `metric.CtxSubScope(ctx, name)` - returns context that is a subscope of scope defined in current ctx\r\n\r\nAs you can see it uses `context.Value` for passing the scope name of the metrics. In my opinion it is one of the better solutions as context is already required in many places, and it introduction in constructors chains isn't bad either.\r\n\r\nCurrent problem I have is that `goprocess` doesn't have something like `context.Value` so passing scopes through `goprocess` is something I haven't figured out yet but it can be done later.\r\n\r\n\r\n//cc @whyrusleeping @lgierth ","created_at":"2016-09-05T15:56:49Z","updated_at":"2016-09-07T18:57:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e32ae10857a6e2550b3be9e95776c9775b1aeab8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/3189/commits","review_comments_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/3189/comments","review_comment_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/3189/comments","statuses_url":"https://api.github.com/repos/ipfs/go-ipfs/statuses/bb405f316a3819a4dba1d972dca8a547ea80fcb0","head":{"label":"ipfs:feat/metrics/interface","ref":"feat/metrics/interface","sha":"bb405f316a3819a4dba1d972dca8a547ea80fcb0","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":21233191,"name":"go-ipfs","full_name":"ipfs/go-ipfs","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/go-ipfs","description":"IPFS implementation in go","fork":false,"url":"https://api.github.com/repos/ipfs/go-ipfs","forks_url":"https://api.github.com/repos/ipfs/go-ipfs/forks","keys_url":"https://api.github.com/repos/ipfs/go-ipfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/go-ipfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/go-ipfs/teams","hooks_url":"https://api.github.com/repos/ipfs/go-ipfs/hooks","issue_events_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/go-ipfs/events","assignees_url":"https://api.github.com/repos/ipfs/go-ipfs/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/go-ipfs/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/go-ipfs/tags","blobs_url":"https://api.github.com/repos/ipfs/go-ipfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/go-ipfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/go-ipfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/go-ipfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/go-ipfs/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/go-ipfs/languages","stargazers_url":"https://api.github.com/repos/ipfs/go-ipfs/stargazers","contributors_url":"https://api.github.com/repos/ipfs/go-ipfs/contributors","subscribers_url":"https://api.github.com/repos/ipfs/go-ipfs/subscribers","subscription_url":"https://api.github.com/repos/ipfs/go-ipfs/subscription","commits_url":"https://api.github.com/repos/ipfs/go-ipfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/go-ipfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/go-ipfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/go-ipfs/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/go-ipfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/go-ipfs/merges","archive_url":"https://api.github.com/repos/ipfs/go-ipfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/go-ipfs/downloads","issues_url":"https://api.github.com/repos/ipfs/go-ipfs/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/go-ipfs/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/go-ipfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/go-ipfs/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/go-ipfs/releases{/id}","deployments_url":"https://api.github.com/repos/ipfs/go-ipfs/deployments","created_at":"2014-06-26T08:14:34Z","updated_at":"2016-09-07T08:23:38Z","pushed_at":"2016-09-07T18:53:37Z","git_url":"git://github.com/ipfs/go-ipfs.git","ssh_url":"git@github.com:ipfs/go-ipfs.git","clone_url":"https://github.com/ipfs/go-ipfs.git","svn_url":"https://github.com/ipfs/go-ipfs","homepage":"https://github.com/ipfs/ipfs","size":36155,"stargazers_count":2212,"watchers_count":2212,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":363,"mirror_url":null,"open_issues_count":485,"forks":363,"open_issues":485,"watchers":2212,"default_branch":"master"}},"base":{"label":"ipfs:master","ref":"master","sha":"0f0cf44800efcd4ae449922ba4e3c45d1c5db121","user":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"repo":{"id":21233191,"name":"go-ipfs","full_name":"ipfs/go-ipfs","owner":{"login":"ipfs","id":10536621,"avatar_url":"https://avatars.githubusercontent.com/u/10536621?v=3","gravatar_id":"","url":"https://api.github.com/users/ipfs","html_url":"https://github.com/ipfs","followers_url":"https://api.github.com/users/ipfs/followers","following_url":"https://api.github.com/users/ipfs/following{/other_user}","gists_url":"https://api.github.com/users/ipfs/gists{/gist_id}","starred_url":"https://api.github.com/users/ipfs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ipfs/subscriptions","organizations_url":"https://api.github.com/users/ipfs/orgs","repos_url":"https://api.github.com/users/ipfs/repos","events_url":"https://api.github.com/users/ipfs/events{/privacy}","received_events_url":"https://api.github.com/users/ipfs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ipfs/go-ipfs","description":"IPFS implementation in go","fork":false,"url":"https://api.github.com/repos/ipfs/go-ipfs","forks_url":"https://api.github.com/repos/ipfs/go-ipfs/forks","keys_url":"https://api.github.com/repos/ipfs/go-ipfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ipfs/go-ipfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ipfs/go-ipfs/teams","hooks_url":"https://api.github.com/repos/ipfs/go-ipfs/hooks","issue_events_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/events{/number}","events_url":"https://api.github.com/repos/ipfs/go-ipfs/events","assignees_url":"https://api.github.com/repos/ipfs/go-ipfs/assignees{/user}","branches_url":"https://api.github.com/repos/ipfs/go-ipfs/branches{/branch}","tags_url":"https://api.github.com/repos/ipfs/go-ipfs/tags","blobs_url":"https://api.github.com/repos/ipfs/go-ipfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ipfs/go-ipfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ipfs/go-ipfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ipfs/go-ipfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ipfs/go-ipfs/statuses/{sha}","languages_url":"https://api.github.com/repos/ipfs/go-ipfs/languages","stargazers_url":"https://api.github.com/repos/ipfs/go-ipfs/stargazers","contributors_url":"https://api.github.com/repos/ipfs/go-ipfs/contributors","subscribers_url":"https://api.github.com/repos/ipfs/go-ipfs/subscribers","subscription_url":"https://api.github.com/repos/ipfs/go-ipfs/subscription","commits_url":"https://api.github.com/repos/ipfs/go-ipfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ipfs/go-ipfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ipfs/go-ipfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ipfs/go-ipfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ipfs/go-ipfs/contents/{+path}","compare_url":"https://api.github.com/repos/ipfs/go-ipfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ipfs/go-ipfs/merges","archive_url":"https://api.github.com/repos/ipfs/go-ipfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ipfs/go-ipfs/downloads","issues_url":"https://api.github.com/repos/ipfs/go-ipfs/issues{/number}","pulls_url":"https://api.github.com/repos/ipfs/go-ipfs/pulls{/number}","milestones_url":"https://api.github.com/repos/ipfs/go-ipfs/milestones{/number}","notifications_url":"https://api.github.com/repos/ipfs/go-ipfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ipfs/go-ipfs/labels{/name}","releases_url":"https://api.github.com/repos/ipfs/go-ipfs/releases{/id}","deployments_url":"https://api.github.com/repos/ipfs/go-ipfs/deployments","created_at":"2014-06-26T08:14:34Z","updated_at":"2016-09-07T08:23:38Z","pushed_at":"2016-09-07T18:53:37Z","git_url":"git://github.com/ipfs/go-ipfs.git","ssh_url":"git@github.com:ipfs/go-ipfs.git","clone_url":"https://github.com/ipfs/go-ipfs.git","svn_url":"https://github.com/ipfs/go-ipfs","homepage":"https://github.com/ipfs/ipfs","size":36155,"stargazers_count":2212,"watchers_count":2212,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":363,"mirror_url":null,"open_issues_count":485,"forks":363,"open_issues":485,"watchers":2212,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/3189"},"html":{"href":"https://github.com/ipfs/go-ipfs/pull/3189"},"issue":{"href":"https://api.github.com/repos/ipfs/go-ipfs/issues/3189"},"comments":{"href":"https://api.github.com/repos/ipfs/go-ipfs/issues/3189/comments"},"review_comments":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/3189/comments"},"review_comment":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ipfs/go-ipfs/pulls/3189/commits"},"statuses":{"href":"https://api.github.com/repos/ipfs/go-ipfs/statuses/bb405f316a3819a4dba1d972dca8a547ea80fcb0"}}}}
{"actor":{"display_login":"whyrusleeping"}}