Monitor Azure Static Web Apps
Enable Application Insights to monitor API requests, failures, and tracing information.
Important
Application Insights has an independent pricing model from Azure Static Web Apps.
Note
Using Application Insights with Azure Static Web Apps requires an application with an API.
Add monitoring
Use the following steps to add Application Insights monitoring to your static web app.
Open the Static Web Apps instance in the Azure portal.
Select Application Insights from the menu.
Select Yes next to Enable Application Insights.
Select Save.
Note
Once you create the Application Insights instance, an associated application setting is created in the Azure Static Web Apps instance used to link the services together.
Access data
From the Overview window in your static web app, select the link next to the Resource group.
From the list, select the Application Insights instance prefixed with the same name as your static web app.
The following highlights a few locations in the portal used to inspect aspects of your application's API endpoints.
Note
For more detail on Application Insights usage, refer to Where do I see my telemetry?.
| Type | Menu location | Description |
|---|---|---|
| Failures | Investigate > Failures | Review failed requests. |
| Server requests | Investigate > Performance | Review individual API requests. |
| Logs | Monitoring > Logs | Interact with an editor to query transaction logs. |
| Metrics | Monitoring > Metrics | Interact with a designer to create custom charts using various metrics. |
Traces
Using the following steps to view traces in your application.
Select Logs under Monitoring.
Hover your mouse over any card in the Queries window.
Select the Load Editor button.
Replace the generated query with the word
traces.Select the Run button.
Limit logging
In some cases you may want to limit logging while still capturing details on errors and warnings by making the following changes to your host.json file of the Azure Functions app.
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true
},
"enableDependencyTracking": false
},
"logLevels": {
"default": "Warning"
}
}
}
Next steps
Tilbakemeldinger
Send inn og vis tilbakemelding for