bowenliang123 commented on code in PR #6112:
URL: https://github.com/apache/kyuubi/pull/6112#discussion_r1506906708


##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala:
##########
@@ -110,12 +113,28 @@ class SparkSessionImpl(
   }
 
   override def close(): Unit = {
+    info(s"sessionId=${sessionEvent.sessionId}, " +
+      
s"sessionRunTime=${KyuubiSparkUtil.formatDuration(sessionRunTime.get())}, " +
+      
s"sessionCpuTime=${KyuubiSparkUtil.formatDurationNano(sessionCpuTime.get())}")

Review Comment:
   ditto



##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/operation/SparkOperation.scala:
##########
@@ -124,7 +125,20 @@ abstract class SparkOperation(session: Session)
   override protected def setState(newState: OperationState): Unit = {
     super.setState(newState)
     if (eventEnabled) {
-      EventBus.post(SparkOperationEvent(this, 
operationListener.flatMap(_.getExecutionId)))
+      EventBus.post(SparkOperationEvent(
+        this,
+        operationListener.flatMap(_.getExecutionId),
+        operationListener.map(_.operationRunTime.get()),
+        operationListener.map(_.operationCpuTime.get())))
+      if (OperationState.isTerminal(newState)) {
+        operationListener.foreach(l => {
+          info(s"statementId=${statementId}, " +
+            
s"operationRunTime=${KyuubiSparkUtil.formatDuration(l.operationRunTime.get())}, 
" +
+            
s"operationCpuTime=${KyuubiSparkUtil.formatDurationNano(l.operationCpuTime.get())}")

Review Comment:
   Use `org.apache.spark.ui.formatDurationVerbose` instead of introducing new 
methods.



##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/spark/kyuubi/SQLOperationListener.scala:
##########
@@ -140,6 +145,14 @@ class SQLOperationListener(
     val stageInfo = stageCompleted.stageInfo
     val stageId = stageInfo.stageId
     val stageAttempt = SparkStageAttempt(stageInfo.stageId, 
stageInfo.attemptNumber())
+    val taskMetrics = stageInfo.taskMetrics
+    if (taskMetrics != null) {
+      info(s"stageId=${stageCompleted.stageInfo.stageId}, " +
+        
s"stageRunTime=${KyuubiSparkUtil.formatDuration(taskMetrics.executorRunTime)}, 
" +
+        
s"stageCpuTime=${KyuubiSparkUtil.formatDurationNano(taskMetrics.executorCpuTime)}")

Review Comment:
   ditto



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to