Skip to content

Commit

Permalink
Update to 15.2 query
Browse files Browse the repository at this point in the history
Filtering out internal server calls
  • Loading branch information
KennieNP committed May 7, 2020
1 parent 5c0e99d commit fc7fee0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions samples/AppInsights/KQL/Long Running SQL Queries.kql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// KQL samples - Long Running SQL Queries

// Important: if you query telemetry from an environment on version 15.0-15.2
// Then please see below for a sample query. The schema changed in 15.3
// Then please see below for a sample query. The schema changed starting in 15.3

// Long running SQL queries (RAW data)
// Use extend if you need to use a column extracted from customDimensions in a function (such as countof)
Expand Down Expand Up @@ -67,11 +67,12 @@ traces
traces
| where timestamp > ago(60d) // adjust as needed
| where operation_Name == 'Long Running Operation (SQL Query)' // do note that in a later version of the schema, this field will not be used (a new field in custom dimensions will be used)
| extend aadID = customDimensions.['AadTenantId']
, executionTime = customDimensions.['Execution time (ms)']
, sqlStatement = tostring( customDimensions.['SQL statement'] )
| extend alObjectId = tostring( customDimensions.['AL Object Id'] )
, alObjectName = tostring( customDimensions.['AL Object name'] )
| where alObjectId > 0 // filter out internal server calls
| extend aadID = customDimensions.['AadTenantId']
, executionTime = customDimensions.['Execution time (ms)']
, sqlStatement = tostring( customDimensions.['SQL statement'] )
| extend alObjectName = tostring( customDimensions.['AL Object name'] )
, alObjectType = tostring( customDimensions.['AL Object type'] )
, alStackTrace = tostring( customDimensions.['AL Stack trace'] )
, clientType = tostring( customDimensions.['Client type'] )
Expand Down

0 comments on commit fc7fee0

Please sign in to comment.