{"action":"created","comment":{"url":"https://api.github.com/repos/apache/flink/pulls/comments/146825259","pull_request_review_id":71822912,"id":146825259,"diff_hunk":"@@ -181,74 +265,23 @@ private void addMetric(Map<String, String> target, String name, MetricDump metri\n \t}\n \n \t// -----------------------------------------------------------------------------------------------------------------\n-\t// Accessors for sub MetricStores\n+\t// sub MetricStore classes\n \t// -----------------------------------------------------------------------------------------------------------------\n \n \t/**\n-\t * Returns the {@link JobManagerMetricStore}.\n-\t *\n-\t * @return JobManagerMetricStore\n-\t */\n-\tpublic JobManagerMetricStore getJobManagerMetricStore() {\n-\t\treturn jobManager;\n-\t}\n-\n-\t/**\n-\t * Returns the {@link TaskManagerMetricStore} for the given taskmanager ID.\n-\t *\n-\t * @param tmID taskmanager ID\n-\t * @return TaskManagerMetricStore for the given ID, or null if no store for the given argument exists\n+\t * Structure containing metrics of a single component.\n \t */\n-\tpublic TaskManagerMetricStore getTaskManagerMetricStore(String tmID) {\n-\t\treturn taskManagers.get(tmID);\n-\t}\n+\t@ThreadSafe\n+\tpublic static class ComponentMetricStore {\n+\t\tpublic final Map<String, String> metrics;\n \n-\t/**\n-\t * Returns the {@link JobMetricStore} for the given job ID.\n-\t *\n-\t * @param jobID job ID\n-\t * @return JobMetricStore for the given ID, or null if no store for the given argument exists\n-\t */\n-\tpublic JobMetricStore getJobMetricStore(String jobID) {\n-\t\treturn jobs.get(jobID);\n-\t}\n-\n-\t/**\n-\t * Returns the {@link TaskMetricStore} for the given job/task ID.\n-\t *\n-\t * @param jobID  job ID\n-\t * @param taskID task ID\n-\t * @return TaskMetricStore for given IDs, or null if no store for the given arguments exists\n-\t */\n-\tpublic TaskMetricStore getTaskMetricStore(String jobID, String taskID) {\n-\t\tJobMetricStore job = getJobMetricStore(jobID);\n-\t\tif (job == null) {\n-\t\t\treturn null;\n+\t\tpublic ComponentMetricStore() {","path":"flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/metrics/MetricStore.java","position":289,"original_position":289,"commit_id":"b19077430808923e047b808f68efd47f4c9527e0","original_commit_id":"b19077430808923e047b808f68efd47f4c9527e0","user":{"login":"zentol","id":5725237,"avatar_url":"https://avatars1.githubusercontent.com/u/5725237?v=4","gravatar_id":"","url":"https://api.github.com/users/zentol","html_url":"https://github.com/zentol","followers_url":"https://api.github.com/users/zentol/followers","following_url":"https://api.github.com/users/zentol/following{/other_user}","gists_url":"https://api.github.com/users/zentol/gists{/gist_id}","starred_url":"https://api.github.com/users/zentol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zentol/subscriptions","organizations_url":"https://api.github.com/users/zentol/orgs","repos_url":"https://api.github.com/users/zentol/repos","events_url":"https://api.github.com/users/zentol/events{/privacy}","received_events_url":"https://api.github.com/users/zentol/received_events","type":"User","site_admin":false},"body":"all constructors can be private","created_at":"2017-10-25T11:17:51Z","updated_at":"2017-10-25T11:19:10Z","html_url":"https://github.com/apache/flink/pull/4840#discussion_r146825259","pull_request_url":"https://api.github.com/repos/apache/flink/pulls/4840","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/comments/146825259"},"html":{"href":"https://github.com/apache/flink/pull/4840#discussion_r146825259"},"pull_request":{"href":"https://api.github.com/repos/apache/flink/pulls/4840"}}},"pull_request":{"url":"https://api.github.com/repos/apache/flink/pulls/4840","id":146808145,"html_url":"https://github.com/apache/flink/pull/4840","diff_url":"https://github.com/apache/flink/pull/4840.diff","patch_url":"https://github.com/apache/flink/pull/4840.patch","issue_url":"https://api.github.com/repos/apache/flink/issues/4840","number":4840,"state":"open","locked":false,"title":"[FLINK-7368][metrics] Make MetricStore ThreadSafe class","user":{"login":"pnowojski","id":8957547,"avatar_url":"https://avatars3.githubusercontent.com/u/8957547?v=4","gravatar_id":"","url":"https://api.github.com/users/pnowojski","html_url":"https://github.com/pnowojski","followers_url":"https://api.github.com/users/pnowojski/followers","following_url":"https://api.github.com/users/pnowojski/following{/other_user}","gists_url":"https://api.github.com/users/pnowojski/gists{/gist_id}","starred_url":"https://api.github.com/users/pnowojski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnowojski/subscriptions","organizations_url":"https://api.github.com/users/pnowojski/orgs","repos_url":"https://api.github.com/users/pnowojski/repos","events_url":"https://api.github.com/users/pnowojski/events{/privacy}","received_events_url":"https://api.github.com/users/pnowojski/received_events","type":"User","site_admin":false},"body":"Remove external synchronisation on MetricStore\r\n\r\n## What is the purpose of the change\r\n\r\nThis is a refactor that makes `MetricStore` thread safe. It achieves it by pulling in all modifying methods and by returning immutable copies in getters.\r\n\r\n## Verifying this change\r\n\r\nThis change is already covered by existing tests, such as `MetricStoreTest` or `MetricFetcherTest`\r\n\r\n## Does this pull request potentially affect one of the following parts:\r\n\r\n  - Dependencies (does it add or upgrade a dependency): (yes / **no**)\r\n  - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)\r\n  - The serializers: (yes / **no** / don't know)\r\n  - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)\r\n  - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)\r\n\r\n## Documentation\r\n\r\n  - Does this pull request introduce a new feature? (yes / **no**)\r\n\r\n","created_at":"2017-10-16T15:00:58Z","updated_at":"2017-10-25T11:19:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d29c686e9a3f754b3dc4b915bbbae66a4bafa7e7","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/flink/pulls/4840/commits","review_comments_url":"https://api.github.com/repos/apache/flink/pulls/4840/comments","review_comment_url":"https://api.github.com/repos/apache/flink/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/flink/issues/4840/comments","statuses_url":"https://api.github.com/repos/apache/flink/statuses/b19077430808923e047b808f68efd47f4c9527e0","head":{"label":"pnowojski:flink7368","ref":"flink7368","sha":"b19077430808923e047b808f68efd47f4c9527e0","user":{"login":"pnowojski","id":8957547,"avatar_url":"https://avatars3.githubusercontent.com/u/8957547?v=4","gravatar_id":"","url":"https://api.github.com/users/pnowojski","html_url":"https://github.com/pnowojski","followers_url":"https://api.github.com/users/pnowojski/followers","following_url":"https://api.github.com/users/pnowojski/following{/other_user}","gists_url":"https://api.github.com/users/pnowojski/gists{/gist_id}","starred_url":"https://api.github.com/users/pnowojski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnowojski/subscriptions","organizations_url":"https://api.github.com/users/pnowojski/orgs","repos_url":"https://api.github.com/users/pnowojski/repos","events_url":"https://api.github.com/users/pnowojski/events{/privacy}","received_events_url":"https://api.github.com/users/pnowojski/received_events","type":"User","site_admin":false},"repo":{"id":94091518,"name":"flink","full_name":"pnowojski/flink","owner":{"login":"pnowojski","id":8957547,"avatar_url":"https://avatars3.githubusercontent.com/u/8957547?v=4","gravatar_id":"","url":"https://api.github.com/users/pnowojski","html_url":"https://github.com/pnowojski","followers_url":"https://api.github.com/users/pnowojski/followers","following_url":"https://api.github.com/users/pnowojski/following{/other_user}","gists_url":"https://api.github.com/users/pnowojski/gists{/gist_id}","starred_url":"https://api.github.com/users/pnowojski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pnowojski/subscriptions","organizations_url":"https://api.github.com/users/pnowojski/orgs","repos_url":"https://api.github.com/users/pnowojski/repos","events_url":"https://api.github.com/users/pnowojski/events{/privacy}","received_events_url":"https://api.github.com/users/pnowojski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pnowojski/flink","description":"Mirror of Apache Flink","fork":true,"url":"https://api.github.com/repos/pnowojski/flink","forks_url":"https://api.github.com/repos/pnowojski/flink/forks","keys_url":"https://api.github.com/repos/pnowojski/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pnowojski/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pnowojski/flink/teams","hooks_url":"https://api.github.com/repos/pnowojski/flink/hooks","issue_events_url":"https://api.github.com/repos/pnowojski/flink/issues/events{/number}","events_url":"https://api.github.com/repos/pnowojski/flink/events","assignees_url":"https://api.github.com/repos/pnowojski/flink/assignees{/user}","branches_url":"https://api.github.com/repos/pnowojski/flink/branches{/branch}","tags_url":"https://api.github.com/repos/pnowojski/flink/tags","blobs_url":"https://api.github.com/repos/pnowojski/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pnowojski/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pnowojski/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/pnowojski/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pnowojski/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/pnowojski/flink/languages","stargazers_url":"https://api.github.com/repos/pnowojski/flink/stargazers","contributors_url":"https://api.github.com/repos/pnowojski/flink/contributors","subscribers_url":"https://api.github.com/repos/pnowojski/flink/subscribers","subscription_url":"https://api.github.com/repos/pnowojski/flink/subscription","commits_url":"https://api.github.com/repos/pnowojski/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/pnowojski/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/pnowojski/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/pnowojski/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/pnowojski/flink/contents/{+path}","compare_url":"https://api.github.com/repos/pnowojski/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pnowojski/flink/merges","archive_url":"https://api.github.com/repos/pnowojski/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pnowojski/flink/downloads","issues_url":"https://api.github.com/repos/pnowojski/flink/issues{/number}","pulls_url":"https://api.github.com/repos/pnowojski/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/pnowojski/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/pnowojski/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pnowojski/flink/labels{/name}","releases_url":"https://api.github.com/repos/pnowojski/flink/releases{/id}","deployments_url":"https://api.github.com/repos/pnowojski/flink/deployments","created_at":"2017-06-12T12:03:15Z","updated_at":"2017-06-12T12:03:37Z","pushed_at":"2017-10-24T15:57:52Z","git_url":"git://github.com/pnowojski/flink.git","ssh_url":"git@github.com:pnowojski/flink.git","clone_url":"https://github.com/pnowojski/flink.git","svn_url":"https://github.com/pnowojski/flink","homepage":null,"size":136119,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"c81a6db44817ce818c949c2fd55ebfc2af0cc913","user":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":20587599,"name":"flink","full_name":"apache/flink","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars0.githubusercontent.com/u/47359?v=4","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/flink","description":"Mirror of Apache Flink","fork":false,"url":"https://api.github.com/repos/apache/flink","forks_url":"https://api.github.com/repos/apache/flink/forks","keys_url":"https://api.github.com/repos/apache/flink/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/flink/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/flink/teams","hooks_url":"https://api.github.com/repos/apache/flink/hooks","issue_events_url":"https://api.github.com/repos/apache/flink/issues/events{/number}","events_url":"https://api.github.com/repos/apache/flink/events","assignees_url":"https://api.github.com/repos/apache/flink/assignees{/user}","branches_url":"https://api.github.com/repos/apache/flink/branches{/branch}","tags_url":"https://api.github.com/repos/apache/flink/tags","blobs_url":"https://api.github.com/repos/apache/flink/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/flink/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/flink/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/flink/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/flink/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/flink/languages","stargazers_url":"https://api.github.com/repos/apache/flink/stargazers","contributors_url":"https://api.github.com/repos/apache/flink/contributors","subscribers_url":"https://api.github.com/repos/apache/flink/subscribers","subscription_url":"https://api.github.com/repos/apache/flink/subscription","commits_url":"https://api.github.com/repos/apache/flink/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/flink/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/flink/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/flink/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/flink/contents/{+path}","compare_url":"https://api.github.com/repos/apache/flink/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/flink/merges","archive_url":"https://api.github.com/repos/apache/flink/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/flink/downloads","issues_url":"https://api.github.com/repos/apache/flink/issues{/number}","pulls_url":"https://api.github.com/repos/apache/flink/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/flink/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/flink/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/flink/labels{/name}","releases_url":"https://api.github.com/repos/apache/flink/releases{/id}","deployments_url":"https://api.github.com/repos/apache/flink/deployments","created_at":"2014-06-07T07:00:10Z","updated_at":"2017-10-25T10:16:44Z","pushed_at":"2017-10-25T10:49:08Z","git_url":"git://github.com/apache/flink.git","ssh_url":"git@github.com:apache/flink.git","clone_url":"https://github.com/apache/flink.git","svn_url":"https://github.com/apache/flink","homepage":null,"size":136102,"stargazers_count":2833,"watchers_count":2833,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1959,"mirror_url":"git://git.apache.org/flink.git","archived":false,"open_issues_count":324,"forks":1959,"open_issues":324,"watchers":2833,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/flink/pulls/4840"},"html":{"href":"https://github.com/apache/flink/pull/4840"},"issue":{"href":"https://api.github.com/repos/apache/flink/issues/4840"},"comments":{"href":"https://api.github.com/repos/apache/flink/issues/4840/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/flink/pulls/4840/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/flink/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/flink/pulls/4840/commits"},"statuses":{"href":"https://api.github.com/repos/apache/flink/statuses/b19077430808923e047b808f68efd47f4c9527e0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"zentol"}}