@@ -47,7 +47,8 @@ class StatsReportingSparkListener(sparkConf: SparkConf, apiKey: String,
4747 var sent : Boolean = false ,
4848 var startedTaskCount : Int = 0 ,
4949 var failureReason : Option [String ] = None ,
50- var properties : Map [String , String ] = Map ())
50+ var properties : Map [String , String ] = Map (),
51+ var details : Option [String ] = None )
5152 private val tasksPerStage = mutable.Map [StageFullId , mutable.ArrayBuffer [(TaskMetrics , TaskEndReason )]]()
5253 private val stageState = mutable.Map [StageFullId , StageState ]()
5354 private val appStart : Instant = Instant .now()
@@ -155,7 +156,9 @@ class StatsReportingSparkListener(sparkConf: SparkConf, apiKey: String,
155156 }.toMap
156157
157158 val startTime = stageSubmitted.stageInfo.submissionTime.map(Instant .ofEpochMilli).getOrElse(Instant .now())
158- stageState.getOrElseUpdate(stageFullId, StageState (startTime)).properties = properties
159+ val state = stageState.getOrElseUpdate(stageFullId, StageState (startTime))
160+ state.properties = properties
161+ state.details = Some (stageSubmitted.stageInfo.details)
159162 }
160163
161164 override def onStageCompleted (stageCompleted : SparkListenerStageCompleted ): Unit = {
@@ -236,7 +239,7 @@ class StatsReportingSparkListener(sparkConf: SparkConf, apiKey: String,
236239 val failureReason = state.failureReason
237240 val startTime = state.startTime
238241 val summary = summarizeStage(appId, stageFullId.stageId, stageFullId.attemptNumber, success, failureReason,
239- startTime, tasks.toSeq, state.properties, endTs)
242+ startTime, tasks.toSeq, state.properties, endTs, state.details )
240243
241244 implicit val codec : JsonValueCodec [StageSummary ] = JsonCodecMaker .make
242245 send(" stages" , summary.get)
@@ -342,7 +345,9 @@ object StatsReportingSparkListener {
342345 failureReason : Option [String ], startTime : Instant ,
343346 rawTaskMetrics : Seq [(TaskMetrics , TaskEndReason )],
344347 properties : Map [String , String ],
345- endTime : Option [Long ]): Option [StageSummary ] = {
348+ endTime : Option [Long ],
349+ details : Option [String ],
350+ ): Option [StageSummary ] = {
346351 val taskMetrics = rawTaskMetrics.map(_._1)
347352 .filter(_ != null ) // For failed tasks, there will be 'null' TaskMetrics instances.
348353 val runTimes = taskMetrics.map(_.executorRunTime.toDouble / 1000.0 )
@@ -375,10 +380,12 @@ object StatsReportingSparkListener {
375380 memorySpillGB = taskMetrics.map(_.memoryBytesSpilled.toDouble).sum / GiB ,
376381 diskSpillGB = taskMetrics.map(_.diskBytesSpilled).sum / GiB ,
377382 inputGB = taskMetrics.map(_.inputMetrics.bytesRead).sum / GiB ,
383+ outputGB = taskMetrics.map(_.outputMetrics.bytesWritten).sum / GiB ,
378384 shuffleWriteGB = taskMetrics.map(_.shuffleWriteMetrics.bytesWritten).sum / GiB ,
379385 peakExecutionMemoryGB = taskMetrics.map(_.peakExecutionMemory).sum / GiB ,
380386 properties = properties,
381387 endTs = endTs,
388+ details = details,
382389 ))
383390 }
384391}
0 commit comments