-
Notifications
You must be signed in to change notification settings - Fork 2
/
JobStart_Ends.kql
35 lines (33 loc) · 1.8 KB
/
JobStart_Ends.kql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//simple query that just lists the events
let j_cl = DatabricksJobs
| where ActionName in ("runStart","runFailed","runSucceeded")
| extend rparams = parse_json(RequestParams)
| extend RunId = tostring(rparams.runId), JobId = rparams.jobId, ClusterID = rparams.clusterId
| project RunTimeGen = TimeGenerated, RunId, JobId, ClusterID, RunParams = RequestParams, Response, ActionName;
let j_ru = DatabricksJobs
| where ActionName in ("getRunOutput","submitRun","runTriggered", "cancel", "runNow", "deleteRun")
| extend rparams = parse_json(RequestParams), response = parse_json(Response)
| extend RunId = coalesce(tostring(rparams.run_id), tostring(rparams.runId), extractjson("$.['run_id']", tostring(response.result)))
| project RunTimeGen = TimeGenerated, RunId, RunParams = RequestParams, Response, ActionName;
let j_jo = DatabricksJobs
| where ActionName == ("update")
| extend rparams = parse_json(RequestParams)
| extend JobId = rparams.job_id
| project RunTimeGen = TimeGenerated, JobId, RunParams = RequestParams, Response, ActionName;
j_cl
| union j_ru
| order by RunId, RunTimeGen asc
//just get start and end events for a job
let j_start = DatabricksJobs
| where ActionName == "runStart"
| extend rparams = parse_json(RequestParams)
| extend RunId = tostring(rparams.runId), JobId = rparams.jobId, ClusterID = rparams.clusterId
| project StartTimeGen = TimeGenerated, RunId, JobId, ClusterID, StartParams = RequestParams;
let j_end = DatabricksJobs
| where ActionName in ("runFailed","runSucceeded")
| extend rparams = parse_json(RequestParams)
| extend RunId = tostring(rparams.runId), JobId = rparams.jobId, ClusterID = rparams.clusterId
| project EndTimeGen = TimeGenerated, RunId, JobId, ClusterID, EndParams = RequestParams, EndActionName = ActionName;
j_start
| join kind=leftouter j_end on RunId
| order by RunId, StartTimeGen