SAMZA-1266: Unable to use MetricsSnapshotReporterFactory with fluent API
authorJacob Maes <jmaes@linkedin.com>
Fri, 5 May 2017 22:48:32 +0000 (15:48 -0700)
committerJacob Maes <jmaes@linkedin.com>
Fri, 5 May 2017 22:48:32 +0000 (15:48 -0700)
Author: Jacob Maes <jmaes@linkedin.com>

Reviewers: Prateek Maheshwari <pmaheshw@linkedin.com>, Navina Ramesh <navina@apache.org>

Closes #167 from jmakes/samza-1266

samza-core/src/main/scala/org/apache/samza/metrics/reporter/MetricsSnapshotReporterFactory.scala

index 60a8d84..052a9d3 100644 (file)
@@ -21,7 +21,7 @@ package org.apache.samza.metrics.reporter
 
 import org.apache.samza.util.Logging
 import org.apache.samza.SamzaException
-import org.apache.samza.config.Config
+import org.apache.samza.config.{ApplicationConfig, Config}
 import org.apache.samza.config.JobConfig.Config2Job
 import org.apache.samza.config.MetricsConfig.Config2Metrics
 import org.apache.samza.config.SystemConfig.Config2System
@@ -49,7 +49,8 @@ class MetricsSnapshotReporterFactory extends MetricsReporterFactory with Logging
 
     val taskClass = config
       .getTaskClass
-      .getOrElse(throw new SamzaException("No task class defined for config."))
+      .orElse(Option(new ApplicationConfig(config).getAppClass()))
+      .getOrElse(throw new SamzaException("No task or app class defined for config."))
 
     val version = Option(Class.forName(taskClass).getPackage.getImplementationVersion)
       .getOrElse({