{"action":"opened","number":181,"pull_request":{"url":"https://api.github.com/repos/prometheus/client_golang/pulls/181","id":50128342,"html_url":"https://github.com/prometheus/client_golang/pull/181","diff_url":"https://github.com/prometheus/client_golang/pull/181.diff","patch_url":"https://github.com/prometheus/client_golang/pull/181.patch","issue_url":"https://api.github.com/repos/prometheus/client_golang/issues/181","number":181,"state":"open","locked":false,"title":"Less locking for metric vectors.","user":{"login":"robx","id":132113,"avatar_url":"https://avatars.githubusercontent.com/u/132113?v=3","gravatar_id":"","url":"https://api.github.com/users/robx","html_url":"https://github.com/robx","followers_url":"https://api.github.com/users/robx/followers","following_url":"https://api.github.com/users/robx/following{/other_user}","gists_url":"https://api.github.com/users/robx/gists{/gist_id}","starred_url":"https://api.github.com/users/robx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robx/subscriptions","organizations_url":"https://api.github.com/users/robx/orgs","repos_url":"https://api.github.com/users/robx/repos","events_url":"https://api.github.com/users/robx/events{/privacy}","received_events_url":"https://api.github.com/users/robx/received_events","type":"User","site_admin":false},"body":"Joint work with @alicebob. @beorn7, you seem to know the vector stuff well?\r\n\r\n* Inline the label hashing to remove the need to keep around and lock a shared buffer and hash.\r\n* Try looking up metrics with a read lock before falling back to a write-locked \"get or create\".\r\n\r\nThis should improve lock contention issues when using variable labels in a concurrent setting. (We're currently using the hacky https://github.com/realzeitmedia/promvec, which avoids locking altogether.)\r\n\r\nThe benchmark results look quite good. BenchmarkHandler varies a lot between runs, that delta is not always positive.\r\n\r\n```\r\n$ benchcmp old.txt new.txt \r\nbenchmark                                       old ns/op     new ns/op     delta\r\nBenchmarkCounterWithLabelValues-4               462           144           -68.83%\r\nBenchmarkCounterWithLabelValuesConcurrent-4     561           91.7          -83.65%\r\nBenchmarkCounterWithMappedLabels-4              2360          760           -67.80%\r\nBenchmarkCounterWithPreparedMappedLabels-4      763           178           -76.67%\r\nBenchmarkCounterNoLabels-4                      26.7          22.8          -14.61%\r\nBenchmarkGaugeWithLabelValues-4                 407           129           -68.30%\r\nBenchmarkGaugeNoLabels-4                        15.7          13.7          -12.74%\r\nBenchmarkSummaryWithLabelValues-4               1672          1550          -7.30%\r\nBenchmarkSummaryNoLabels-4                      1671          1408          -15.74%\r\nBenchmarkHistogramWithLabelValues-4             550           191           -65.27%\r\nBenchmarkHistogramNoLabels-4                    72.5          62.4          -13.93%\r\nBenchmarkHistogramObserve1-4                    53.3          45.7          -14.26%\r\nBenchmarkHistogramObserve2-4                    171           200           +16.96%\r\nBenchmarkHistogramObserve4-4                    433           530           +22.40%\r\nBenchmarkHistogramObserve8-4                    987           1070          +8.41%\r\nBenchmarkHistogramWrite1-4                      5718          4103          -28.24%\r\nBenchmarkHistogramWrite2-4                      6783          5710          -15.82%\r\nBenchmarkHistogramWrite4-4                      12864         12178         -5.33%\r\nBenchmarkHistogramWrite8-4                      25073         22742         -9.30%\r\nBenchmarkHandler-4                              12246782      20103907      +64.16%\r\nBenchmarkSummaryObserve1-4                      1917          1950          +1.72%\r\nBenchmarkSummaryObserve2-4                      5591          4818          -13.83%\r\nBenchmarkSummaryObserve4-4                      12727         12346         -2.99%\r\nBenchmarkSummaryObserve8-4                      26542         25127         -5.33%\r\nBenchmarkSummaryWrite1-4                        23767         20058         -15.61%\r\nBenchmarkSummaryWrite2-4                        48698         46691         -4.12%\r\nBenchmarkSummaryWrite4-4                        92121         92998         +0.95%\r\nBenchmarkSummaryWrite8-4                        196476        182895        -6.91%\r\n\r\nbenchmark                                       old allocs     new allocs     delta\r\nBenchmarkCounterWithLabelValues-4               0              0              +0.00%\r\nBenchmarkCounterWithLabelValuesConcurrent-4     0              0              +0.00%\r\nBenchmarkCounterWithMappedLabels-4              3              2              -33.33%\r\nBenchmarkCounterWithPreparedMappedLabels-4      1              0              -100.00%\r\nBenchmarkCounterNoLabels-4                      0              0              +0.00%\r\nBenchmarkGaugeWithLabelValues-4                 0              0              +0.00%\r\nBenchmarkGaugeNoLabels-4                        0              0              +0.00%\r\nBenchmarkSummaryWithLabelValues-4               0              0              +0.00%\r\nBenchmarkSummaryNoLabels-4                      0              0              +0.00%\r\nBenchmarkHistogramWithLabelValues-4             0              0              +0.00%\r\nBenchmarkHistogramNoLabels-4                    0              0              +0.00%\r\n\r\nbenchmark                                       old bytes     new bytes     delta\r\nBenchmarkCounterWithLabelValues-4               0             0             +0.00%\r\nBenchmarkCounterWithLabelValuesConcurrent-4     0             0             +0.00%\r\nBenchmarkCounterWithMappedLabels-4              384           336           -12.50%\r\nBenchmarkCounterWithPreparedMappedLabels-4      48            0             -100.00%\r\nBenchmarkCounterNoLabels-4                      0             0             +0.00%\r\nBenchmarkGaugeWithLabelValues-4                 0             0             +0.00%\r\nBenchmarkGaugeNoLabels-4                        0             0             +0.00%\r\nBenchmarkSummaryWithLabelValues-4               0             0             +0.00%\r\nBenchmarkSummaryNoLabels-4                      0             0             +0.00%\r\nBenchmarkHistogramWithLabelValues-4             0             0             +0.00%\r\nBenchmarkHistogramNoLabels-4                    0             0             +0.00%\r\n```\r\n","created_at":"2015-11-09T14:29:34Z","updated_at":"2015-11-09T14:29:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/prometheus/client_golang/pulls/181/commits","review_comments_url":"https://api.github.com/repos/prometheus/client_golang/pulls/181/comments","review_comment_url":"https://api.github.com/repos/prometheus/client_golang/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prometheus/client_golang/issues/181/comments","statuses_url":"https://api.github.com/repos/prometheus/client_golang/statuses/8c96b12588cb6f8cca320ee2f7785293e8906095","head":{"label":"realzeitmedia:locking","ref":"locking","sha":"8c96b12588cb6f8cca320ee2f7785293e8906095","user":{"login":"realzeitmedia","id":7324877,"avatar_url":"https://avatars.githubusercontent.com/u/7324877?v=3","gravatar_id":"","url":"https://api.github.com/users/realzeitmedia","html_url":"https://github.com/realzeitmedia","followers_url":"https://api.github.com/users/realzeitmedia/followers","following_url":"https://api.github.com/users/realzeitmedia/following{/other_user}","gists_url":"https://api.github.com/users/realzeitmedia/gists{/gist_id}","starred_url":"https://api.github.com/users/realzeitmedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realzeitmedia/subscriptions","organizations_url":"https://api.github.com/users/realzeitmedia/orgs","repos_url":"https://api.github.com/users/realzeitmedia/repos","events_url":"https://api.github.com/users/realzeitmedia/events{/privacy}","received_events_url":"https://api.github.com/users/realzeitmedia/received_events","type":"Organization","site_admin":false},"repo":{"id":36667837,"name":"client_golang","full_name":"realzeitmedia/client_golang","owner":{"login":"realzeitmedia","id":7324877,"avatar_url":"https://avatars.githubusercontent.com/u/7324877?v=3","gravatar_id":"","url":"https://api.github.com/users/realzeitmedia","html_url":"https://github.com/realzeitmedia","followers_url":"https://api.github.com/users/realzeitmedia/followers","following_url":"https://api.github.com/users/realzeitmedia/following{/other_user}","gists_url":"https://api.github.com/users/realzeitmedia/gists{/gist_id}","starred_url":"https://api.github.com/users/realzeitmedia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realzeitmedia/subscriptions","organizations_url":"https://api.github.com/users/realzeitmedia/orgs","repos_url":"https://api.github.com/users/realzeitmedia/repos","events_url":"https://api.github.com/users/realzeitmedia/events{/privacy}","received_events_url":"https://api.github.com/users/realzeitmedia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/realzeitmedia/client_golang","description":"Prometheus instrumentation library for Go applications","fork":true,"url":"https://api.github.com/repos/realzeitmedia/client_golang","forks_url":"https://api.github.com/repos/realzeitmedia/client_golang/forks","keys_url":"https://api.github.com/repos/realzeitmedia/client_golang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/realzeitmedia/client_golang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/realzeitmedia/client_golang/teams","hooks_url":"https://api.github.com/repos/realzeitmedia/client_golang/hooks","issue_events_url":"https://api.github.com/repos/realzeitmedia/client_golang/issues/events{/number}","events_url":"https://api.github.com/repos/realzeitmedia/client_golang/events","assignees_url":"https://api.github.com/repos/realzeitmedia/client_golang/assignees{/user}","branches_url":"https://api.github.com/repos/realzeitmedia/client_golang/branches{/branch}","tags_url":"https://api.github.com/repos/realzeitmedia/client_golang/tags","blobs_url":"https://api.github.com/repos/realzeitmedia/client_golang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/realzeitmedia/client_golang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/realzeitmedia/client_golang/git/refs{/sha}","trees_url":"https://api.github.com/repos/realzeitmedia/client_golang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/realzeitmedia/client_golang/statuses/{sha}","languages_url":"https://api.github.com/repos/realzeitmedia/client_golang/languages","stargazers_url":"https://api.github.com/repos/realzeitmedia/client_golang/stargazers","contributors_url":"https://api.github.com/repos/realzeitmedia/client_golang/contributors","subscribers_url":"https://api.github.com/repos/realzeitmedia/client_golang/subscribers","subscription_url":"https://api.github.com/repos/realzeitmedia/client_golang/subscription","commits_url":"https://api.github.com/repos/realzeitmedia/client_golang/commits{/sha}","git_commits_url":"https://api.github.com/repos/realzeitmedia/client_golang/git/commits{/sha}","comments_url":"https://api.github.com/repos/realzeitmedia/client_golang/comments{/number}","issue_comment_url":"https://api.github.com/repos/realzeitmedia/client_golang/issues/comments{/number}","contents_url":"https://api.github.com/repos/realzeitmedia/client_golang/contents/{+path}","compare_url":"https://api.github.com/repos/realzeitmedia/client_golang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/realzeitmedia/client_golang/merges","archive_url":"https://api.github.com/repos/realzeitmedia/client_golang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/realzeitmedia/client_golang/downloads","issues_url":"https://api.github.com/repos/realzeitmedia/client_golang/issues{/number}","pulls_url":"https://api.github.com/repos/realzeitmedia/client_golang/pulls{/number}","milestones_url":"https://api.github.com/repos/realzeitmedia/client_golang/milestones{/number}","notifications_url":"https://api.github.com/repos/realzeitmedia/client_golang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/realzeitmedia/client_golang/labels{/name}","releases_url":"https://api.github.com/repos/realzeitmedia/client_golang/releases{/id}","created_at":"2015-06-01T14:55:45Z","updated_at":"2015-06-01T14:55:45Z","pushed_at":"2015-11-09T14:17:17Z","git_url":"git://github.com/realzeitmedia/client_golang.git","ssh_url":"git@github.com:realzeitmedia/client_golang.git","clone_url":"https://github.com/realzeitmedia/client_golang.git","svn_url":"https://github.com/realzeitmedia/client_golang","homepage":"","size":1022,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"prometheus:master","ref":"master","sha":"449ccefff16c8e2b7229f6be1921ba22f62461fe","user":{"login":"prometheus","id":3380462,"avatar_url":"https://avatars.githubusercontent.com/u/3380462?v=3","gravatar_id":"","url":"https://api.github.com/users/prometheus","html_url":"https://github.com/prometheus","followers_url":"https://api.github.com/users/prometheus/followers","following_url":"https://api.github.com/users/prometheus/following{/other_user}","gists_url":"https://api.github.com/users/prometheus/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheus/subscriptions","organizations_url":"https://api.github.com/users/prometheus/orgs","repos_url":"https://api.github.com/users/prometheus/repos","events_url":"https://api.github.com/users/prometheus/events{/privacy}","received_events_url":"https://api.github.com/users/prometheus/received_events","type":"Organization","site_admin":false},"repo":{"id":7823926,"name":"client_golang","full_name":"prometheus/client_golang","owner":{"login":"prometheus","id":3380462,"avatar_url":"https://avatars.githubusercontent.com/u/3380462?v=3","gravatar_id":"","url":"https://api.github.com/users/prometheus","html_url":"https://github.com/prometheus","followers_url":"https://api.github.com/users/prometheus/followers","following_url":"https://api.github.com/users/prometheus/following{/other_user}","gists_url":"https://api.github.com/users/prometheus/gists{/gist_id}","starred_url":"https://api.github.com/users/prometheus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prometheus/subscriptions","organizations_url":"https://api.github.com/users/prometheus/orgs","repos_url":"https://api.github.com/users/prometheus/repos","events_url":"https://api.github.com/users/prometheus/events{/privacy}","received_events_url":"https://api.github.com/users/prometheus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prometheus/client_golang","description":"Prometheus instrumentation library for Go applications","fork":false,"url":"https://api.github.com/repos/prometheus/client_golang","forks_url":"https://api.github.com/repos/prometheus/client_golang/forks","keys_url":"https://api.github.com/repos/prometheus/client_golang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prometheus/client_golang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prometheus/client_golang/teams","hooks_url":"https://api.github.com/repos/prometheus/client_golang/hooks","issue_events_url":"https://api.github.com/repos/prometheus/client_golang/issues/events{/number}","events_url":"https://api.github.com/repos/prometheus/client_golang/events","assignees_url":"https://api.github.com/repos/prometheus/client_golang/assignees{/user}","branches_url":"https://api.github.com/repos/prometheus/client_golang/branches{/branch}","tags_url":"https://api.github.com/repos/prometheus/client_golang/tags","blobs_url":"https://api.github.com/repos/prometheus/client_golang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prometheus/client_golang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prometheus/client_golang/git/refs{/sha}","trees_url":"https://api.github.com/repos/prometheus/client_golang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prometheus/client_golang/statuses/{sha}","languages_url":"https://api.github.com/repos/prometheus/client_golang/languages","stargazers_url":"https://api.github.com/repos/prometheus/client_golang/stargazers","contributors_url":"https://api.github.com/repos/prometheus/client_golang/contributors","subscribers_url":"https://api.github.com/repos/prometheus/client_golang/subscribers","subscription_url":"https://api.github.com/repos/prometheus/client_golang/subscription","commits_url":"https://api.github.com/repos/prometheus/client_golang/commits{/sha}","git_commits_url":"https://api.github.com/repos/prometheus/client_golang/git/commits{/sha}","comments_url":"https://api.github.com/repos/prometheus/client_golang/comments{/number}","issue_comment_url":"https://api.github.com/repos/prometheus/client_golang/issues/comments{/number}","contents_url":"https://api.github.com/repos/prometheus/client_golang/contents/{+path}","compare_url":"https://api.github.com/repos/prometheus/client_golang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prometheus/client_golang/merges","archive_url":"https://api.github.com/repos/prometheus/client_golang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prometheus/client_golang/downloads","issues_url":"https://api.github.com/repos/prometheus/client_golang/issues{/number}","pulls_url":"https://api.github.com/repos/prometheus/client_golang/pulls{/number}","milestones_url":"https://api.github.com/repos/prometheus/client_golang/milestones{/number}","notifications_url":"https://api.github.com/repos/prometheus/client_golang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prometheus/client_golang/labels{/name}","releases_url":"https://api.github.com/repos/prometheus/client_golang/releases{/id}","created_at":"2013-01-25T16:32:46Z","updated_at":"2015-11-07T17:53:46Z","pushed_at":"2015-11-09T14:29:34Z","git_url":"git://github.com/prometheus/client_golang.git","ssh_url":"git@github.com:prometheus/client_golang.git","clone_url":"https://github.com/prometheus/client_golang.git","svn_url":"https://github.com/prometheus/client_golang","homepage":"","size":3369,"stargazers_count":79,"watchers_count":79,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":31,"mirror_url":null,"open_issues_count":21,"forks":31,"open_issues":21,"watchers":79,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prometheus/client_golang/pulls/181"},"html":{"href":"https://github.com/prometheus/client_golang/pull/181"},"issue":{"href":"https://api.github.com/repos/prometheus/client_golang/issues/181"},"comments":{"href":"https://api.github.com/repos/prometheus/client_golang/issues/181/comments"},"review_comments":{"href":"https://api.github.com/repos/prometheus/client_golang/pulls/181/comments"},"review_comment":{"href":"https://api.github.com/repos/prometheus/client_golang/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prometheus/client_golang/pulls/181/commits"},"statuses":{"href":"https://api.github.com/repos/prometheus/client_golang/statuses/8c96b12588cb6f8cca320ee2f7785293e8906095"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":4,"additions":76,"deletions":43,"changed_files":10}}