From 5fee4c73d381a2262b9fd9e8b1baf430eeaf8edb Mon Sep 17 00:00:00 2001 From: Kennie Nybo Pontoppidan Date: Mon, 7 Feb 2022 10:15:47 -0600 Subject: [PATCH 1/8] syntax error --- .../KQL/Queries/HelperQueries/UpgradeStepDurations.kql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/AppInsights/KQL/Queries/HelperQueries/UpgradeStepDurations.kql b/samples/AppInsights/KQL/Queries/HelperQueries/UpgradeStepDurations.kql index c72a8323..2cb7d2f2 100644 --- a/samples/AppInsights/KQL/Queries/HelperQueries/UpgradeStepDurations.kql +++ b/samples/AppInsights/KQL/Queries/HelperQueries/UpgradeStepDurations.kql @@ -10,7 +10,7 @@ traces // upgrade step started | where customDimensions.aadTenantId == _aadTenantId and customDimensions.environmentName == _environmentName | where customDimensions.alCategory == "ALUpgrade" -| where appInsightsEventId == "AL0000EJ9" +| where customDimensions.eventId == "AL0000EJ9" | project alUpgradeTag = tostring(customDimensions.alUpgradeTag) , companyName = tostring(customDimensions.alCompanyName ) , step_started = timestamp @@ -23,7 +23,7 @@ traces // upgrade step finished successfullay | where customDimensions.aadTenantId == _aadTenantId and customDimensions.environmentName == _environmentName | where customDimensions.alCategory == "ALUpgrade" -| where appInsightsEventId == "AL0000EJA" +| where customDimensions.eventId == "AL0000EJA" | project alUpgradeTag = tostring(customDimensions.alUpgradeTag) , customDimensions , companyName = tostring(customDimensions.alCompanyName) From 55574e8a5bf75e040e304f82e1d3001af307ae80 Mon Sep 17 00:00:00 2001 From: Kennie Nybo Pontoppidan Date: Mon, 7 Feb 2022 10:35:46 -0600 Subject: [PATCH 2/8] more syntax error --- .../KQL/Queries/HelperQueries/UpgradeStepDurations.kql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/AppInsights/KQL/Queries/HelperQueries/UpgradeStepDurations.kql b/samples/AppInsights/KQL/Queries/HelperQueries/UpgradeStepDurations.kql index 2cb7d2f2..e1271019 100644 --- a/samples/AppInsights/KQL/Queries/HelperQueries/UpgradeStepDurations.kql +++ b/samples/AppInsights/KQL/Queries/HelperQueries/UpgradeStepDurations.kql @@ -11,7 +11,8 @@ traces // upgrade step started and customDimensions.environmentName == _environmentName | where customDimensions.alCategory == "ALUpgrade" | where customDimensions.eventId == "AL0000EJ9" -| project alUpgradeTag = tostring(customDimensions.alUpgradeTag) +| project timestamp +, alUpgradeTag = tostring(customDimensions.alUpgradeTag) , companyName = tostring(customDimensions.alCompanyName ) , step_started = timestamp , session_Id From a353cad2fe4082975326672a84b532f3b7643116 Mon Sep 17 00:00:00 2001 From: Kennie Nybo Pontoppidan Date: Mon, 7 Feb 2022 12:26:29 -0600 Subject: [PATCH 3/8] task scheduler --- .../TaskScheduler.kql | 162 ++++++++++++++++++ samples/AppInsights/KQL/README.md | 1 + 2 files changed, 163 insertions(+) create mode 100644 samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/TaskScheduler.kql diff --git a/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/TaskScheduler.kql b/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/TaskScheduler.kql new file mode 100644 index 00000000..58a0d2d3 --- /dev/null +++ b/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/TaskScheduler.kql @@ -0,0 +1,162 @@ +// KQL samples - Task Scheduler events + +// Task created (raw data) +traces +| where timestamp > ago(60d) // adjust as needed +| where customDimensions.eventId == 'LC0040' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, codeunitObjectId = customDimensions.codeunitObjectId +, companyName = customDimensions.companyName +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, eventId = customDimensions.eventId +, environmentName = customDimensions.environmentName +, environmentType = customDimensions.environmentType +, failureCodeunitObjectId = customDimensions.failureCodeunitObjectId +, formatId = customDimensions.formatId +, isReady = customDimensions.isReady +, languageId = customDimensions.languageId +, notBefore = customDimensions.notBefore +, taskId = customDimensions.taskId +, timeout = customDimensions.timeout +, message +, customDimensions + + +// Task ready (raw data) +traces +| where timestamp > ago(60d) // adjust as needed +| where customDimensions.eventId == 'LC0041' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, codeunitObjectId = customDimensions.codeunitObjectId +, companyName = customDimensions.companyName +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, eventId = customDimensions.eventId +, environmentName = customDimensions.environmentName +, environmentType = customDimensions.environmentType +, failureCodeunitObjectId = customDimensions.failureCodeunitObjectId +, formatId = customDimensions.formatId +, isReady = customDimensions.isReady +, languageId = customDimensions.languageId +, notBefore = customDimensions.notBefore +, taskId = customDimensions.taskId +, timeout = customDimensions.timeout +, message +, customDimensions + + +// Task removed (raw data) +traces +| where timestamp > ago(60d) // adjust as needed +| where customDimensions.eventId == 'LC0042' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, codeunitObjectId = customDimensions.codeunitObjectId +, companyName = customDimensions.companyName +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, eventId = customDimensions.eventId +, environmentName = customDimensions.environmentName +, environmentType = customDimensions.environmentType +, failureCodeunitObjectId = customDimensions.failureCodeunitObjectId +, formatId = customDimensions.formatId +, isReady = customDimensions.isReady +, languageId = customDimensions.languageId +, notBefore = customDimensions.notBefore +, taskId = customDimensions.taskId +, timeout = customDimensions.timeout +, message +, customDimensions + + +// Task completed (raw data) +traces +| where timestamp > ago(60d) // adjust as needed +| where customDimensions.eventId == 'LC0043' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, attemptNumber = customDimensions.attemptNumber +, codeunitObjectId = customDimensions.codeunitObjectId +, companyName = customDimensions.companyName +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, eventId = customDimensions.eventId +, environmentName = customDimensions.environmentName +, environmentType = customDimensions.environmentType +, failureCodeunitObjectId = customDimensions.failureCodeunitObjectId +, formatId = customDimensions.formatId +, isReady = customDimensions.isReady +, languageId = customDimensions.languageId +, notBefore = customDimensions.notBefore +, result = customDimensions.result +, sqlExecutes = customDimensions.sqlExecutes +, sqlRowsRead = customDimensions.sqlRowsRead +, totalTime = customDimensions.totalTime +, taskId = customDimensions.taskId +, timeout = customDimensions.timeout +, message +, customDimensions + + +// Task cancelled (raw data) +traces +| where timestamp > ago(60d) // adjust as needed +| where customDimensions.eventId == 'LC0044' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, attemptNumber = customDimensions.attemptNumber +, cancelReasonMessage = customDimensions.cancelReasonMessage +, cancelReason = customDimensions.cancelReason +, codeunitObjectId = customDimensions.codeunitObjectId +, companyName = customDimensions.companyName +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, eventId = customDimensions.eventId +, environmentName = customDimensions.environmentName +, environmentType = customDimensions.environmentType +, failureCodeunitObjectId = customDimensions.failureCodeunitObjectId +, formatId = customDimensions.formatId +, isReady = customDimensions.isReady +, languageId = customDimensions.languageId +, notBefore = customDimensions.notBefore +, result = customDimensions.result +, sqlExecutes = customDimensions.sqlExecutes +, sqlRowsRead = customDimensions.sqlRowsRead +, totalTime = customDimensions.totalTime +, taskId = customDimensions.taskId +, timeout = customDimensions.timeout +, message +, customDimensions + + +// Task failed (raw data) +traces +| where timestamp > ago(60d) // adjust as needed +| where customDimensions.eventId == 'LC0045' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, attemptNumber = customDimensions.attemptNumber +, codeunitObjectId = customDimensions.codeunitObjectId +, companyName = customDimensions.companyName +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, eventId = customDimensions.eventId +, environmentName = customDimensions.environmentName +, environmentType = customDimensions.environmentType +, failureCodeunitObjectId = customDimensions.failureCodeunitObjectId +, failureReason = customDimensions.failureReason +, formatId = customDimensions.formatId +, isReady = customDimensions.isReady +, languageId = customDimensions.languageId +, notBefore = customDimensions.notBefore +, result = customDimensions.result +, sqlExecutes = customDimensions.sqlExecutes +, sqlRowsRead = customDimensions.sqlRowsRead +, totalTime = customDimensions.totalTime +, taskId = customDimensions.taskId +, timeout = customDimensions.timeout +, message +, customDimensions diff --git a/samples/AppInsights/KQL/README.md b/samples/AppInsights/KQL/README.md index c2d68437..cb60aeeb 100644 --- a/samples/AppInsights/KQL/README.md +++ b/samples/AppInsights/KQL/README.md @@ -65,6 +65,7 @@ Signal is added incrementally to Business Central. In this table you can see in | Appsource validation | 2021 release wave 1 (18.4) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-appsource-submission-validation-trace | | Use of read scale-out in reporting | 2021 release wave 2 (19.1) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-reports-trace | | Feature Telemetry | 2021 release wave 2 (19.1) | (pending docs) | +| Task Scheduler Telemetry | 2021 release wave 2 (19.1) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-task-scheduler-trace | | Database deadlocks | 2022 release wave 1 (20.0) | (pending link to release note) | | Database wait statistics | 2022 release wave 1 (20.0) | (pending link to release note) | | Verbose telemetry enabled | 2022 release wave 1 (20.0) | (pending link to release note) | From 21929328a6beb0b519b2dce9e76d012ba9ac71e3 Mon Sep 17 00:00:00 2001 From: Kennie Nybo Pontoppidan Date: Mon, 7 Feb 2022 12:40:55 -0600 Subject: [PATCH 4/8] Create Errors.kql --- .../ExampleQueriesForEachArea/Errors.kql | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/Errors.kql diff --git a/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/Errors.kql b/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/Errors.kql new file mode 100644 index 00000000..901c199b --- /dev/null +++ b/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/Errors.kql @@ -0,0 +1,27 @@ +// KQL samples - Errors + +// Error dialog shown (raw data) +traces +| where 1==1 + and timestamp > ago(60d) // adjust as needed + and customDimensions.eventId == 'RT0030' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, alErrorMessage = customDimensions.alErrorMessage +, alObjectId = customDimensions.alObjectId +, alObjectName = customDimensions.alObjectName +, alObjectType = customDimensions.alObjectType +, alStackTrace = customDimensions.alStackTrace +, clientType = customDimensions.clientType +, companyName = customDimensions.companyName +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, environmentType = customDimensions.environmentType +, environmentName = customDimensions.environmentName +, eventId = customDimensions.eventId +, extensionId = customDimensions.extensionId +, extensionName = customDimensions.extensionName +, extensionVersion = customDimensions.extensionVersion +, failureReason = customDimensions.failureReason +, message +, customDimensions From 2dc451abfc8f152d52f66f2b70f355d13333e547 Mon Sep 17 00:00:00 2001 From: Kennie Nybo Pontoppidan Date: Mon, 7 Feb 2022 13:10:50 -0600 Subject: [PATCH 5/8] verbose telemetry sample added --- .../VerboseTelemetry.kql | 33 +++++++++++++++++++ samples/AppInsights/KQL/README.md | 5 +-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/VerboseTelemetry.kql diff --git a/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/VerboseTelemetry.kql b/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/VerboseTelemetry.kql new file mode 100644 index 00000000..7eb62936 --- /dev/null +++ b/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/VerboseTelemetry.kql @@ -0,0 +1,33 @@ +// KQL samples - Verbose Telemetry enabled/disabled + +// Verbose Telemetry enabled (raw data) +traces +| where 1==1 + and timestamp > ago(60d) // adjust as needed + and customDimensions.eventId == 'RT0023' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, environmentType = customDimensions.environmentType +, environmentName = customDimensions.environmentName +, eventId = customDimensions.eventId +, message +, customDimensions + + + +// Verbose Telemetry disabled (raw data) +traces +| where 1==1 + and timestamp > ago(60d) // adjust as needed + and customDimensions.eventId == 'RT0024' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, environmentType = customDimensions.environmentType +, environmentName = customDimensions.environmentName +, eventId = customDimensions.eventId +, message +, customDimensions diff --git a/samples/AppInsights/KQL/README.md b/samples/AppInsights/KQL/README.md index cb60aeeb..e1672400 100644 --- a/samples/AppInsights/KQL/README.md +++ b/samples/AppInsights/KQL/README.md @@ -68,12 +68,13 @@ Signal is added incrementally to Business Central. In this table you can see in | Task Scheduler Telemetry | 2021 release wave 2 (19.1) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-task-scheduler-trace | | Database deadlocks | 2022 release wave 1 (20.0) | (pending link to release note) | | Database wait statistics | 2022 release wave 1 (20.0) | (pending link to release note) | -| Verbose telemetry enabled | 2022 release wave 1 (20.0) | (pending link to release note) | -| General error dialogs | 2022 release wave 1 (20.0) | (pending link to release note) | +| Verbose telemetry enabled | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-action-enabling-detailed-telemetry-logged-telemetry | +| General error dialogs | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-error-dialogs-are-logged-telemetry | | Permission error dialogs | 2022 release wave 1 (20.0) | (pending link to release note) | | Use of read scale-out in web service calls | 2022 release wave 1 (20.0) | (pending link to release note) | | Report action and document type in reporting | 2022 release wave 1 (20.0) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-reports-trace | | Environment lifecycle and configuration changes| 2022 release wave 1 (20.0) | (pending link to release note) | +| Session stops | 2022 release wave 1 (20.0) | (pending link to release note) | # Disclaimer Microsoft Corporation (“Microsoft”) grants you a nonexclusive, perpetual, royalty-free right to use and modify the software code provided by us for the purposes of illustration ("Sample Code") and to reproduce and distribute the object code form of the Sample Code, provided that you agree: (i) to not use our name, logo, or trademarks to market your software product in which the Sample Code is embedded; (ii) to include a valid copyright notice on your software product in which the Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend us and our suppliers from and against any claims or lawsuits, whether in an action of contract, tort or otherwise, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code or the use or other dealings in the Sample Code. Unless applicable law gives you more rights, Microsoft reserves all other rights not expressly granted herein, whether by implication, estoppel or otherwise. From e3d7d451f09cadf0a8f7bcb5be5682a1795e4bfe Mon Sep 17 00:00:00 2001 From: Kennie Nybo Pontoppidan Date: Mon, 7 Feb 2022 13:18:25 -0600 Subject: [PATCH 6/8] Database wait statistics query --- .../DatabaseWaitStatisticsSnapshot.kql | 41 +++++++++++++++++++ samples/AppInsights/KQL/README.md | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/DatabaseWaitStatisticsSnapshot.kql diff --git a/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/DatabaseWaitStatisticsSnapshot.kql b/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/DatabaseWaitStatisticsSnapshot.kql new file mode 100644 index 00000000..5060575b --- /dev/null +++ b/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/DatabaseWaitStatisticsSnapshot.kql @@ -0,0 +1,41 @@ +// KQL samples - Database wait statistics snapshots + +// Database wait statistics snapshot taken (raw data) +traces +| where 1==1 + and timestamp > ago(60d) // adjust as needed + and customDimensions.eventId == 'RT0025' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, environmentType = customDimensions.environmentType +, environmentName = customDimensions.environmentName +, eventId = customDimensions.eventId +, snapshotId = customDimensions.snapshotId +, message +, customDimensions + + +// Database wait statistics snapshot entry (raw data) +// Need to join on snapshotId +traces +| where 1==1 + and timestamp > ago(60d) // adjust as needed + and customDimensions.eventId == 'RT0026' +| project timestamp +, aadTenantId = customDimensions.aadTenantId +, component = customDimensions.component +, componentVersion = customDimensions.componentVersion +, databaseWaitStatisticsCategory = customDimensions.databaseWaitStatisticsCategory +, databaseSignalWaitTimeInMs = customDimensions.databaseSignalWaitTimeInMs +, databaseWaitingTasksCount = customDimensions.databaseWaitingTasksCount +, databaseMaxWaitTimeInMs = customDimensions.databaseMaxWaitTimeInMs +, databaseStartedDuration = customDimensions.databaseStartedDuration +, databaseWaitTimeInMs = customDimensions.databaseWaitTimeInMs +, environmentType = customDimensions.environmentType +, environmentName = customDimensions.environmentName +, eventId = customDimensions.eventId +, snapshotId = customDimensions.snapshotId +, message +, customDimensions \ No newline at end of file diff --git a/samples/AppInsights/KQL/README.md b/samples/AppInsights/KQL/README.md index e1672400..28cf2536 100644 --- a/samples/AppInsights/KQL/README.md +++ b/samples/AppInsights/KQL/README.md @@ -67,7 +67,7 @@ Signal is added incrementally to Business Central. In this table you can see in | Feature Telemetry | 2021 release wave 2 (19.1) | (pending docs) | | Task Scheduler Telemetry | 2021 release wave 2 (19.1) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-task-scheduler-trace | | Database deadlocks | 2022 release wave 1 (20.0) | (pending link to release note) | -| Database wait statistics | 2022 release wave 1 (20.0) | (pending link to release note) | +| Database wait statistics | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/performance-partners-get-database-insights-through-virtual-tables-in-client-pages | | Verbose telemetry enabled | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-action-enabling-detailed-telemetry-logged-telemetry | | General error dialogs | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-error-dialogs-are-logged-telemetry | | Permission error dialogs | 2022 release wave 1 (20.0) | (pending link to release note) | From e6159785e77f1ba0e211cf933ba2c318fce8d8b2 Mon Sep 17 00:00:00 2001 From: Kennie Nybo Pontoppidan Date: Mon, 7 Feb 2022 13:40:36 -0600 Subject: [PATCH 7/8] Update README.md --- samples/AppInsights/KQL/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/AppInsights/KQL/README.md b/samples/AppInsights/KQL/README.md index 28cf2536..aa113ba9 100644 --- a/samples/AppInsights/KQL/README.md +++ b/samples/AppInsights/KQL/README.md @@ -66,7 +66,7 @@ Signal is added incrementally to Business Central. In this table you can see in | Use of read scale-out in reporting | 2021 release wave 2 (19.1) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-reports-trace | | Feature Telemetry | 2021 release wave 2 (19.1) | (pending docs) | | Task Scheduler Telemetry | 2021 release wave 2 (19.1) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-task-scheduler-trace | -| Database deadlocks | 2022 release wave 1 (20.0) | (pending link to release note) | +| Database deadlocks | 2022 release wave 1 (20.0) | No KQL sample yet, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-when-database-deadlock-occurs-this-logged-telemetry | | Database wait statistics | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/performance-partners-get-database-insights-through-virtual-tables-in-client-pages | | Verbose telemetry enabled | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-action-enabling-detailed-telemetry-logged-telemetry | | General error dialogs | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-error-dialogs-are-logged-telemetry | From ae9c2ee7ffc60a87256950f8cfe5ae5ea63e8ec0 Mon Sep 17 00:00:00 2001 From: Kennie Nybo Pontoppidan Date: Mon, 7 Feb 2022 14:45:30 -0600 Subject: [PATCH 8/8] deadlock draft query --- .../SQLDeadlocks.kql | 44 +++++++++++++++++++ samples/AppInsights/KQL/README.md | 4 +- 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/SQLDeadlocks.kql diff --git a/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/SQLDeadlocks.kql b/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/SQLDeadlocks.kql new file mode 100644 index 00000000..3484248f --- /dev/null +++ b/samples/AppInsights/KQL/Queries/ExampleQueriesForEachArea/SQLDeadlocks.kql @@ -0,0 +1,44 @@ +// KQL samples - SQL Deadlocks + +// Not fully tested yet, minor changes might be added before release + +// SQL deadlocks (RAW data) +traces +| where timestamp > ago(60d) // adjust as needed +| where customDimensions.eventId == 'RT0028' // starting from version 16.1, the eventId is used to identity signal types +| where customDimensions.alObjectId > 0 // filter out internal server calls +| extend eventId = customDimensions.eventId +, aadTenantId = customDimensions.aadTenantId +, environmentName = customDimensions.environmentName +, environmentType = customDimensions.environmentType +, companyName = customDimensions.companyName +, extensionId = customDimensions.extensionId +, extensionPublisher = customDimensions.extensionPublisher +, extensionName = customDimensions.extensionName +, extensionVersion = customDimensions.extensionVersion +, sessionId = customDimensions.sessionId +, alObjectId = customDimensions.alObjectId +, alObjectName = customDimensions.alObjectName +, alObjectType = customDimensions.alObjectType +, alStackTrace = customDimensions.alStackTrace +, clientType = customDimensions.clientType +, sqlStatement = tostring(customDimensions.sqlStatement) +, sqlServerSessionId = customDimensions.sqlServerSessionId +| extend operationType = case( + sqlStatement startswith "UPDATE", "UPDATE" +, sqlStatement startswith "DELETE", "DELETE" +, sqlStatement startswith "BeginTransaction", "BEGIN_TRANS" +, sqlStatement matches regex "INSERT INTO", "INSERT" +, sqlStatement startswith "SELECT", "SELECT" +, sqlStatement matches regex "IF EXISTS \\(SELECT (.*)\\) SELECT", "SELECT'" +, sqlStatement has "SELECT NEXT VALUE FOR", "SELECT_SEQUENCE_VALUE" +, sqlStatement has "SELECT @@SPID", "SELECT_SPID" +, sqlStatement matches regex "(.*)WITH", "SELECT" +, sqlStatement startswith "CREATE TABLE", "CREATE_TABLE" +, sqlStatement startswith "ALTER TABLE", "ALTER_TABLE" +, sqlStatement startswith "exec sp_rename", "RENAME_TABLE" +, sqlStatement matches regex "(.*)DROP TABLE", "DROP_TABLE" +, sqlStatement startswith "SET LOCK_TIMEOUT", "SET_LOCK_TIMEOUT" +, sqlStatement has "sp_getapplock", "GET_APP_LOCK" +, "UNKNOWN" +) diff --git a/samples/AppInsights/KQL/README.md b/samples/AppInsights/KQL/README.md index aa113ba9..7f7d4b3a 100644 --- a/samples/AppInsights/KQL/README.md +++ b/samples/AppInsights/KQL/README.md @@ -66,13 +66,13 @@ Signal is added incrementally to Business Central. In this table you can see in | Use of read scale-out in reporting | 2021 release wave 2 (19.1) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-reports-trace | | Feature Telemetry | 2021 release wave 2 (19.1) | (pending docs) | | Task Scheduler Telemetry | 2021 release wave 2 (19.1) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-task-scheduler-trace | -| Database deadlocks | 2022 release wave 1 (20.0) | No KQL sample yet, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-when-database-deadlock-occurs-this-logged-telemetry | +| Database deadlocks | 2022 release wave 1 (20.0) | Draft KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-when-database-deadlock-occurs-this-logged-telemetry | | Database wait statistics | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/performance-partners-get-database-insights-through-virtual-tables-in-client-pages | | Verbose telemetry enabled | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-action-enabling-detailed-telemetry-logged-telemetry | | General error dialogs | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365-release-plan/2022wave1/smb/dynamics365-business-central/telemetry-error-dialogs-are-logged-telemetry | | Permission error dialogs | 2022 release wave 1 (20.0) | (pending link to release note) | | Use of read scale-out in web service calls | 2022 release wave 1 (20.0) | (pending link to release note) | -| Report action and document type in reporting | 2022 release wave 1 (20.0) | https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-reports-trace | +| Report action and document type in reporting | 2022 release wave 1 (20.0) | KQL sample ready, https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/telemetry-reports-trace | | Environment lifecycle and configuration changes| 2022 release wave 1 (20.0) | (pending link to release note) | | Session stops | 2022 release wave 1 (20.0) | (pending link to release note) |