abhishekshivanna commented on a change in pull request #1368:
URL: https://github.com/apache/samza/pull/1368#discussion_r432631182
##########
File path:
samza-core/src/main/scala/org/apache/samza/metrics/reporter/MetricsSnapshotReporterFactory.scala
##########
@@ -77,29 +71,62 @@ class MetricsSnapshotReporterFactory extends
MetricsReporterFactory with Logging
} else {
new MetricsSnapshotSerdeV2
}
-
info("Got serde %s." format serde)
+ serde
+ }
+
- val pollingInterval: Int =
metricsConfig.getMetricsSnapshotReporterInterval(name)
+ def getBlacklist(reporterName: String, config: Config): Option[String] = {
+ val metricsConfig = new MetricsConfig(config)
+ val blacklist =
JavaOptionals.toRichOptional(metricsConfig.getMetricsSnapshotReporterBlacklist(reporterName)).toOption
+ info("Got blacklist as: %s" format blacklist)
+ blacklist
+ }
- info("Setting polling interval to %d" format pollingInterval)
+ def getReportingInterval(reporterName: String, config: Config): Int = {
+ val metricsConfig = new MetricsConfig(config)
+ val reportingInterval =
metricsConfig.getMetricsSnapshotReporterInterval(reporterName)
+ info("Got reporting interval: %d" format reportingInterval)
+ reportingInterval
+ }
+
+ def getJobId(config: Config): String = {
+ val jobConfig = new JobConfig(config)
+ jobConfig.getJobId
+ }
+
+ def getJobName(config: Config): String = {
+ val jobConfig = new JobConfig(config)
+ JavaOptionals.toRichOptional(jobConfig.getName).toOption
+ .getOrElse(throw new SamzaException("Job name must be defined in
config."))
+ }
Review comment:
I feel it helps read the code better. Since this is not a frequently
executed code path it should be fine to trade-off readability for a stack that
is one level deeper.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]