{"action":"created","comment":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/181916544","pull_request_review_id":112623833,"id":181916544,"diff_hunk":"@@ -16,6 +16,91 @@\n namespace Envoy {\n namespace Stats {\n \n+/**\n+ * A histogram that is stored in TLS and used to record values per thread. This holds two\n+ * histograms, one to collect the values and other as backup that is used for merge process. The\n+ * swap happens during the merge process.\n+ */\n+class ThreadLocalHistogram : public virtual Histogram {\n+public:\n+  virtual ~ThreadLocalHistogram() {}\n+\n+  /**\n+   * Called in the beginning of merge process. Swaps the histogram used for collection so that we do\n+   * not have to lock the histogram in high throughput TLS writes.\n+   */\n+  virtual void beginMerge() PURE;\n+};\n+\n+/**\n+ * Log Linear Histogram implementation per thread.\n+ */\n+class ThreadLocalHistogramImpl : public ThreadLocalHistogram, public MetricImpl {\n+public:\n+  ThreadLocalHistogramImpl(const std::string& name, Store& parent, std::string&& tag_extracted_name,\n+                           std::vector<Tag>&& tags);\n+\n+  ~ThreadLocalHistogramImpl();\n+  // Stats::Histogram\n+  void recordValue(uint64_t value) override;\n+\n+  bool used() const override { return flags_ & Flags::Used; }\n+  void beginMerge() override { current_active_ = 1 - current_active_; }","path":"source/common/stats/thread_local_store.h","position":33,"original_position":33,"commit_id":"64d8c2a6681e70a31272cded44409ee1007f96a0","original_commit_id":"64d8c2a6681e70a31272cded44409ee1007f96a0","user":{"login":"mattklein123","id":6305260,"avatar_url":"https://avatars3.githubusercontent.com/u/6305260?v=4","gravatar_id":"","url":"https://api.github.com/users/mattklein123","html_url":"https://github.com/mattklein123","followers_url":"https://api.github.com/users/mattklein123/followers","following_url":"https://api.github.com/users/mattklein123/following{/other_user}","gists_url":"https://api.github.com/users/mattklein123/gists{/gist_id}","starred_url":"https://api.github.com/users/mattklein123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattklein123/subscriptions","organizations_url":"https://api.github.com/users/mattklein123/orgs","repos_url":"https://api.github.com/users/mattklein123/repos","events_url":"https://api.github.com/users/mattklein123/events{/privacy}","received_events_url":"https://api.github.com/users/mattklein123/received_events","type":"User","site_admin":false},"body":"Can you add a small comment here to the body of this function, just to point out this is a trick to swap current_active_ between 1 and 0.","created_at":"2018-04-16T23:42:12Z","updated_at":"2018-04-16T23:50:41Z","html_url":"https://github.com/envoyproxy/envoy/pull/3059#discussion_r181916544","pull_request_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3059","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/181916544"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/3059#discussion_r181916544"},"pull_request":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3059"}}},"pull_request":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3059","id":181072336,"html_url":"https://github.com/envoyproxy/envoy/pull/3059","diff_url":"https://github.com/envoyproxy/envoy/pull/3059.diff","patch_url":"https://github.com/envoyproxy/envoy/pull/3059.patch","issue_url":"https://api.github.com/repos/envoyproxy/envoy/issues/3059","number":3059,"state":"open","locked":false,"title":"stats: add built-in log linear histogram support","user":{"login":"ramaraochavali","id":17204904,"avatar_url":"https://avatars0.githubusercontent.com/u/17204904?v=4","gravatar_id":"","url":"https://api.github.com/users/ramaraochavali","html_url":"https://github.com/ramaraochavali","followers_url":"https://api.github.com/users/ramaraochavali/followers","following_url":"https://api.github.com/users/ramaraochavali/following{/other_user}","gists_url":"https://api.github.com/users/ramaraochavali/gists{/gist_id}","starred_url":"https://api.github.com/users/ramaraochavali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramaraochavali/subscriptions","organizations_url":"https://api.github.com/users/ramaraochavali/orgs","repos_url":"https://api.github.com/users/ramaraochavali/repos","events_url":"https://api.github.com/users/ramaraochavali/events{/privacy}","received_events_url":"https://api.github.com/users/ramaraochavali/received_events","type":"User","site_admin":false},"body":"*Description*:\r\nImplements built-in log linear histogram. Fixes the issue https://github.com/envoyproxy/envoy/issues/1965\r\n\r\n*Risk Level*: High\r\n\r\n*Testing*:\r\nUnit, Integration and Manual testing.\r\n\r\n*Docs Changes*:\r\nNA\r\n\r\n*Release Notes*:\r\nWill create PR for version update once this is approved.\r\n","created_at":"2018-04-12T02:05:54Z","updated_at":"2018-04-16T23:50:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89372ade0fb6c7b356108a67ad5c6d8c6963057d","assignee":{"login":"jmarantz","id":1942589,"avatar_url":"https://avatars3.githubusercontent.com/u/1942589?v=4","gravatar_id":"","url":"https://api.github.com/users/jmarantz","html_url":"https://github.com/jmarantz","followers_url":"https://api.github.com/users/jmarantz/followers","following_url":"https://api.github.com/users/jmarantz/following{/other_user}","gists_url":"https://api.github.com/users/jmarantz/gists{/gist_id}","starred_url":"https://api.github.com/users/jmarantz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmarantz/subscriptions","organizations_url":"https://api.github.com/users/jmarantz/orgs","repos_url":"https://api.github.com/users/jmarantz/repos","events_url":"https://api.github.com/users/jmarantz/events{/privacy}","received_events_url":"https://api.github.com/users/jmarantz/received_events","type":"User","site_admin":false},"assignees":[{"login":"jmarantz","id":1942589,"avatar_url":"https://avatars3.githubusercontent.com/u/1942589?v=4","gravatar_id":"","url":"https://api.github.com/users/jmarantz","html_url":"https://github.com/jmarantz","followers_url":"https://api.github.com/users/jmarantz/followers","following_url":"https://api.github.com/users/jmarantz/following{/other_user}","gists_url":"https://api.github.com/users/jmarantz/gists{/gist_id}","starred_url":"https://api.github.com/users/jmarantz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmarantz/subscriptions","organizations_url":"https://api.github.com/users/jmarantz/orgs","repos_url":"https://api.github.com/users/jmarantz/repos","events_url":"https://api.github.com/users/jmarantz/events{/privacy}","received_events_url":"https://api.github.com/users/jmarantz/received_events","type":"User","site_admin":false},{"login":"mattklein123","id":6305260,"avatar_url":"https://avatars3.githubusercontent.com/u/6305260?v=4","gravatar_id":"","url":"https://api.github.com/users/mattklein123","html_url":"https://github.com/mattklein123","followers_url":"https://api.github.com/users/mattklein123/followers","following_url":"https://api.github.com/users/mattklein123/following{/other_user}","gists_url":"https://api.github.com/users/mattklein123/gists{/gist_id}","starred_url":"https://api.github.com/users/mattklein123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattklein123/subscriptions","organizations_url":"https://api.github.com/users/mattklein123/orgs","repos_url":"https://api.github.com/users/mattklein123/repos","events_url":"https://api.github.com/users/mattklein123/events{/privacy}","received_events_url":"https://api.github.com/users/mattklein123/received_events","type":"User","site_admin":false},{"login":"mrice32","id":11791551,"avatar_url":"https://avatars3.githubusercontent.com/u/11791551?v=4","gravatar_id":"","url":"https://api.github.com/users/mrice32","html_url":"https://github.com/mrice32","followers_url":"https://api.github.com/users/mrice32/followers","following_url":"https://api.github.com/users/mrice32/following{/other_user}","gists_url":"https://api.github.com/users/mrice32/gists{/gist_id}","starred_url":"https://api.github.com/users/mrice32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrice32/subscriptions","organizations_url":"https://api.github.com/users/mrice32/orgs","repos_url":"https://api.github.com/users/mrice32/repos","events_url":"https://api.github.com/users/mrice32/events{/privacy}","received_events_url":"https://api.github.com/users/mrice32/received_events","type":"User","site_admin":false},{"login":"alyssawilk","id":18220477,"avatar_url":"https://avatars2.githubusercontent.com/u/18220477?v=4","gravatar_id":"","url":"https://api.github.com/users/alyssawilk","html_url":"https://github.com/alyssawilk","followers_url":"https://api.github.com/users/alyssawilk/followers","following_url":"https://api.github.com/users/alyssawilk/following{/other_user}","gists_url":"https://api.github.com/users/alyssawilk/gists{/gist_id}","starred_url":"https://api.github.com/users/alyssawilk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alyssawilk/subscriptions","organizations_url":"https://api.github.com/users/alyssawilk/orgs","repos_url":"https://api.github.com/users/alyssawilk/repos","events_url":"https://api.github.com/users/alyssawilk/events{/privacy}","received_events_url":"https://api.github.com/users/alyssawilk/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3059/commits","review_comments_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3059/comments","review_comment_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/issues/3059/comments","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/64d8c2a6681e70a31272cded44409ee1007f96a0","head":{"label":"ramaraochavali:feature/native_loglinear_hist","ref":"feature/native_loglinear_hist","sha":"64d8c2a6681e70a31272cded44409ee1007f96a0","user":{"login":"ramaraochavali","id":17204904,"avatar_url":"https://avatars0.githubusercontent.com/u/17204904?v=4","gravatar_id":"","url":"https://api.github.com/users/ramaraochavali","html_url":"https://github.com/ramaraochavali","followers_url":"https://api.github.com/users/ramaraochavali/followers","following_url":"https://api.github.com/users/ramaraochavali/following{/other_user}","gists_url":"https://api.github.com/users/ramaraochavali/gists{/gist_id}","starred_url":"https://api.github.com/users/ramaraochavali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramaraochavali/subscriptions","organizations_url":"https://api.github.com/users/ramaraochavali/orgs","repos_url":"https://api.github.com/users/ramaraochavali/repos","events_url":"https://api.github.com/users/ramaraochavali/events{/privacy}","received_events_url":"https://api.github.com/users/ramaraochavali/received_events","type":"User","site_admin":false},"repo":{"id":107149436,"name":"envoy","full_name":"ramaraochavali/envoy","owner":{"login":"ramaraochavali","id":17204904,"avatar_url":"https://avatars0.githubusercontent.com/u/17204904?v=4","gravatar_id":"","url":"https://api.github.com/users/ramaraochavali","html_url":"https://github.com/ramaraochavali","followers_url":"https://api.github.com/users/ramaraochavali/followers","following_url":"https://api.github.com/users/ramaraochavali/following{/other_user}","gists_url":"https://api.github.com/users/ramaraochavali/gists{/gist_id}","starred_url":"https://api.github.com/users/ramaraochavali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ramaraochavali/subscriptions","organizations_url":"https://api.github.com/users/ramaraochavali/orgs","repos_url":"https://api.github.com/users/ramaraochavali/repos","events_url":"https://api.github.com/users/ramaraochavali/events{/privacy}","received_events_url":"https://api.github.com/users/ramaraochavali/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ramaraochavali/envoy","description":"C++ front/service proxy","fork":true,"url":"https://api.github.com/repos/ramaraochavali/envoy","forks_url":"https://api.github.com/repos/ramaraochavali/envoy/forks","keys_url":"https://api.github.com/repos/ramaraochavali/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ramaraochavali/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ramaraochavali/envoy/teams","hooks_url":"https://api.github.com/repos/ramaraochavali/envoy/hooks","issue_events_url":"https://api.github.com/repos/ramaraochavali/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/ramaraochavali/envoy/events","assignees_url":"https://api.github.com/repos/ramaraochavali/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/ramaraochavali/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/ramaraochavali/envoy/tags","blobs_url":"https://api.github.com/repos/ramaraochavali/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ramaraochavali/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ramaraochavali/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/ramaraochavali/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ramaraochavali/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/ramaraochavali/envoy/languages","stargazers_url":"https://api.github.com/repos/ramaraochavali/envoy/stargazers","contributors_url":"https://api.github.com/repos/ramaraochavali/envoy/contributors","subscribers_url":"https://api.github.com/repos/ramaraochavali/envoy/subscribers","subscription_url":"https://api.github.com/repos/ramaraochavali/envoy/subscription","commits_url":"https://api.github.com/repos/ramaraochavali/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/ramaraochavali/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/ramaraochavali/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/ramaraochavali/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/ramaraochavali/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/ramaraochavali/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ramaraochavali/envoy/merges","archive_url":"https://api.github.com/repos/ramaraochavali/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ramaraochavali/envoy/downloads","issues_url":"https://api.github.com/repos/ramaraochavali/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/ramaraochavali/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/ramaraochavali/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/ramaraochavali/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ramaraochavali/envoy/labels{/name}","releases_url":"https://api.github.com/repos/ramaraochavali/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/ramaraochavali/envoy/deployments","created_at":"2017-10-16T15:50:10Z","updated_at":"2018-04-04T03:46:08Z","pushed_at":"2018-04-16T15:15:28Z","git_url":"git://github.com/ramaraochavali/envoy.git","ssh_url":"git@github.com:ramaraochavali/envoy.git","clone_url":"https://github.com/ramaraochavali/envoy.git","svn_url":"https://github.com/ramaraochavali/envoy","homepage":"https://envoyproxy.github.io/","size":53677,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"envoyproxy:master","ref":"master","sha":"b8e2eee2d47188b9c99499776e8ecd88511184b2","user":{"login":"envoyproxy","id":30125649,"avatar_url":"https://avatars1.githubusercontent.com/u/30125649?v=4","gravatar_id":"","url":"https://api.github.com/users/envoyproxy","html_url":"https://github.com/envoyproxy","followers_url":"https://api.github.com/users/envoyproxy/followers","following_url":"https://api.github.com/users/envoyproxy/following{/other_user}","gists_url":"https://api.github.com/users/envoyproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/envoyproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envoyproxy/subscriptions","organizations_url":"https://api.github.com/users/envoyproxy/orgs","repos_url":"https://api.github.com/users/envoyproxy/repos","events_url":"https://api.github.com/users/envoyproxy/events{/privacy}","received_events_url":"https://api.github.com/users/envoyproxy/received_events","type":"Organization","site_admin":false},"repo":{"id":65214191,"name":"envoy","full_name":"envoyproxy/envoy","owner":{"login":"envoyproxy","id":30125649,"avatar_url":"https://avatars1.githubusercontent.com/u/30125649?v=4","gravatar_id":"","url":"https://api.github.com/users/envoyproxy","html_url":"https://github.com/envoyproxy","followers_url":"https://api.github.com/users/envoyproxy/followers","following_url":"https://api.github.com/users/envoyproxy/following{/other_user}","gists_url":"https://api.github.com/users/envoyproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/envoyproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envoyproxy/subscriptions","organizations_url":"https://api.github.com/users/envoyproxy/orgs","repos_url":"https://api.github.com/users/envoyproxy/repos","events_url":"https://api.github.com/users/envoyproxy/events{/privacy}","received_events_url":"https://api.github.com/users/envoyproxy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/envoyproxy/envoy","description":"C++ front/service proxy","fork":false,"url":"https://api.github.com/repos/envoyproxy/envoy","forks_url":"https://api.github.com/repos/envoyproxy/envoy/forks","keys_url":"https://api.github.com/repos/envoyproxy/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/envoyproxy/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/envoyproxy/envoy/teams","hooks_url":"https://api.github.com/repos/envoyproxy/envoy/hooks","issue_events_url":"https://api.github.com/repos/envoyproxy/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/envoyproxy/envoy/events","assignees_url":"https://api.github.com/repos/envoyproxy/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/envoyproxy/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/envoyproxy/envoy/tags","blobs_url":"https://api.github.com/repos/envoyproxy/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/envoyproxy/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/envoyproxy/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/envoyproxy/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/envoyproxy/envoy/languages","stargazers_url":"https://api.github.com/repos/envoyproxy/envoy/stargazers","contributors_url":"https://api.github.com/repos/envoyproxy/envoy/contributors","subscribers_url":"https://api.github.com/repos/envoyproxy/envoy/subscribers","subscription_url":"https://api.github.com/repos/envoyproxy/envoy/subscription","commits_url":"https://api.github.com/repos/envoyproxy/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/envoyproxy/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/envoyproxy/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/envoyproxy/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/envoyproxy/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/envoyproxy/envoy/merges","archive_url":"https://api.github.com/repos/envoyproxy/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/envoyproxy/envoy/downloads","issues_url":"https://api.github.com/repos/envoyproxy/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/envoyproxy/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/envoyproxy/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/envoyproxy/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/envoyproxy/envoy/labels{/name}","releases_url":"https://api.github.com/repos/envoyproxy/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/envoyproxy/envoy/deployments","created_at":"2016-08-08T15:07:24Z","updated_at":"2018-04-16T23:16:06Z","pushed_at":"2018-04-16T23:39:05Z","git_url":"git://github.com/envoyproxy/envoy.git","ssh_url":"git@github.com:envoyproxy/envoy.git","clone_url":"https://github.com/envoyproxy/envoy.git","svn_url":"https://github.com/envoyproxy/envoy","homepage":"https://www.envoyproxy.io","size":14267,"stargazers_count":4538,"watchers_count":4538,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":571,"mirror_url":null,"archived":false,"open_issues_count":303,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":571,"open_issues":303,"watchers":4538,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3059"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/3059"},"issue":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/3059"},"comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/3059/comments"},"review_comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3059/comments"},"review_comment":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3059/commits"},"statuses":{"href":"https://api.github.com/repos/envoyproxy/envoy/statuses/64d8c2a6681e70a31272cded44409ee1007f96a0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mattklein123"}}