{"action":"created","comment":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/196172577","pull_request_review_id":129675226,"id":196172577,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjE3MjU3Nw==","diff_hunk":"@@ -408,25 +408,36 @@ typedef std::unique_ptr<StoreRoot> StoreRootPtr;\n struct RawStatData;\n \n /**\n- * Abstract interface for allocating a RawStatData.\n+ * Abstract interface for allocating statistics. Implementations can\n+ * be created utilizing a single fixed-size block suitable for\n+ * shared-memory, or in the heap, allowing for pointers and sharing of\n+ * substrings, with an opportunity for reduced memory consumption.\n  */\n-class RawStatDataAllocator {\n+class StatDataAllocator {\n public:\n-  virtual ~RawStatDataAllocator() {}\n+  virtual ~StatDataAllocator() {}\n \n   /**\n-   * @return RawStatData* a raw stat data block for a given stat name or nullptr if there is no\n-   *         more memory available for stats. The allocator should return a reference counted\n-   *         data location by name if one already exists with the same name. This is used for\n-   *         intra-process scope swapping as well as inter-process hot restart.\n+   * @param name the full name of the stat.\n+   * @param tag_extracted_name the name of the stat with tag-values stripped out.\n+   * @param tags the extracted tag values.\n+   * @return Counter* a counter, or nullptr if allocation failed.\n    */\n-  virtual RawStatData* alloc(const std::string& name) PURE;\n+  virtual CounterSharedPtr makeCounter(const std::string& name, std::string& tag_extracted_name,","path":"include/envoy/stats/stats.h","position":27,"original_position":27,"commit_id":"45231c995ca22c8d98c9a9785ca8e28e6fecb7cb","original_commit_id":"45231c995ca22c8d98c9a9785ca8e28e6fecb7cb","user":{"login":"mrice32","id":11791551,"node_id":"MDQ6VXNlcjExNzkxNTUx","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},"body":"`tag_extracted_name` and `tags` are passed as references not so they can be modified and read by the caller, but so that they can be moved.  I think a better way to communicate this in the interface is by making them rvalue references (for example: `std::string&& tag_extracted_name`), which will force all callers to wrap them in `std::move()` or pass an actual rvalue.\r\n\r\nAlso, the interface should document that if the returned CounterSharedPtr is `nullptr`, then these objects will not be moved/modified (we assume this at the callsite).\r\n\r\nSimilar comments for `makeGauge()`.","created_at":"2018-06-18T18:05:28Z","updated_at":"2018-06-18T18:06:14Z","html_url":"https://github.com/envoyproxy/envoy/pull/3606#discussion_r196172577","pull_request_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3606","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/196172577"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/3606#discussion_r196172577"},"pull_request":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3606"}}},"pull_request":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3606","id":194380204,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0MzgwMjA0","html_url":"https://github.com/envoyproxy/envoy/pull/3606","diff_url":"https://github.com/envoyproxy/envoy/pull/3606.diff","patch_url":"https://github.com/envoyproxy/envoy/pull/3606.patch","issue_url":"https://api.github.com/repos/envoyproxy/envoy/issues/3606","number":3606,"state":"open","locked":false,"title":"stats: refactor to enable non-hot-restart stats to have distinct representation from hot-restart stats.","user":{"login":"jmarantz","id":1942589,"node_id":"MDQ6VXNlcjE5NDI1ODk=","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},"body":"*Description*:\r\n>Currently the presence of hot_restart as an option requires that all stats to be allocated in block of memory pre-allocated at runtime. This may present scalability challenges in some environments for a couple of reasons: \r\n 1. Committing to the maximum number & size of stats on startup\r\n 2. Difficulty of employing complex structures such as reference-counted symbol tables to share common substrings\r\nThis PR does some refactoring to make it easier to create an alternate stats representation for the non-hot-restart case. Note that it does not actually do that: just makes it easier by virtualizing makeCounter and makeGauge.\r\n\r\nSee https://github.com/envoyproxy/envoy/issues/3585 for more discussion.\r\n\r\n*Risk Level*: Medium\r\n\r\n*Testing*: //test/...\r\n","created_at":"2018-06-12T19:14:49Z","updated_at":"2018-06-18T18:06:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8b04f610c328f948c479461bc1395496ef9160d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3606/commits","review_comments_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/3606/comments","review_comment_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/issues/3606/comments","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/45231c995ca22c8d98c9a9785ca8e28e6fecb7cb","head":{"label":"jmarantz:virtualize-make-stats","ref":"virtualize-make-stats","sha":"45231c995ca22c8d98c9a9785ca8e28e6fecb7cb","user":{"login":"jmarantz","id":1942589,"node_id":"MDQ6VXNlcjE5NDI1ODk=","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},"repo":{"id":109787330,"node_id":"MDEwOlJlcG9zaXRvcnkxMDk3ODczMzA=","name":"envoy","full_name":"jmarantz/envoy","owner":{"login":"jmarantz","id":1942589,"node_id":"MDQ6VXNlcjE5NDI1ODk=","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},"private":false,"html_url":"https://github.com/jmarantz/envoy","description":"C++ front/service proxy","fork":true,"url":"https://api.github.com/repos/jmarantz/envoy","forks_url":"https://api.github.com/repos/jmarantz/envoy/forks","keys_url":"https://api.github.com/repos/jmarantz/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jmarantz/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jmarantz/envoy/teams","hooks_url":"https://api.github.com/repos/jmarantz/envoy/hooks","issue_events_url":"https://api.github.com/repos/jmarantz/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/jmarantz/envoy/events","assignees_url":"https://api.github.com/repos/jmarantz/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/jmarantz/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/jmarantz/envoy/tags","blobs_url":"https://api.github.com/repos/jmarantz/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jmarantz/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jmarantz/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/jmarantz/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jmarantz/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/jmarantz/envoy/languages","stargazers_url":"https://api.github.com/repos/jmarantz/envoy/stargazers","contributors_url":"https://api.github.com/repos/jmarantz/envoy/contributors","subscribers_url":"https://api.github.com/repos/jmarantz/envoy/subscribers","subscription_url":"https://api.github.com/repos/jmarantz/envoy/subscription","commits_url":"https://api.github.com/repos/jmarantz/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/jmarantz/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/jmarantz/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/jmarantz/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/jmarantz/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/jmarantz/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jmarantz/envoy/merges","archive_url":"https://api.github.com/repos/jmarantz/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jmarantz/envoy/downloads","issues_url":"https://api.github.com/repos/jmarantz/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/jmarantz/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/jmarantz/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/jmarantz/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jmarantz/envoy/labels{/name}","releases_url":"https://api.github.com/repos/jmarantz/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/jmarantz/envoy/deployments","created_at":"2017-11-07T04:36:02Z","updated_at":"2018-06-15T21:54:28Z","pushed_at":"2018-06-15T21:54:26Z","git_url":"git://github.com/jmarantz/envoy.git","ssh_url":"git@github.com:jmarantz/envoy.git","clone_url":"https://github.com/jmarantz/envoy.git","svn_url":"https://github.com/jmarantz/envoy","homepage":"https://envoyproxy.github.io/","size":58120,"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":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"envoyproxy:master","ref":"master","sha":"6d3d5d72986c2131a40268467c3ddcc57ef7bbc7","user":{"login":"envoyproxy","id":30125649,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMTI1NjQ5","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,"node_id":"MDEwOlJlcG9zaXRvcnk2NTIxNDE5MQ==","name":"envoy","full_name":"envoyproxy/envoy","owner":{"login":"envoyproxy","id":30125649,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMTI1NjQ5","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-06-18T16:52:55Z","pushed_at":"2018-06-18T17:21:03Z","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":16494,"stargazers_count":5271,"watchers_count":5271,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":676,"mirror_url":null,"archived":false,"open_issues_count":324,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":676,"open_issues":324,"watchers":5271,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3606"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/3606"},"issue":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/3606"},"comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/3606/comments"},"review_comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3606/comments"},"review_comment":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/3606/commits"},"statuses":{"href":"https://api.github.com/repos/envoyproxy/envoy/statuses/45231c995ca22c8d98c9a9785ca8e28e6fecb7cb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mrice32"}}