hit-lacus commented on a change in pull request #1538: URL: https://github.com/apache/kylin/pull/1538#discussion_r555471679
########## File path: kylin-spark-project/kylin-spark-query/src/main/scala/org/apache/spark/sql/metrics/SparderMetricsListener.scala ########## @@ -0,0 +1,137 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.metrics + +import org.apache.kylin.metrics.QuerySparkMetrics +import org.apache.spark.internal.Logging +import org.apache.spark.scheduler._ +import org.apache.spark.sql.execution.SQLExecution +import org.apache.spark.sql.execution.ui.{SparkListenerSQLExecutionEnd, SparkListenerSQLExecutionStart} + +class SparderMetricsListener() extends SparkListener with Logging { + + var stageJobMap:Map[Int, Int] = Map() + var jobExecutionMap:Map[Int, QueryInformation] = Map() + var executionInformationMap:Map[Long, ExecutionInformation] = Map() + + val queryExecutionMetrics = QuerySparkMetrics.getInstance() + + override def onJobStart(event: SparkListenerJobStart): Unit = { + val executionIdString = event.properties.getProperty(SQLExecution.EXECUTION_ID_KEY) + val sparderName = event.properties.getProperty("spark.app.name") + val kylinQueryId = event.properties.getProperty("kylin.query.id") + + if (executionIdString == null || kylinQueryId == null) { + // This is not a job created by SQL + logInfo("Cannot happened.") Review comment: Remove this line. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected]
