aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew xia <junluan.xia@intel.com>2013-07-02 10:41:43 +0800
committerjerryshao <saisai.shao@intel.com>2013-07-24 14:57:47 +0800
commit5f8802c1fb106cc04c30b6aca0a6ce98fa5c0e15 (patch)
treece664cd200348472d53ea8dab2ba77164435cddb
parent9cea0c28184c86625f8281eea2af77eff15acb73 (diff)
downloadspark-5f8802c1fb106cc04c30b6aca0a6ce98fa5c0e15.tar.gz
spark-5f8802c1fb106cc04c30b6aca0a6ce98fa5c0e15.tar.bz2
spark-5f8802c1fb106cc04c30b6aca0a6ce98fa5c0e15.zip
Register and init metricsSystem in SparkContext
Conflicts: core/src/main/scala/spark/SparkContext.scala core/src/main/scala/spark/SparkEnv.scala
-rw-r--r--core/src/main/scala/spark/SparkContext.scala10
-rw-r--r--core/src/main/scala/spark/SparkEnv.scala4
2 files changed, 8 insertions, 6 deletions
diff --git a/core/src/main/scala/spark/SparkContext.scala b/core/src/main/scala/spark/SparkContext.scala
index a6128a9f30..1255d0c72e 100644
--- a/core/src/main/scala/spark/SparkContext.scala
+++ b/core/src/main/scala/spark/SparkContext.scala
@@ -67,6 +67,9 @@ import spark.scheduler.mesos.{CoarseMesosSchedulerBackend, MesosSchedulerBackend
import spark.storage.{StorageStatus, StorageUtils, RDDInfo, BlockManagerSource}
import spark.util.{MetadataCleaner, TimeStampedHashMap}
import ui.{SparkUI}
+import spark.metrics._
+
+import scala.util.DynamicVariable
/**
* Main entry point for Spark functionality. A SparkContext represents the connection to a Spark
@@ -272,9 +275,12 @@ class SparkContext(
val dagSchedulerSource = new DAGSchedulerSource(this.dagScheduler)
val blockManagerSource = new BlockManagerSource(SparkEnv.get.blockManager)
+ val metricsSystem = MetricsSystem.createMetricsSystem("driver")
+
def initDriverMetrics() = {
- SparkEnv.get.metricsSystem.registerSource(dagSchedulerSource)
- SparkEnv.get.metricsSystem.registerSource(blockManagerSource)
+ metricsSystem.registerSource(dagSchedulerSource)
+ metricsSystem.registerSource(blockManagerSource)
+ metricsSystem.start()
}
initDriverMetrics()
diff --git a/core/src/main/scala/spark/SparkEnv.scala b/core/src/main/scala/spark/SparkEnv.scala
index d34dafecc5..125dc55bd8 100644
--- a/core/src/main/scala/spark/SparkEnv.scala
+++ b/core/src/main/scala/spark/SparkEnv.scala
@@ -54,7 +54,6 @@ class SparkEnv (
val connectionManager: ConnectionManager,
val httpFileServer: HttpFileServer,
val sparkFilesDir: String,
- val metricsSystem: MetricsSystem,
// To be set only as part of initialization of SparkContext.
// (executorId, defaultHostPort) => executorHostPort
// If executorId is NOT found, return defaultHostPort
@@ -186,8 +185,6 @@ object SparkEnv extends Logging {
httpFileServer.initialize()
System.setProperty("spark.fileserver.uri", httpFileServer.serverUri)
- val metricsSystem = MetricsSystem.createMetricsSystem("driver")
- metricsSystem.start()
// Set the sparkFiles directory, used when downloading dependencies. In local mode,
// this is a temporary directory; in distributed mode, this is the executor's current working
@@ -218,7 +215,6 @@ object SparkEnv extends Logging {
connectionManager,
httpFileServer,
sparkFilesDir,
- metricsSystem,
None)
}
}