Skip to content

Commit aa55762

Browse files
committed
apache#49 add more metrics to application-source
1 parent a50a24b commit aa55762

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

core/src/main/scala/org/apache/spark/deploy/master/ApplicationSource.scala

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,26 @@ private[master] class ApplicationSource(val application: ApplicationInfo) extend
3838
override def getValue: Int = application.coresGranted
3939
})
4040

41+
metricRegistry.register(MetricRegistry.name("cores_per_executor"), new Gauge[Int] {
42+
override def getValue: Int = application.desc.coresPerExecutor.getOrElse(1)
43+
})
44+
45+
metricRegistry.register(MetricRegistry.name("max_cores"), new Gauge[Int] {
46+
override def getValue: Int = application.desc.maxCores.getOrElse(0)
47+
})
48+
49+
metricRegistry.register(MetricRegistry.name("instances"), new Gauge[Int] {
50+
val maxCores: Int = application.desc.maxCores.getOrElse(0)
51+
val coresPerExecutor: Int = application.desc.coresPerExecutor.getOrElse(1)
52+
override def getValue: Int = maxCores / coresPerExecutor
53+
})
54+
55+
metricRegistry.register(MetricRegistry.name("request_executors"), new Gauge[Int] {
56+
override def getValue: Int = application.executorLimit
57+
})
58+
59+
metricRegistry.register(MetricRegistry.name("executors"), new Gauge[Int] {
60+
override def getValue: Int = application.executors.size
61+
})
62+
4163
}

0 commit comments

Comments
 (0)