{"action":"created","comment":{"url":"https://api.github.com/repos/linkedin/gobblin/pulls/comments/48173409","id":48173409,"diff_hunk":"@@ -69,27 +68,43 @@ public static int parsePeriodToSeconds(String periodStr) {\n     }\n   }\n \n-  public static Config setReportingInterval(Config config, long reportingInterval, TimeUnit reportingIntervalUnit) {\n+  public static void setReportingInterval(Properties props, long reportingInterval, TimeUnit reportingIntervalUnit) {\n     long seconds = TimeUnit.SECONDS.convert(reportingInterval, reportingIntervalUnit);\n     if (seconds > Integer.MAX_VALUE) {\n       throw new RuntimeException(String.format(\"Reporting interval is too long. Max: %d seconds.\", Integer.MAX_VALUE));\n     }\n-    return config.withValue(REPORTING_INTERVAL, ConfigValueFactory.fromAnyRef(seconds + \"S\"));\n+    props.setProperty(REPORTING_INTERVAL, Long.toString(seconds) + \"S\");\n   }\n \n+  @Getter\n+  private final TimeUnit rateUnit;\n+\n+  @Getter\n+  private final TimeUnit durationUnit;\n+\n+  private final double rateFactor;\n+  private final double durationFactor;\n+\n   private final ScheduledExecutorService executor;\n   private Optional<ScheduledFuture> scheduledTask;\n   private int reportingPeriodSeconds;\n \n-  public ScheduledReporter(String name, Config config) {\n-    super(name, config);\n+  public ScheduledReporter(String name, TimeUnit rateUnit, TimeUnit durationUnit, Properties props) {","path":"gobblin-metrics/src/main/java/gobblin/metrics/reporter/ScheduledReporter.java","position":72,"original_position":72,"commit_id":"269174216b48fe56417e3b5557f08fddec5c700b","original_commit_id":"269174216b48fe56417e3b5557f08fddec5c700b","user":{"login":"ibuenros","id":1364112,"avatar_url":"https://avatars.githubusercontent.com/u/1364112?v=3","gravatar_id":"","url":"https://api.github.com/users/ibuenros","html_url":"https://github.com/ibuenros","followers_url":"https://api.github.com/users/ibuenros/followers","following_url":"https://api.github.com/users/ibuenros/following{/other_user}","gists_url":"https://api.github.com/users/ibuenros/gists{/gist_id}","starred_url":"https://api.github.com/users/ibuenros/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ibuenros/subscriptions","organizations_url":"https://api.github.com/users/ibuenros/orgs","repos_url":"https://api.github.com/users/ibuenros/repos","events_url":"https://api.github.com/users/ibuenros/events{/privacy}","received_events_url":"https://api.github.com/users/ibuenros/received_events","type":"User","site_admin":false},"body":"Why the change in signature?","created_at":"2015-12-21T18:18:27Z","updated_at":"2015-12-21T18:18:27Z","html_url":"https://github.com/linkedin/gobblin/pull/549#discussion_r48173409","pull_request_url":"https://api.github.com/repos/linkedin/gobblin/pulls/549","_links":{"self":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/comments/48173409"},"html":{"href":"https://github.com/linkedin/gobblin/pull/549#discussion_r48173409"},"pull_request":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/549"}}},"pull_request":{"url":"https://api.github.com/repos/linkedin/gobblin/pulls/549","id":54171254,"html_url":"https://github.com/linkedin/gobblin/pull/549","diff_url":"https://github.com/linkedin/gobblin/pull/549.diff","patch_url":"https://github.com/linkedin/gobblin/pull/549.patch","issue_url":"https://api.github.com/repos/linkedin/gobblin/issues/549","number":549,"state":"open","locked":false,"title":"Migrating KafkaReporter and OutputStreamReporter to MetricReportReporter","user":{"login":"sahilTakiar","id":1282583,"avatar_url":"https://avatars.githubusercontent.com/u/1282583?v=3","gravatar_id":"","url":"https://api.github.com/users/sahilTakiar","html_url":"https://github.com/sahilTakiar","followers_url":"https://api.github.com/users/sahilTakiar/followers","following_url":"https://api.github.com/users/sahilTakiar/following{/other_user}","gists_url":"https://api.github.com/users/sahilTakiar/gists{/gist_id}","starred_url":"https://api.github.com/users/sahilTakiar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sahilTakiar/subscriptions","organizations_url":"https://api.github.com/users/sahilTakiar/orgs","repos_url":"https://api.github.com/users/sahilTakiar/repos","events_url":"https://api.github.com/users/sahilTakiar/events{/privacy}","received_events_url":"https://api.github.com/users/sahilTakiar/received_events","type":"User","site_admin":false},"body":"A majority of these changes are just refactoring / reformatting related. Very little logic has changed, with a number of exceptions:\r\n\r\n* Added a shutdown hook to `RootMetricContext` that closes the `RootMetricContext` and stops all reporters\r\n* Modified the `ScheduledReporter.stopImpl` method to invoke `report` one last time before shutting down\r\n* Remove all uses of TypeSafe's `Config` and replaced it with `Properties`\r\n* Added a new default tag called `metricContextName` which prints the name of the `MetricContext` as one of the `Tag`s\r\n* Modified `GobblinMetrics.buildCustomMetricReporters`\r\n    * There are now two factories for custom reporters: `CustomCodahaleReporterFactory` and `CustomReporterFactory`\r\n    * The reason two different factories are necessary is that only metric reporters were migrated to `gobblin.metrics.report.ScheduledReporter`, while `EventSubmitters` still extend `com.codahale.metrics.ScheduledReporter`\r\n* A number of other changes to `GobblinMetrics` to support using both `gobblin.metrics.report.ScheduledReporter` and `com.codahale.metrics.ScheduledReporter`\r\n* Migrated `KafkaReporter` and `OutputStreamReporter` to extend `MetricReportReporter`\r\n* Still don't know why `KafkaReporterTest` and `KafkaAvroReporterTest` are failing, there seems to be some race condition I haven't been able to pinpoint yet\r\n* A number of changes to how `KafkaAvroReporter`s and `KafkaReporter`s are made - mainly due to the fact that they no longer require a `MetricContext` or a `MetricRegistry` to be created\r\n* `GobblinMetrics`, `RootMetricContext` and `ScheduledReporter` are good classes to start with when reviewing this code\r\n\r\n@ibuenros can you review?","created_at":"2015-12-19T04:41:40Z","updated_at":"2015-12-21T18:18:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"236fdac54ea4abd86360bafd84af146fbf9314cc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/linkedin/gobblin/pulls/549/commits","review_comments_url":"https://api.github.com/repos/linkedin/gobblin/pulls/549/comments","review_comment_url":"https://api.github.com/repos/linkedin/gobblin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/linkedin/gobblin/issues/549/comments","statuses_url":"https://api.github.com/repos/linkedin/gobblin/statuses/269174216b48fe56417e3b5557f08fddec5c700b","head":{"label":"sahilTakiar:distcp-ng-metrics","ref":"distcp-ng-metrics","sha":"269174216b48fe56417e3b5557f08fddec5c700b","user":{"login":"sahilTakiar","id":1282583,"avatar_url":"https://avatars.githubusercontent.com/u/1282583?v=3","gravatar_id":"","url":"https://api.github.com/users/sahilTakiar","html_url":"https://github.com/sahilTakiar","followers_url":"https://api.github.com/users/sahilTakiar/followers","following_url":"https://api.github.com/users/sahilTakiar/following{/other_user}","gists_url":"https://api.github.com/users/sahilTakiar/gists{/gist_id}","starred_url":"https://api.github.com/users/sahilTakiar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sahilTakiar/subscriptions","organizations_url":"https://api.github.com/users/sahilTakiar/orgs","repos_url":"https://api.github.com/users/sahilTakiar/repos","events_url":"https://api.github.com/users/sahilTakiar/events{/privacy}","received_events_url":"https://api.github.com/users/sahilTakiar/received_events","type":"User","site_admin":false},"repo":{"id":38903584,"name":"gobblin","full_name":"sahilTakiar/gobblin","owner":{"login":"sahilTakiar","id":1282583,"avatar_url":"https://avatars.githubusercontent.com/u/1282583?v=3","gravatar_id":"","url":"https://api.github.com/users/sahilTakiar","html_url":"https://github.com/sahilTakiar","followers_url":"https://api.github.com/users/sahilTakiar/followers","following_url":"https://api.github.com/users/sahilTakiar/following{/other_user}","gists_url":"https://api.github.com/users/sahilTakiar/gists{/gist_id}","starred_url":"https://api.github.com/users/sahilTakiar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sahilTakiar/subscriptions","organizations_url":"https://api.github.com/users/sahilTakiar/orgs","repos_url":"https://api.github.com/users/sahilTakiar/repos","events_url":"https://api.github.com/users/sahilTakiar/events{/privacy}","received_events_url":"https://api.github.com/users/sahilTakiar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sahilTakiar/gobblin","description":"Universal data ingestion framework for Hadoop.","fork":true,"url":"https://api.github.com/repos/sahilTakiar/gobblin","forks_url":"https://api.github.com/repos/sahilTakiar/gobblin/forks","keys_url":"https://api.github.com/repos/sahilTakiar/gobblin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sahilTakiar/gobblin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sahilTakiar/gobblin/teams","hooks_url":"https://api.github.com/repos/sahilTakiar/gobblin/hooks","issue_events_url":"https://api.github.com/repos/sahilTakiar/gobblin/issues/events{/number}","events_url":"https://api.github.com/repos/sahilTakiar/gobblin/events","assignees_url":"https://api.github.com/repos/sahilTakiar/gobblin/assignees{/user}","branches_url":"https://api.github.com/repos/sahilTakiar/gobblin/branches{/branch}","tags_url":"https://api.github.com/repos/sahilTakiar/gobblin/tags","blobs_url":"https://api.github.com/repos/sahilTakiar/gobblin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sahilTakiar/gobblin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sahilTakiar/gobblin/git/refs{/sha}","trees_url":"https://api.github.com/repos/sahilTakiar/gobblin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sahilTakiar/gobblin/statuses/{sha}","languages_url":"https://api.github.com/repos/sahilTakiar/gobblin/languages","stargazers_url":"https://api.github.com/repos/sahilTakiar/gobblin/stargazers","contributors_url":"https://api.github.com/repos/sahilTakiar/gobblin/contributors","subscribers_url":"https://api.github.com/repos/sahilTakiar/gobblin/subscribers","subscription_url":"https://api.github.com/repos/sahilTakiar/gobblin/subscription","commits_url":"https://api.github.com/repos/sahilTakiar/gobblin/commits{/sha}","git_commits_url":"https://api.github.com/repos/sahilTakiar/gobblin/git/commits{/sha}","comments_url":"https://api.github.com/repos/sahilTakiar/gobblin/comments{/number}","issue_comment_url":"https://api.github.com/repos/sahilTakiar/gobblin/issues/comments{/number}","contents_url":"https://api.github.com/repos/sahilTakiar/gobblin/contents/{+path}","compare_url":"https://api.github.com/repos/sahilTakiar/gobblin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sahilTakiar/gobblin/merges","archive_url":"https://api.github.com/repos/sahilTakiar/gobblin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sahilTakiar/gobblin/downloads","issues_url":"https://api.github.com/repos/sahilTakiar/gobblin/issues{/number}","pulls_url":"https://api.github.com/repos/sahilTakiar/gobblin/pulls{/number}","milestones_url":"https://api.github.com/repos/sahilTakiar/gobblin/milestones{/number}","notifications_url":"https://api.github.com/repos/sahilTakiar/gobblin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sahilTakiar/gobblin/labels{/name}","releases_url":"https://api.github.com/repos/sahilTakiar/gobblin/releases{/id}","created_at":"2015-07-10T21:50:38Z","updated_at":"2015-07-10T21:50:39Z","pushed_at":"2015-12-19T04:27:24Z","git_url":"git://github.com/sahilTakiar/gobblin.git","ssh_url":"git@github.com:sahilTakiar/gobblin.git","clone_url":"https://github.com/sahilTakiar/gobblin.git","svn_url":"https://github.com/sahilTakiar/gobblin","homepage":"","size":81548,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"linkedin:master","ref":"master","sha":"8ac174aecc80f0fb0bbeb894eef3a524ba08301c","user":{"login":"linkedin","id":357098,"avatar_url":"https://avatars.githubusercontent.com/u/357098?v=3","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"repo":{"id":27392543,"name":"gobblin","full_name":"linkedin/gobblin","owner":{"login":"linkedin","id":357098,"avatar_url":"https://avatars.githubusercontent.com/u/357098?v=3","gravatar_id":"","url":"https://api.github.com/users/linkedin","html_url":"https://github.com/linkedin","followers_url":"https://api.github.com/users/linkedin/followers","following_url":"https://api.github.com/users/linkedin/following{/other_user}","gists_url":"https://api.github.com/users/linkedin/gists{/gist_id}","starred_url":"https://api.github.com/users/linkedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/linkedin/subscriptions","organizations_url":"https://api.github.com/users/linkedin/orgs","repos_url":"https://api.github.com/users/linkedin/repos","events_url":"https://api.github.com/users/linkedin/events{/privacy}","received_events_url":"https://api.github.com/users/linkedin/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/linkedin/gobblin","description":"Universal data ingestion framework for Hadoop.","fork":false,"url":"https://api.github.com/repos/linkedin/gobblin","forks_url":"https://api.github.com/repos/linkedin/gobblin/forks","keys_url":"https://api.github.com/repos/linkedin/gobblin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/linkedin/gobblin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/linkedin/gobblin/teams","hooks_url":"https://api.github.com/repos/linkedin/gobblin/hooks","issue_events_url":"https://api.github.com/repos/linkedin/gobblin/issues/events{/number}","events_url":"https://api.github.com/repos/linkedin/gobblin/events","assignees_url":"https://api.github.com/repos/linkedin/gobblin/assignees{/user}","branches_url":"https://api.github.com/repos/linkedin/gobblin/branches{/branch}","tags_url":"https://api.github.com/repos/linkedin/gobblin/tags","blobs_url":"https://api.github.com/repos/linkedin/gobblin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/linkedin/gobblin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/linkedin/gobblin/git/refs{/sha}","trees_url":"https://api.github.com/repos/linkedin/gobblin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/linkedin/gobblin/statuses/{sha}","languages_url":"https://api.github.com/repos/linkedin/gobblin/languages","stargazers_url":"https://api.github.com/repos/linkedin/gobblin/stargazers","contributors_url":"https://api.github.com/repos/linkedin/gobblin/contributors","subscribers_url":"https://api.github.com/repos/linkedin/gobblin/subscribers","subscription_url":"https://api.github.com/repos/linkedin/gobblin/subscription","commits_url":"https://api.github.com/repos/linkedin/gobblin/commits{/sha}","git_commits_url":"https://api.github.com/repos/linkedin/gobblin/git/commits{/sha}","comments_url":"https://api.github.com/repos/linkedin/gobblin/comments{/number}","issue_comment_url":"https://api.github.com/repos/linkedin/gobblin/issues/comments{/number}","contents_url":"https://api.github.com/repos/linkedin/gobblin/contents/{+path}","compare_url":"https://api.github.com/repos/linkedin/gobblin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/linkedin/gobblin/merges","archive_url":"https://api.github.com/repos/linkedin/gobblin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/linkedin/gobblin/downloads","issues_url":"https://api.github.com/repos/linkedin/gobblin/issues{/number}","pulls_url":"https://api.github.com/repos/linkedin/gobblin/pulls{/number}","milestones_url":"https://api.github.com/repos/linkedin/gobblin/milestones{/number}","notifications_url":"https://api.github.com/repos/linkedin/gobblin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/linkedin/gobblin/labels{/name}","releases_url":"https://api.github.com/repos/linkedin/gobblin/releases{/id}","created_at":"2014-12-01T18:10:50Z","updated_at":"2015-12-21T06:20:37Z","pushed_at":"2015-12-21T10:57:45Z","git_url":"git://github.com/linkedin/gobblin.git","ssh_url":"git@github.com:linkedin/gobblin.git","clone_url":"https://github.com/linkedin/gobblin.git","svn_url":"https://github.com/linkedin/gobblin","homepage":"https://github.com/linkedin/gobblin/wiki","size":159126,"stargazers_count":334,"watchers_count":334,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":132,"mirror_url":null,"open_issues_count":28,"forks":132,"open_issues":28,"watchers":334,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/549"},"html":{"href":"https://github.com/linkedin/gobblin/pull/549"},"issue":{"href":"https://api.github.com/repos/linkedin/gobblin/issues/549"},"comments":{"href":"https://api.github.com/repos/linkedin/gobblin/issues/549/comments"},"review_comments":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/549/comments"},"review_comment":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/linkedin/gobblin/pulls/549/commits"},"statuses":{"href":"https://api.github.com/repos/linkedin/gobblin/statuses/269174216b48fe56417e3b5557f08fddec5c700b"}}}}