diff options
author | Ryan Williams <ryan.blake.williams@gmail.com> | 2015-01-25 14:17:59 -0800 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2015-01-25 14:19:09 -0800 |
commit | 1f8b7186813643afdb592131bfd89228ef971e74 (patch) | |
tree | 961bad837f23ef17f4ffce524b93c5949e9cea59 /core/src/main | |
parent | ff2d7bd7b98092610a4f4ba037a56a94eb393527 (diff) | |
download | spark-1f8b7186813643afdb592131bfd89228ef971e74.tar.gz spark-1f8b7186813643afdb592131bfd89228ef971e74.tar.bz2 spark-1f8b7186813643afdb592131bfd89228ef971e74.zip |
[SPARK-5401] set executor ID before creating MetricsSystem
Author: Ryan Williams <ryan.blake.williams@gmail.com>
Closes #4194 from ryan-williams/metrics and squashes the following commits:
7c5a33f [Ryan Williams] set executor ID before creating MetricsSystem
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/scala/org/apache/spark/SparkEnv.scala | 4 | ||||
-rw-r--r-- | core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/core/src/main/scala/org/apache/spark/SparkEnv.scala b/core/src/main/scala/org/apache/spark/SparkEnv.scala index e6ebbff087..5d465c567b 100644 --- a/core/src/main/scala/org/apache/spark/SparkEnv.scala +++ b/core/src/main/scala/org/apache/spark/SparkEnv.scala @@ -330,6 +330,10 @@ object SparkEnv extends Logging { // Then we can start the metrics system. MetricsSystem.createMetricsSystem("driver", conf, securityManager) } else { + // We need to set the executor ID before the MetricsSystem is created because sources and + // sinks specified in the metrics configuration file will want to incorporate this executor's + // ID into the metrics they report. + conf.set("spark.executor.id", executorId) val ms = MetricsSystem.createMetricsSystem("executor", conf, securityManager) ms.start() ms diff --git a/core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala b/core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala index 45633e3de0..83e8eb7126 100644 --- a/core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala +++ b/core/src/main/scala/org/apache/spark/metrics/MetricsSystem.scala @@ -130,8 +130,8 @@ private[spark] class MetricsSystem private ( if (appId.isDefined && executorId.isDefined) { MetricRegistry.name(appId.get, executorId.get, source.sourceName) } else { - // Only Driver and Executor are set spark.app.id and spark.executor.id. - // For instance, Master and Worker are not related to a specific application. + // Only Driver and Executor set spark.app.id and spark.executor.id. + // Other instance types, e.g. Master and Worker, are not related to a specific application. val warningMsg = s"Using default name $defaultName for source because %s is not set." if (appId.isEmpty) { logWarning(warningMsg.format("spark.app.id")) } if (executorId.isEmpty) { logWarning(warningMsg.format("spark.executor.id")) } |