Επεξεργασία

Κοινή χρήση μέσω


Monitor workload - Azure portal

This article describes how to use the Azure portal to monitor your workload. This includes setting up Azure Monitor Logs to investigate query execution and workload trends using log analytics for Synapse SQL.

Prerequisites

  • Azure subscription: If you don't have an Azure subscription, create a free Azure account before you begin.
  • SQL pool: We will be collecting logs for a SQL pool. If you don't have a SQL pool provisioned, see the instructions in Create a SQL pool.

Create a Log Analytics workspace

In the Azure portal, navigate to the page for Log Analytics workspaces, or use the Azure services search window to create a new Log Analytics workspace.

Screenshot shows the Log Analytics workspaces where you can select Add.

Screenshot shows the Log Analytics workspace where you can enter values.

For more information on workspaces, see Create a Log Analytics workspace.

Turn on Resource logs

Configure diagnostic settings to emit logs from your SQL pool. Logs consist of telemetry views equivalent to the most commonly used performance troubleshooting DMVs.

For a list of views that are currently supported, see Dynamic Management Views.

Screenshot of the page to create a diagnostic setting in the Azure portal.

Logs can be emitted to Azure Storage, Stream Analytics, or Log Analytics. For this tutorial, select Log Analytics. Select all desired categories and metrics and choose Send to Log Analytics workspace.

Screenshot of the page to specify which logs to collect in the Azure portal.

Select Save to create the new diagnostic setting. It may take a few minutes for data to appear in queries.

Run queries against Log Analytics

Navigate to your Log Analytics workspace where you can:

  • Analyze logs using log queries and save queries for reuse
  • Save queries for reuse
  • Create log alerts
  • Pin query results to a dashboard

For details on the capabilities of log queries using Kusto, see Kusto Query Language (KQL) overview.

Log Analytics workspace editor.

Log Analytics workspace queries.

Sample log queries

Set the scope of your queries to the Log Analytics workspace resource.

//List all queries
AzureDiagnostics
| where Category contains "ExecRequests"
| project TimeGenerated, StartTime_t, EndTime_t, Status_s, Command_s, ResourceClass_s, duration=datetime_diff('millisecond',EndTime_t, StartTime_t)
//Chart the most active resource classes
AzureDiagnostics
| where Category contains "ExecRequests"
| where Status_s == "Completed"
| summarize totalQueries = dcount(RequestId_s) by ResourceClass_s
| render barchart
//Count of all queued queries
AzureDiagnostics
| where Category contains "waits"
| where Type == "UserConcurrencyResourceType"
| summarize totalQueuedQueries = dcount(RequestId_s)

Next steps