|
41 | 41 | import org.apache.spark.sql.streaming.StateOperatorProgress; |
42 | 42 | import org.apache.spark.sql.streaming.StreamingQueryListener; |
43 | 43 | import org.apache.spark.sql.streaming.StreamingQueryProgress; |
| 44 | +import org.slf4j.Logger; |
| 45 | +import org.slf4j.LoggerFactory; |
44 | 46 | import scala.Tuple2; |
45 | 47 | import scala.collection.JavaConverters; |
46 | 48 |
|
|
53 | 55 | * still needed |
54 | 56 | */ |
55 | 57 | public abstract class AbstractDatadogSparkListener extends SparkListener { |
| 58 | + private static final Logger log = LoggerFactory.getLogger(AbstractDatadogSparkListener.class); |
56 | 59 | public static volatile AbstractDatadogSparkListener listener = null; |
57 | 60 | public static volatile boolean finishTraceOnApplicationEnd = true; |
58 | 61 |
|
@@ -120,6 +123,8 @@ public AbstractDatadogSparkListener(SparkConf sparkConf, String appId, String sp |
120 | 123 | databricksClusterName = sparkConf.get("spark.databricks.clusterUsageTags.clusterName", null); |
121 | 124 | databricksServiceName = getDatabricksServiceName(sparkConf, databricksClusterName); |
122 | 125 | sparkServiceName = getSparkServiceName(sparkConf, isRunningOnDatabricks); |
| 126 | + |
| 127 | + log.info("Created datadog spark listener: {}", this.getClass().getSimpleName()); |
123 | 128 | } |
124 | 129 |
|
125 | 130 | /** Resource name of the spark job. Provide an implementation based on a specific scala version */ |
@@ -172,13 +177,19 @@ private void initApplicationSpanIfNotInitialized() { |
172 | 177 |
|
173 | 178 | @Override |
174 | 179 | public void onApplicationEnd(SparkListenerApplicationEnd applicationEnd) { |
| 180 | + log.info( |
| 181 | + "Received spark application end event, finish trace on this event: {}", |
| 182 | + finishTraceOnApplicationEnd); |
| 183 | + |
175 | 184 | if (finishTraceOnApplicationEnd) { |
176 | 185 | finishApplication(applicationEnd.time(), null, 0, null); |
177 | 186 | } |
178 | 187 | } |
179 | 188 |
|
180 | 189 | public synchronized void finishApplication( |
181 | 190 | long time, Throwable throwable, int exitCode, String msg) { |
| 191 | + log.info("Finishing spark application trace"); |
| 192 | + |
182 | 193 | if (applicationEnded) { |
183 | 194 | return; |
184 | 195 | } |
|
0 commit comments