{"action":"created","comment":{"url":"https://api.github.com/repos/seznam/beam/pulls/comments/194414798","pull_request_review_id":126470907,"id":194414798,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDQxNDc5OA==","diff_hunk":"@@ -32,38 +31,66 @@\n import org.slf4j.Logger;\n import org.slf4j.LoggerFactory;\n \n-/** Translation of accumulators to {@link Metrics}. Metrics from same type of accumulator will have\n- * same namespace and will differ only in given name. */\n+/**\n+ * Translation of accumulators to {@link Metrics}. Metric's namespace is taken from operatorName.\n+ * So for better orientation in metrics it's recommended specify operator name with method .named().\n+ */\n public class BeamAccumulatorProvider implements AccumulatorProvider {\n \n   private static final Logger LOG = LoggerFactory.getLogger(BeamAccumulatorProvider.class);\n-  private final Map<String, Counter> counterMap;\n-  private final Map<String, Timer> timerMap;\n-  private final Map<String, Histogram> histogramMap;\n-\n-  private BeamAccumulatorProvider() {\n-    counterMap = new ConcurrentHashMap<>();\n-    timerMap = new ConcurrentHashMap<>();\n-    histogramMap = new ConcurrentHashMap<>();\n-  }\n+  private static final String KEY_METRIC_SEPARATOR = \"::\";\n+\n+  private final Map<String, Counter> counterMap = new ConcurrentHashMap<>();\n+  private final Map<String, Histogram> histogramMap = new ConcurrentHashMap<>();\n+\n+  private BeamAccumulatorProvider() {}\n \n   public static Factory getFactory() {\n     return Factory.get();\n   }\n \n   @Override\n   public Counter getCounter(String name) {\n-    return counterMap.computeIfAbsent(name, BeamMetricsCounter::new);\n+    throw new UnsupportedOperationException(\n+        \"BeamAccumulatorProvider doesn't support\"\n+            + \" getCounter(String name). Need specify operatorName and name\");\n+  }\n+\n+  @Override\n+  public Counter getCounter(final String operatorName, final String name) {\n+    return counterMap.computeIfAbsent(\n+        getMetricKey(operatorName, name), key -> new BeamMetricsCounter(operatorName, name));\n   }\n \n   @Override\n   public Histogram getHistogram(String name) {\n-    return histogramMap.computeIfAbsent(name, BeamMetricsHistogram::new);\n+    throw new UnsupportedOperationException(\n+        \"BeamAccumulatorProvider doesn't support\"\n+            + \" getHistogram(String name). Need specify operatorName and name\");\n+  }\n+\n+  @Override\n+  public Histogram getHistogram(final String operatorName, final String name) {\n+    return histogramMap.computeIfAbsent(\n+        getMetricKey(operatorName, name), key -> new BeamMetricsHistogram(operatorName, name));\n   }\n \n   @Override\n   public Timer getTimer(String name) {\n-    return timerMap.computeIfAbsent(name, BeamMetricsTimer::new);\n+    throw new UnsupportedOperationException(\n+        \"BeamAccumulatorProvider doesn't support\"\n+            + \" getTimer(String name). Need specify operatorName and name\");\n+  }\n+\n+  @Override\n+  public Timer getTimer(String operatorName, String name) {\n+    throw new UnsupportedOperationException(\n+        \"BeamAccumulatorProvider doesn't support\"\n+            + \" getTimer(String name). Use getHistogram instead\");\n+  }\n+\n+  private static String getMetricKey(String operatorName, String name) {","path":"sdks/java/extensions/euphoria/euphoria-beam/src/main/java/org/apache/beam/sdk/extensions/euphoria/beam/BeamAccumulatorProvider.java","position":92,"original_position":84,"commit_id":"1259ae18b458dc4c349bda65a72254c9bc03d86b","original_commit_id":"1259ae18b458dc4c349bda65a72254c9bc03d86b","user":{"login":"dmvk","id":299781,"node_id":"MDQ6VXNlcjI5OTc4MQ==","avatar_url":"https://avatars1.githubusercontent.com/u/299781?v=4","gravatar_id":"","url":"https://api.github.com/users/dmvk","html_url":"https://github.com/dmvk","followers_url":"https://api.github.com/users/dmvk/followers","following_url":"https://api.github.com/users/dmvk/following{/other_user}","gists_url":"https://api.github.com/users/dmvk/gists{/gist_id}","starred_url":"https://api.github.com/users/dmvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmvk/subscriptions","organizations_url":"https://api.github.com/users/dmvk/orgs","repos_url":"https://api.github.com/users/dmvk/repos","events_url":"https://api.github.com/users/dmvk/events{/privacy}","received_events_url":"https://api.github.com/users/dmvk/received_events","type":"User","site_admin":false},"body":"I think we should be consistent, either name the parameter `operatorName` or `namespace`.  I'm 👍 for `namespace`.","created_at":"2018-06-11T14:01:59Z","updated_at":"2018-06-11T14:13:45Z","html_url":"https://github.com/seznam/beam/pull/5#discussion_r194414798","pull_request_url":"https://api.github.com/repos/seznam/beam/pulls/5","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/seznam/beam/pulls/comments/194414798"},"html":{"href":"https://github.com/seznam/beam/pull/5#discussion_r194414798"},"pull_request":{"href":"https://api.github.com/repos/seznam/beam/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/seznam/beam/pulls/5","id":193045512,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkzMDQ1NTEy","html_url":"https://github.com/seznam/beam/pull/5","diff_url":"https://github.com/seznam/beam/pull/5.diff","patch_url":"https://github.com/seznam/beam/pull/5.patch","issue_url":"https://api.github.com/repos/seznam/beam/issues/5","number":5,"state":"open","locked":false,"title":" [BEAM-4478] Accumulators translation to Beam Metrics ","user":{"login":"mareksimunek","id":8159699,"node_id":"MDQ6VXNlcjgxNTk2OTk=","avatar_url":"https://avatars3.githubusercontent.com/u/8159699?v=4","gravatar_id":"","url":"https://api.github.com/users/mareksimunek","html_url":"https://github.com/mareksimunek","followers_url":"https://api.github.com/users/mareksimunek/followers","following_url":"https://api.github.com/users/mareksimunek/following{/other_user}","gists_url":"https://api.github.com/users/mareksimunek/gists{/gist_id}","starred_url":"https://api.github.com/users/mareksimunek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mareksimunek/subscriptions","organizations_url":"https://api.github.com/users/mareksimunek/orgs","repos_url":"https://api.github.com/users/mareksimunek/repos","events_url":"https://api.github.com/users/mareksimunek/events{/privacy}","received_events_url":"https://api.github.com/users/mareksimunek/received_events","type":"User","site_admin":false},"body":"\r\n\r\n------------------------\r\n\r\nFollow this checklist to help us incorporate your contribution quickly and easily:\r\n\r\n - [ ] Make sure there is a [JIRA issue](https://issues.apache.org/jira/projects/BEAM/issues/) filed for the change (usually before you start working on it).  Trivial changes like typos do not require a JIRA issue.  Your pull request should address just this issue, without pulling in other changes.\r\n - [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue.\r\n - [ ] Write a pull request description that is detailed enough to understand:\r\n   - [ ] What the pull request does\r\n   - [ ] Why it does it\r\n   - [ ] How it does it\r\n   - [ ] Why this approach\r\n - [ ] Each commit in the pull request should have a meaningful subject line and body.\r\n - [ ] Run `./gradlew build` to make sure basic checks pass. A more thorough check will be performed on your pull request automatically.\r\n - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).\r\n\r\n","created_at":"2018-06-06T15:05:15Z","updated_at":"2018-06-11T14:13:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4324e785a73d951dcb348bce003acedcf5cbe933","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/seznam/beam/pulls/5/commits","review_comments_url":"https://api.github.com/repos/seznam/beam/pulls/5/comments","review_comment_url":"https://api.github.com/repos/seznam/beam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/seznam/beam/issues/5/comments","statuses_url":"https://api.github.com/repos/seznam/beam/statuses/1259ae18b458dc4c349bda65a72254c9bc03d86b","head":{"label":"seznam:simunek/accumulatorsToBeamMetrics/BEAM-4478","ref":"simunek/accumulatorsToBeamMetrics/BEAM-4478","sha":"1259ae18b458dc4c349bda65a72254c9bc03d86b","user":{"login":"seznam","id":192214,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjIxNA==","avatar_url":"https://avatars3.githubusercontent.com/u/192214?v=4","gravatar_id":"","url":"https://api.github.com/users/seznam","html_url":"https://github.com/seznam","followers_url":"https://api.github.com/users/seznam/followers","following_url":"https://api.github.com/users/seznam/following{/other_user}","gists_url":"https://api.github.com/users/seznam/gists{/gist_id}","starred_url":"https://api.github.com/users/seznam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seznam/subscriptions","organizations_url":"https://api.github.com/users/seznam/orgs","repos_url":"https://api.github.com/users/seznam/repos","events_url":"https://api.github.com/users/seznam/events{/privacy}","received_events_url":"https://api.github.com/users/seznam/received_events","type":"Organization","site_admin":false},"repo":{"id":133642640,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM2NDI2NDA=","name":"beam","full_name":"seznam/beam","owner":{"login":"seznam","id":192214,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjIxNA==","avatar_url":"https://avatars3.githubusercontent.com/u/192214?v=4","gravatar_id":"","url":"https://api.github.com/users/seznam","html_url":"https://github.com/seznam","followers_url":"https://api.github.com/users/seznam/followers","following_url":"https://api.github.com/users/seznam/following{/other_user}","gists_url":"https://api.github.com/users/seznam/gists{/gist_id}","starred_url":"https://api.github.com/users/seznam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seznam/subscriptions","organizations_url":"https://api.github.com/users/seznam/orgs","repos_url":"https://api.github.com/users/seznam/repos","events_url":"https://api.github.com/users/seznam/events{/privacy}","received_events_url":"https://api.github.com/users/seznam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/seznam/beam","description":"Apache Beam fork for Euphoria DSL integration","fork":true,"url":"https://api.github.com/repos/seznam/beam","forks_url":"https://api.github.com/repos/seznam/beam/forks","keys_url":"https://api.github.com/repos/seznam/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/seznam/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/seznam/beam/teams","hooks_url":"https://api.github.com/repos/seznam/beam/hooks","issue_events_url":"https://api.github.com/repos/seznam/beam/issues/events{/number}","events_url":"https://api.github.com/repos/seznam/beam/events","assignees_url":"https://api.github.com/repos/seznam/beam/assignees{/user}","branches_url":"https://api.github.com/repos/seznam/beam/branches{/branch}","tags_url":"https://api.github.com/repos/seznam/beam/tags","blobs_url":"https://api.github.com/repos/seznam/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/seznam/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/seznam/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/seznam/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/seznam/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/seznam/beam/languages","stargazers_url":"https://api.github.com/repos/seznam/beam/stargazers","contributors_url":"https://api.github.com/repos/seznam/beam/contributors","subscribers_url":"https://api.github.com/repos/seznam/beam/subscribers","subscription_url":"https://api.github.com/repos/seznam/beam/subscription","commits_url":"https://api.github.com/repos/seznam/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/seznam/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/seznam/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/seznam/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/seznam/beam/contents/{+path}","compare_url":"https://api.github.com/repos/seznam/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/seznam/beam/merges","archive_url":"https://api.github.com/repos/seznam/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/seznam/beam/downloads","issues_url":"https://api.github.com/repos/seznam/beam/issues{/number}","pulls_url":"https://api.github.com/repos/seznam/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/seznam/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/seznam/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/seznam/beam/labels{/name}","releases_url":"https://api.github.com/repos/seznam/beam/releases{/id}","deployments_url":"https://api.github.com/repos/seznam/beam/deployments","created_at":"2018-05-16T09:32:14Z","updated_at":"2018-06-08T10:23:48Z","pushed_at":"2018-06-11T13:35:22Z","git_url":"git://github.com/seznam/beam.git","ssh_url":"git@github.com:seznam/beam.git","clone_url":"https://github.com/seznam/beam.git","svn_url":"https://github.com/seznam/beam","homepage":"","size":63697,"stargazers_count":0,"watchers_count":0,"language":"Java","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":3,"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":3,"watchers":0,"default_branch":"dsl-euphoria"}},"base":{"label":"seznam:dsl-euphoria","ref":"dsl-euphoria","sha":"21bea71bdb76015a252fc43965e5b361a0f50f05","user":{"login":"seznam","id":192214,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjIxNA==","avatar_url":"https://avatars3.githubusercontent.com/u/192214?v=4","gravatar_id":"","url":"https://api.github.com/users/seznam","html_url":"https://github.com/seznam","followers_url":"https://api.github.com/users/seznam/followers","following_url":"https://api.github.com/users/seznam/following{/other_user}","gists_url":"https://api.github.com/users/seznam/gists{/gist_id}","starred_url":"https://api.github.com/users/seznam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seznam/subscriptions","organizations_url":"https://api.github.com/users/seznam/orgs","repos_url":"https://api.github.com/users/seznam/repos","events_url":"https://api.github.com/users/seznam/events{/privacy}","received_events_url":"https://api.github.com/users/seznam/received_events","type":"Organization","site_admin":false},"repo":{"id":133642640,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM2NDI2NDA=","name":"beam","full_name":"seznam/beam","owner":{"login":"seznam","id":192214,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5MjIxNA==","avatar_url":"https://avatars3.githubusercontent.com/u/192214?v=4","gravatar_id":"","url":"https://api.github.com/users/seznam","html_url":"https://github.com/seznam","followers_url":"https://api.github.com/users/seznam/followers","following_url":"https://api.github.com/users/seznam/following{/other_user}","gists_url":"https://api.github.com/users/seznam/gists{/gist_id}","starred_url":"https://api.github.com/users/seznam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seznam/subscriptions","organizations_url":"https://api.github.com/users/seznam/orgs","repos_url":"https://api.github.com/users/seznam/repos","events_url":"https://api.github.com/users/seznam/events{/privacy}","received_events_url":"https://api.github.com/users/seznam/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/seznam/beam","description":"Apache Beam fork for Euphoria DSL integration","fork":true,"url":"https://api.github.com/repos/seznam/beam","forks_url":"https://api.github.com/repos/seznam/beam/forks","keys_url":"https://api.github.com/repos/seznam/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/seznam/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/seznam/beam/teams","hooks_url":"https://api.github.com/repos/seznam/beam/hooks","issue_events_url":"https://api.github.com/repos/seznam/beam/issues/events{/number}","events_url":"https://api.github.com/repos/seznam/beam/events","assignees_url":"https://api.github.com/repos/seznam/beam/assignees{/user}","branches_url":"https://api.github.com/repos/seznam/beam/branches{/branch}","tags_url":"https://api.github.com/repos/seznam/beam/tags","blobs_url":"https://api.github.com/repos/seznam/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/seznam/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/seznam/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/seznam/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/seznam/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/seznam/beam/languages","stargazers_url":"https://api.github.com/repos/seznam/beam/stargazers","contributors_url":"https://api.github.com/repos/seznam/beam/contributors","subscribers_url":"https://api.github.com/repos/seznam/beam/subscribers","subscription_url":"https://api.github.com/repos/seznam/beam/subscription","commits_url":"https://api.github.com/repos/seznam/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/seznam/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/seznam/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/seznam/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/seznam/beam/contents/{+path}","compare_url":"https://api.github.com/repos/seznam/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/seznam/beam/merges","archive_url":"https://api.github.com/repos/seznam/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/seznam/beam/downloads","issues_url":"https://api.github.com/repos/seznam/beam/issues{/number}","pulls_url":"https://api.github.com/repos/seznam/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/seznam/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/seznam/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/seznam/beam/labels{/name}","releases_url":"https://api.github.com/repos/seznam/beam/releases{/id}","deployments_url":"https://api.github.com/repos/seznam/beam/deployments","created_at":"2018-05-16T09:32:14Z","updated_at":"2018-06-08T10:23:48Z","pushed_at":"2018-06-11T13:35:22Z","git_url":"git://github.com/seznam/beam.git","ssh_url":"git@github.com:seznam/beam.git","clone_url":"https://github.com/seznam/beam.git","svn_url":"https://github.com/seznam/beam","homepage":"","size":63697,"stargazers_count":0,"watchers_count":0,"language":"Java","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":3,"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":3,"watchers":0,"default_branch":"dsl-euphoria"}},"_links":{"self":{"href":"https://api.github.com/repos/seznam/beam/pulls/5"},"html":{"href":"https://github.com/seznam/beam/pull/5"},"issue":{"href":"https://api.github.com/repos/seznam/beam/issues/5"},"comments":{"href":"https://api.github.com/repos/seznam/beam/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/seznam/beam/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/seznam/beam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/seznam/beam/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/seznam/beam/statuses/1259ae18b458dc4c349bda65a72254c9bc03d86b"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"dmvk"}}