{"action":"created","comment":{"url":"https://api.github.com/repos/apache/beam/pulls/comments/181877336","pull_request_review_id":112578889,"id":181877336,"diff_hunk":"@@ -338,6 +337,7 @@ def run_pipeline(self, pipeline):\n     from apache_beam.runners.direct.transform_evaluator import \\\n       TransformEvaluatorRegistry\n     from apache_beam.testing.test_stream import TestStream\n+    from apache_beam.metrics.execution import MetricsEnvironment","path":"sdks/python/apache_beam/runners/direct/direct_runner.py","position":null,"original_position":12,"commit_id":"b006b50f01e944af2da26745904d89f965ca00d1","original_commit_id":"1c585e8e4ea67a6d96a3a75114fcc65a3d4ec7d2","user":{"login":"pabloem","id":1301740,"avatar_url":"https://avatars2.githubusercontent.com/u/1301740?v=4","gravatar_id":"","url":"https://api.github.com/users/pabloem","html_url":"https://github.com/pabloem","followers_url":"https://api.github.com/users/pabloem/followers","following_url":"https://api.github.com/users/pabloem/following{/other_user}","gists_url":"https://api.github.com/users/pabloem/gists{/gist_id}","starred_url":"https://api.github.com/users/pabloem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pabloem/subscriptions","organizations_url":"https://api.github.com/users/pabloem/orgs","repos_url":"https://api.github.com/users/pabloem/repos","events_url":"https://api.github.com/users/pabloem/events{/privacy}","received_events_url":"https://api.github.com/users/pabloem/received_events","type":"User","site_admin":false},"body":"That is reasonable, and I agree. I've fixed this by having a lazy import in the metrics execution module.\r\nCurrently, we're working under the idea that state sampler is the global context provider, so metrics rely on it. I'd think that makes it into a module that provides a service to other modules that require/handle context management. Though I'd agree that a more loose coupling would be good to have.","created_at":"2018-04-16T20:38:06Z","updated_at":"2018-04-16T20:38:06Z","html_url":"https://github.com/apache/beam/pull/4387#discussion_r181877336","pull_request_url":"https://api.github.com/repos/apache/beam/pulls/4387","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/apache/beam/pulls/comments/181877336"},"html":{"href":"https://github.com/apache/beam/pull/4387#discussion_r181877336"},"pull_request":{"href":"https://api.github.com/repos/apache/beam/pulls/4387"}},"in_reply_to_id":181855332},"pull_request":{"url":"https://api.github.com/repos/apache/beam/pulls/4387","id":162255181,"html_url":"https://github.com/apache/beam/pull/4387","diff_url":"https://github.com/apache/beam/pull/4387.diff","patch_url":"https://github.com/apache/beam/pull/4387.patch","issue_url":"https://api.github.com/repos/apache/beam/issues/4387","number":4387,"state":"open","locked":false,"title":"[BEAM-2732] Metrics rely on statesampler state","user":{"login":"pabloem","id":1301740,"avatar_url":"https://avatars2.githubusercontent.com/u/1301740?v=4","gravatar_id":"","url":"https://api.github.com/users/pabloem","html_url":"https://github.com/pabloem","followers_url":"https://api.github.com/users/pabloem/followers","following_url":"https://api.github.com/users/pabloem/following{/other_user}","gists_url":"https://api.github.com/users/pabloem/gists{/gist_id}","starred_url":"https://api.github.com/users/pabloem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pabloem/subscriptions","organizations_url":"https://api.github.com/users/pabloem/orgs","repos_url":"https://api.github.com/users/pabloem/repos","events_url":"https://api.github.com/users/pabloem/events{/privacy}","received_events_url":"https://api.github.com/users/pabloem/received_events","type":"User","site_admin":false},"body":"This PR depends on PR #4375.\r\n\r\nThis PR is a backward-compatible change that allows metrics to rely on statesampler state to provide the current container.\r\n\r\nThis change should enable all clients to stop tracking metrics with its own context, and start using statesampler for that.\r\n\r\nBenchmarks showed no impact on performance. Benchmark done using an ML Criteo pipeline that processes 10gb.\r\n\r\nResults Before Change (5 runs):\r\nMean: 1809.2s, Stdev: 227.1622768\r\n\r\nResults With Change (5 runs):\r\nMean: 1758.4s, Stdev: 93.46282684","created_at":"2018-01-10T23:14:42Z","updated_at":"2018-04-16T20:38:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"439b20a7a5275b07e8311a8ce000fdce3e1366e3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/beam/pulls/4387/commits","review_comments_url":"https://api.github.com/repos/apache/beam/pulls/4387/comments","review_comment_url":"https://api.github.com/repos/apache/beam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/beam/issues/4387/comments","statuses_url":"https://api.github.com/repos/apache/beam/statuses/b006b50f01e944af2da26745904d89f965ca00d1","head":{"label":"pabloem:global-sampler-metrics","ref":"global-sampler-metrics","sha":"b006b50f01e944af2da26745904d89f965ca00d1","user":{"login":"pabloem","id":1301740,"avatar_url":"https://avatars2.githubusercontent.com/u/1301740?v=4","gravatar_id":"","url":"https://api.github.com/users/pabloem","html_url":"https://github.com/pabloem","followers_url":"https://api.github.com/users/pabloem/followers","following_url":"https://api.github.com/users/pabloem/following{/other_user}","gists_url":"https://api.github.com/users/pabloem/gists{/gist_id}","starred_url":"https://api.github.com/users/pabloem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pabloem/subscriptions","organizations_url":"https://api.github.com/users/pabloem/orgs","repos_url":"https://api.github.com/users/pabloem/repos","events_url":"https://api.github.com/users/pabloem/events{/privacy}","received_events_url":"https://api.github.com/users/pabloem/received_events","type":"User","site_admin":false},"repo":{"id":69611732,"name":"incubator-beam","full_name":"pabloem/incubator-beam","owner":{"login":"pabloem","id":1301740,"avatar_url":"https://avatars2.githubusercontent.com/u/1301740?v=4","gravatar_id":"","url":"https://api.github.com/users/pabloem","html_url":"https://github.com/pabloem","followers_url":"https://api.github.com/users/pabloem/followers","following_url":"https://api.github.com/users/pabloem/following{/other_user}","gists_url":"https://api.github.com/users/pabloem/gists{/gist_id}","starred_url":"https://api.github.com/users/pabloem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pabloem/subscriptions","organizations_url":"https://api.github.com/users/pabloem/orgs","repos_url":"https://api.github.com/users/pabloem/repos","events_url":"https://api.github.com/users/pabloem/events{/privacy}","received_events_url":"https://api.github.com/users/pabloem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pabloem/incubator-beam","description":"Mirror of Apache Beam (Incubating)","fork":true,"url":"https://api.github.com/repos/pabloem/incubator-beam","forks_url":"https://api.github.com/repos/pabloem/incubator-beam/forks","keys_url":"https://api.github.com/repos/pabloem/incubator-beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pabloem/incubator-beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pabloem/incubator-beam/teams","hooks_url":"https://api.github.com/repos/pabloem/incubator-beam/hooks","issue_events_url":"https://api.github.com/repos/pabloem/incubator-beam/issues/events{/number}","events_url":"https://api.github.com/repos/pabloem/incubator-beam/events","assignees_url":"https://api.github.com/repos/pabloem/incubator-beam/assignees{/user}","branches_url":"https://api.github.com/repos/pabloem/incubator-beam/branches{/branch}","tags_url":"https://api.github.com/repos/pabloem/incubator-beam/tags","blobs_url":"https://api.github.com/repos/pabloem/incubator-beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pabloem/incubator-beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pabloem/incubator-beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/pabloem/incubator-beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pabloem/incubator-beam/statuses/{sha}","languages_url":"https://api.github.com/repos/pabloem/incubator-beam/languages","stargazers_url":"https://api.github.com/repos/pabloem/incubator-beam/stargazers","contributors_url":"https://api.github.com/repos/pabloem/incubator-beam/contributors","subscribers_url":"https://api.github.com/repos/pabloem/incubator-beam/subscribers","subscription_url":"https://api.github.com/repos/pabloem/incubator-beam/subscription","commits_url":"https://api.github.com/repos/pabloem/incubator-beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/pabloem/incubator-beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/pabloem/incubator-beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/pabloem/incubator-beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/pabloem/incubator-beam/contents/{+path}","compare_url":"https://api.github.com/repos/pabloem/incubator-beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pabloem/incubator-beam/merges","archive_url":"https://api.github.com/repos/pabloem/incubator-beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pabloem/incubator-beam/downloads","issues_url":"https://api.github.com/repos/pabloem/incubator-beam/issues{/number}","pulls_url":"https://api.github.com/repos/pabloem/incubator-beam/pulls{/number}","milestones_url":"https://api.github.com/repos/pabloem/incubator-beam/milestones{/number}","notifications_url":"https://api.github.com/repos/pabloem/incubator-beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pabloem/incubator-beam/labels{/name}","releases_url":"https://api.github.com/repos/pabloem/incubator-beam/releases{/id}","deployments_url":"https://api.github.com/repos/pabloem/incubator-beam/deployments","created_at":"2016-09-29T22:05:49Z","updated_at":"2016-09-29T22:05:54Z","pushed_at":"2018-04-16T20:38:02Z","git_url":"git://github.com/pabloem/incubator-beam.git","ssh_url":"git@github.com:pabloem/incubator-beam.git","clone_url":"https://github.com/pabloem/incubator-beam.git","svn_url":"https://github.com/pabloem/incubator-beam","homepage":null,"size":55814,"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":1,"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"},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"9e3e9c4d0a0dc1574c8956c7f8379b37ba262cb2","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":50904245,"name":"beam","full_name":"apache/beam","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/beam","description":"Apache Beam","fork":false,"url":"https://api.github.com/repos/apache/beam","forks_url":"https://api.github.com/repos/apache/beam/forks","keys_url":"https://api.github.com/repos/apache/beam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/beam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/beam/teams","hooks_url":"https://api.github.com/repos/apache/beam/hooks","issue_events_url":"https://api.github.com/repos/apache/beam/issues/events{/number}","events_url":"https://api.github.com/repos/apache/beam/events","assignees_url":"https://api.github.com/repos/apache/beam/assignees{/user}","branches_url":"https://api.github.com/repos/apache/beam/branches{/branch}","tags_url":"https://api.github.com/repos/apache/beam/tags","blobs_url":"https://api.github.com/repos/apache/beam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/beam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/beam/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/beam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/beam/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/beam/languages","stargazers_url":"https://api.github.com/repos/apache/beam/stargazers","contributors_url":"https://api.github.com/repos/apache/beam/contributors","subscribers_url":"https://api.github.com/repos/apache/beam/subscribers","subscription_url":"https://api.github.com/repos/apache/beam/subscription","commits_url":"https://api.github.com/repos/apache/beam/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/beam/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/beam/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/beam/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/beam/contents/{+path}","compare_url":"https://api.github.com/repos/apache/beam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/beam/merges","archive_url":"https://api.github.com/repos/apache/beam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/beam/downloads","issues_url":"https://api.github.com/repos/apache/beam/issues{/number}","pulls_url":"https://api.github.com/repos/apache/beam/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/beam/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/beam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/beam/labels{/name}","releases_url":"https://api.github.com/repos/apache/beam/releases{/id}","deployments_url":"https://api.github.com/repos/apache/beam/deployments","created_at":"2016-02-02T08:00:06Z","updated_at":"2018-04-16T18:49:55Z","pushed_at":"2018-04-16T20:38:04Z","git_url":"git://github.com/apache/beam.git","ssh_url":"git@github.com:apache/beam.git","clone_url":"https://github.com/apache/beam.git","svn_url":"https://github.com/apache/beam","homepage":"","size":56846,"stargazers_count":1818,"watchers_count":1818,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1102,"mirror_url":null,"archived":false,"open_issues_count":116,"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":1102,"open_issues":116,"watchers":1818,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/beam/pulls/4387"},"html":{"href":"https://github.com/apache/beam/pull/4387"},"issue":{"href":"https://api.github.com/repos/apache/beam/issues/4387"},"comments":{"href":"https://api.github.com/repos/apache/beam/issues/4387/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/beam/pulls/4387/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/beam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/beam/pulls/4387/commits"},"statuses":{"href":"https://api.github.com/repos/apache/beam/statuses/b006b50f01e944af2da26745904d89f965ca00d1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pabloem"}}