1717
1818package org .apache .spark .network .yarn ;
1919
20+ import java .util .Map ;
21+
2022import com .codahale .metrics .*;
2123import org .apache .hadoop .metrics2 .MetricsCollector ;
2224import org .apache .hadoop .metrics2 .MetricsInfo ;
2325import org .apache .hadoop .metrics2 .MetricsRecordBuilder ;
2426import org .apache .hadoop .metrics2 .MetricsSource ;
25- import org .apache .spark .network .shuffle .ExternalShuffleBlockHandler ;
26-
27- import java .util .Map ;
2827
2928/**
30- * Forward {@link ExternalShuffleBlockHandler.ShuffleMetrics} to hadoop metrics system.
29+ * Forward {@link org.apache.spark.network.shuffle.ExternalShuffleBlockHandler.ShuffleMetrics}
30+ * to hadoop metrics system.
3131 * NodeManager by default exposes JMX endpoint where can be collected.
3232 */
3333class YarnShuffleServiceMetrics implements MetricsSource {
@@ -46,17 +46,21 @@ class YarnShuffleServiceMetrics implements MetricsSource {
4646 */
4747 @ Override
4848 public void getMetrics (MetricsCollector collector , boolean all ) {
49- MetricsRecordBuilder metricsRecordBuilder = collector .addRecord ("shuffleService " );
49+ MetricsRecordBuilder metricsRecordBuilder = collector .addRecord ("sparkShuffleService " );
5050
5151 for (Map .Entry <String , Metric > entry : metricSet .getMetrics ().entrySet ()) {
5252 collectMetric (metricsRecordBuilder , entry .getKey (), entry .getValue ());
5353 }
5454 }
5555
5656 /**
57- * The metric types used in {@link ExternalShuffleBlockHandler.ShuffleMetrics}
57+ * The metric types used in
58+ * {@link org.apache.spark.network.shuffle.ExternalShuffleBlockHandler.ShuffleMetrics}.
59+ * Visible for testing.
5860 */
59- public static void collectMetric (MetricsRecordBuilder metricsRecordBuilder , String name , Metric metric ) {
61+ public static void collectMetric (
62+ MetricsRecordBuilder metricsRecordBuilder , String name , Metric metric ) {
63+
6064 if (metric instanceof Timer ) {
6165 Timer t = (Timer ) metric ;
6266 metricsRecordBuilder
0 commit comments