Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2432#discussion_r18007450
  
    --- Diff: core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala 
---
    @@ -95,10 +93,27 @@ private[spark] class MetricsSystem private (val 
instance: String,
         sinks.foreach(_.report())
       }
     
    +  def buildRegistryName(source: Source) = {
    +    val appNameOpt = conf.getOption("spark.app.name")
    --- End diff --
    
    As a personal preference, I like to use Scala for-comprehensions when 
dealing with large numbers of optional values like this.  I think you can 
express this as:
    
    ```scala
    for (
       appName <- conf.getOption("spark.app.name")
       appId <- conf.getOption("spark.app.id")
       executorId <- conf.getOption("spark.executor.id")
    ) yield {
      MetricRegistry.name(appId, appName, executorId, source.sourceName)
    }.getOrElse {
      MetricRegistry.name(source.sourceName)
    }
    ```
       


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to