Skip to content

Commit 437fe44

Browse files
authored
Merge pull request #203799 from ggailey777/monitoring-updates
[Functions][Horizontal] Monitoring updates
2 parents 3740f36 + 4d991a5 commit 437fe44

File tree

7 files changed

+212
-61
lines changed

7 files changed

+212
-61
lines changed

.openpublishing.redirection.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6911,6 +6911,11 @@
69116911
"redirect_url": "/azure/azure-functions/functions-bindings-event-hubs-output",
69126912
"redirect_document_id": false
69136913
},
6914+
{
6915+
"source_path_from_root": "/articles/azure-functions/monitor-metrics.md",
6916+
"redirect_url": "/azure/azure-functions/monitor-functions",
6917+
"redirect_document_id": false
6918+
},
69146919
{
69156920
"source_path_from_root": "/articles/azure-functions/functions-bindings-errors.md",
69166921
"redirect_url": "/azure/azure-functions/functions-bindings-error-pages",

articles/azure-functions/TOC.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
displayName: secure, ssl
236236
- name: Security baseline
237237
href: /security/benchmark/azure/baselines/functions-security-baseline?toc=/azure/azure-functions/TOC.json
238-
- name: Monitoring
238+
- name: Monitor function executions
239239
href: functions-monitoring.md
240240
displayName: App Insights, Application Insights, logs, logging
241241
- name: Diagnostics
@@ -413,14 +413,15 @@
413413
href: functions-move-across-regions.md
414414
- name: Monitor
415415
items:
416+
- name: Monitor function apps with Azure Monitor
417+
href: monitor-functions.md
418+
displayName: monitor metrics
416419
- name: Configure monitoring
417420
href: configure-monitoring.md
418421
displayName: App Insights, Application Insights, logs, logging
419422
- name: Analyze telemetry data
420423
href: analyze-telemetry-data.md
421424
displayName: App Insights, Application Insights, Kusto
422-
- name: Monitor metrics
423-
href: monitor-metrics.md
424425
- name: Streaming logs
425426
href: streaming-logs.md
426427
displayName: monitoring
@@ -746,6 +747,8 @@
746747
href: functions-host-json.md
747748
- name: host.json 1.x reference
748749
href: functions-host-json-v1.md
750+
- name: Monitoring data
751+
href: monitor-functions-reference.md
749752
- name: Networking FAQ
750753
href: functions-networking-faq.yml
751754
- name: Resources

articles/azure-functions/functions-best-practices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ Premium plan is the recommended plan for reducing colds starts while maintaining
187187

188188
## Monitor effectively
189189

190-
Azure Functions offers built-in integration with Azure Application Insights to monitor your function execution and traces written from your code. To learn more, see [Monitor Azure Functions](functions-monitoring.md). Azure Monitor also provides facilities for monitoring the health of the function app itself. To learn more, see [Using Azure Monitor Metric with Azure Functions](monitor-metrics.md).
190+
Azure Functions offers built-in integration with Azure Application Insights to monitor your function execution and traces written from your code. To learn more, see [Monitor Azure Functions](functions-monitoring.md). Azure Monitor also provides facilities for monitoring the health of the function app itself. To learn more, see [Monitoring with Azure Monitor](monitor-functions.md).
191191

192192
You should be aware of the following considerations when using Application Insights integration to monitor your functions:
193193

articles/azure-functions/functions-monitoring.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
---
2-
title: Monitor Azure Functions
3-
description: Learn how to use Azure Application Insights with Azure Functions to monitor function execution.
2+
title: Monitor executions in Azure Functions
3+
description: Learn how to use Azure Application Insights with Azure Functions to monitor function executions.
44
ms.assetid: 501722c3-f2f7-4224-a220-6d59da08a320
55
ms.topic: conceptual
6-
ms.date: 10/14/2020
6+
ms.date: 07/05/2022
77
ms.custom: "devx-track-csharp, fasttrack-edit, contperf-fy21q2, devx-track-js"
88
# Customer intent: As a developer, I want to understand what facilities are provided to help me monitor my functions so I can know if they're running correctly.
99
---
1010

11-
# Monitor Azure Functions
11+
# Monitor executions in Azure Functions
1212

13-
[Azure Functions](functions-overview.md) offers built-in integration with [Azure Application Insights](../azure-monitor/app/app-insights-overview.md) to monitor functions. This article provides an overview of the monitoring capabilities provided by Azure for monitoring Azure Functions.
13+
[Azure Functions](functions-overview.md) offers built-in integration with [Azure Application Insights](../azure-monitor/app/app-insights-overview.md) to monitor functions executions. This article provides an overview of the monitoring capabilities provided by Azure for monitoring Azure Functions.
1414

1515
Application Insights collects log, performance, and error data. By automatically detecting performance anomalies and featuring powerful analytics tools, you can more easily diagnose issues and better understand how your functions are used. These tools are designed to help you continuously improve performance and usability of your functions. You can even use Application Insights during local function app project development. For more information, see [What is Application Insights?](../azure-monitor/app/app-insights-overview.md).
1616

1717
As Application Insights instrumentation is built into Azure Functions, you need a valid instrumentation key to connect your function app to an Application Insights resource. The instrumentation key is added to your application settings as you create your function app resource in Azure. If your function app doesn't already have this key, you can [set it manually](configure-monitoring.md#enable-application-insights-integration).
1818

19+
You can also monitor the function app itself by using Azure Monitor. To learn more, see [Monitoring Azure Functions with Azure Monitor](monitor-functions.md).
20+
1921
## Application Insights pricing and limits
2022

2123
You can try out Application Insights integration with Azure Functions for free featuring a daily limit to how much data is processed for free.
@@ -107,23 +109,19 @@ Log streams can be viewed both in the portal and in most local development envir
107109

108110
## Diagnostic logs
109111

110-
_This feature is in preview._
111-
112112
Application Insights lets you export telemetry data to long-term storage or other analysis services.
113113

114114
Because Functions also integrates with Azure Monitor, you can also use diagnostic settings to send telemetry data to various destinations, including Azure Monitor logs. To learn more, see [Monitoring Azure Functions with Azure Monitor Logs](functions-monitor-log-analytics.md).
115115

116116
## Scale controller logs
117117

118-
_This feature is in preview._
119-
120118
The [Azure Functions scale controller](./event-driven-scaling.md#runtime-scaling) monitors instances of the Azure Functions host on which your app runs. This controller makes decisions about when to add or remove instances based on current performance. You can have the scale controller emit logs to Application Insights to better understand the decisions the scale controller is making for your function app. You can also store the generated logs in Blob storage for analysis by another service.
121119

122120
To enable this feature, you add an application setting named `SCALE_CONTROLLER_LOGGING_ENABLED` to your function app settings. To learn how, see [Configure scale controller logs](configure-monitoring.md#configure-scale-controller-logs).
123121

124122
## Azure Monitor metrics
125123

126-
In addition to log-based telemetry data collected by Application Insights, you can also get data about how the function app is running from [Azure Monitor Metrics](../azure-monitor/essentials/data-platform-metrics.md). To learn more, see [Using Azure Monitor Metric with Azure Functions](monitor-metrics.md).
124+
In addition to log-based telemetry data collected by Application Insights, you can also get data about how the function app is running from [Azure Monitor Metrics](../azure-monitor/essentials/data-platform-metrics.md). To learn more, see [Monitoring with Azure Monitor](monitor-functions.md).
127125

128126
## Report issues
129127

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: Monitoring Azure Functions data reference
3+
description: Important reference material needed when you monitor Azure Functions
4+
ms.topic: reference
5+
ms.service: azure-functions
6+
ms.custom: subject-monitoring
7+
ms.date: 07/05/2022
8+
---
9+
10+
# Monitoring Azure Functions data reference
11+
12+
This reference applies to the use of Azure Monitor for monitoring function apps hosted in Azure Functions. See [Monitoring function app with Azure Monitor](monitor-functions.md) for details on using Azure Monitor to collect and analyze monitoring data from your function apps.
13+
14+
See [Monitor Azure Functions](functions-monitoring.md) for details on using Application Insights to collect and analyze log data from individual functions in your function app.
15+
16+
## Metrics
17+
18+
This section lists all the automatically collected platform metrics collected for Azure Functions.
19+
20+
### Azure Functions specific metrics
21+
22+
There are two metrics specific to Functions that are of interest:
23+
24+
| Metric | Description |
25+
| ---- | ---- |
26+
| **FunctionExecutionCount** | Function execution count indicates the number of times your function app has executed. This value correlates to the number of times a function runs in your app. |
27+
| **FunctionExecutionUnits** | Function execution units are a combination of execution time and your memory usage. Memory data isn't a metric currently available through Azure Monitor. However, if you want to optimize the memory usage of your app, can use the performance counter data collected by Application Insights. This metric isn't currently supported for Premium and Dedicated (App Service) plans running on Linux.|
28+
29+
These metrics are used specifically when [estimating Consumption plan costs](functions-consumption-costs.md).
30+
31+
### General App Service metrics
32+
33+
Aside from Azure Functions specific metrics, the App Service platform implements more metrics, which you can use to monitor function apps. For the complete list, see [metrics available to App Service apps](../app-service/web-sites-monitor.md#understand-metrics) and [Monitoring App Service data reference](../app-service/monitor-app-service-reference.md#metrics).
34+
35+
## Metric Dimensions
36+
37+
For more information on what metric dimensions are, see [Multi-dimensional metrics](../azure-monitor/essentials/data-platform-metrics.md#multi-dimensional-metrics).
38+
39+
Azure Functions doesn't have any metrics that contain dimensions.
40+
41+
## Resource logs
42+
43+
This section lists the types of resource logs you can collect for your function apps.
44+
45+
| Log type | Description |
46+
|-|-|
47+
| FunctionAppLogs | Function app logs |
48+
49+
For more information, see [Monitoring App Service data reference](../app-service/monitor-app-service-reference.md#resource-logs).
50+
51+
For reference, see a list of [all resource logs category types supported in Azure Monitor](../azure-monitor/essentials/resource-logs-schema.md).
52+
53+
## Azure Monitor Logs tables
54+
55+
Azure Functions uses Kusto tables from Azure Monitor Logs. You can query the [FunctionAppLogs table](/azure/azure-monitor/reference/tables/functionapplogs) with Log Analytics. For more information, see the [Azure Monitor Log Table Reference](/azure/azure-monitor/reference/tables/tables-resourcetype#app-services).
56+
57+
## Activity log
58+
59+
The following table lists the operations related to Azure Functions that may be created in the Activity log.
60+
61+
| Operation | Description |
62+
|:---|:---|
63+
|Microsoft.web/sites/functions/listkeys/action | Return the [keys for the function](functions-bindings-http-webhook-trigger.md#authorization-keys).|
64+
|Microsoft.Web/sites/host/listkeys/action | Return the [host keys for the function app](functions-bindings-http-webhook-trigger.md#authorization-keys).|
65+
|Microsoft.Web/sites/host/sync/action | [Sync triggers](functions-deployment-technologies.md#trigger-syncing) operation.|
66+
|Microsoft.Web/sites/start/action| Function app started. |
67+
|Microsoft.Web/sites/stop/action| Function app stopped.|
68+
|Microsoft.Web/sites/write| Change a function app setting, such as runtime version or enable remote debugging.|
69+
70+
You may also find logged operations that relate to the underlying App Service behaviors. For a more complete list, see [Resource Provider Operations](/azure/role-based-access-control/resource-provider-operations#microsoftweb).
71+
72+
For more information on the schema of Activity Log entries, see [Activity Log schema](../azure-monitor/essentials/activity-log-schema.md).
73+
74+
## See Also
75+
76+
* See [Monitoring Azure Functions](monitor-functions.md) for a description of monitoring Azure Functions.
77+
* See [Monitoring Azure resources with Azure Monitor](../azure-monitor/essentials/monitor-azure-resource.md) for details on monitoring Azure resources.
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
title: Monitoring Azure Functions
3+
description: Start here to learn how to monitor function apps running in Azure Functions using Azure Monitor
4+
ms.topic: how-to
5+
ms.service: azure-functions
6+
ms.custom: subject-monitoring
7+
ms.date: 07/05/2022
8+
---
9+
10+
# Monitoring Azure Functions
11+
12+
When you have critical applications and business processes relying on Azure resources, you want to monitor those resources for their availability, performance, and operation.
13+
14+
This article describes the monitoring data generated by apps hosted in Azure Functions. Azure Functions uses [Azure Monitor](../azure-monitor/overview.md) to monitor the health of your function apps. If you're unfamiliar with the features of Azure Monitor common to all Azure services that use it, see [Monitoring Azure resources with Azure Monitor](../azure-monitor/essentials/monitor-azure-resource.md).
15+
16+
Azure Functions uses Application Insights to collect and analyze log data from individual function executions in your function app. For more information, see [Monitor functions in Azure](functions-monitoring.md).
17+
18+
## Monitoring data
19+
20+
Azure Functions collects the same kinds of monitoring data as other Azure resources that are described in [Azure Monitor data collection](../azure-monitor/essentials/monitor-azure-resource.md#monitoring-data-from-azure-resources).
21+
22+
See [Monitoring Azure Functions data reference](monitor-functions-reference.md) for detailed information on the metrics and logs metrics created by Azure Functions.
23+
24+
## Collection and routing
25+
26+
Platform metrics and the Activity log are collected and stored automatically, but can be routed to other locations by using a diagnostic setting.
27+
28+
Resource Logs aren't collected and stored until you create a diagnostic setting and route them to one or more locations.
29+
30+
See [Create diagnostic setting to collect platform logs and metrics in Azure](../azure-monitor/essentials/diagnostic-settings.md) for the detailed process for creating a diagnostic setting using the Azure portal, CLI, or PowerShell. When you create a diagnostic setting, you specify which categories of logs to collect. The categories for *Azure Functions* are listed in [Azure Functions monitoring data reference](monitor-functions-reference.md#resource-logs).
31+
32+
The metrics and logs you can collect are discussed in the following sections.
33+
34+
## Analyzing metrics
35+
36+
You can analyze metrics for *Azure Functions* with metrics from other Azure services using metrics explorer by opening **Metrics** from the **Azure Monitor** menu. See [Getting started with Azure Metrics Explorer](../azure-monitor/essentials/metrics-getting-started.md) for details on using this tool.
37+
38+
For a list of the platform metrics collected for Azure Functions, see [Monitoring *Azure Functions* data reference metrics](monitor-functions-reference.md#metrics).
39+
40+
For reference, you can see a list of [all resource metrics supported in Azure Monitor](../azure-monitor/essentials/metrics-supported.md).
41+
42+
The following examples use Monitor Metrics to help estimate the cost of running your function app on a Consumption plan. To learn more about estimating Consumption plan costs, see [Estimating Consumption plan costs](functions-consumption-costs.md).
43+
44+
[!INCLUDE [functions-monitor-metrics-consumption](../../includes/functions-monitor-metrics-consumption.md)]
45+
46+
## Analyzing logs
47+
48+
Data in Azure Monitor Logs is stored in tables where each table has its own set of unique properties.
49+
50+
All resource logs in Azure Monitor have the same fields followed by service-specific fields. The common schema is outlined in [Azure Monitor resource log schema](../azure-monitor/essentials/resource-logs-schema.md).
51+
52+
The [Activity log](../azure-monitor/essentials/activity-log.md) is a type of platform log in Azure that provides insight into subscription-level events. You can view it independently or route it to Azure Monitor Logs, where you can do much more complex queries using Log Analytics.
53+
54+
For a list of the types of resource logs collected for Azure Functions, see [Monitoring Azure Functions data reference](monitor-functions-reference.md#resource-logs)
55+
56+
For a list of the tables used by Azure Monitor Logs and queryable by Log Analytics, see [Monitoring Azure Functions data reference](monitor-functions-reference.md#azure-monitor-logs-tables)
57+
58+
### Sample Kusto queries
59+
60+
> [!IMPORTANT]
61+
> When you select **Logs** from the Azure Functions menu, Log Analytics is opened with the query scope set to the current resource. This means that log queries will only include data from that resource. If you want to run a query that includes data from other resources or data from other Azure services, select **Logs** from the **Azure Monitor** menu. See [Log query scope and time range in Azure Monitor Log Analytics](../azure-monitor/logs/scope.md) for details.
62+
63+
Following are queries that you can use to help you monitor your Azure Function.
64+
65+
The following sample query can help you monitor all your functions app logs:
66+
67+
```Kusto
68+
FunctionAppLogs
69+
| project TimeGenerated, HostInstanceId, Message, _ResourceId
70+
| order by TimeGenerated desc
71+
```
72+
73+
The following sample query can help you monitor a specific functions app's logs:
74+
75+
```Kusto
76+
FunctionAppLogs
77+
| where FunctionName == "<Function name>"
78+
| order by TimeGenerated desc
79+
```
80+
81+
The following sample query can help you monitor exceptions on a specific functions app's logs:
82+
83+
```Kusto
84+
FunctionAppLogs
85+
| where ExceptionDetails != ""
86+
| where FunctionName == "<Function name>"
87+
| order by TimeGenerated desc
88+
```
89+
90+
## Alerts
91+
92+
Azure Monitor alerts proactively notify you when important conditions are found in your monitoring data. They allow you to identify and address issues in your system before your customers notice them. You can set alerts on [metrics](../azure-monitor/alerts/alerts-metric-overview.md), [logs](../azure-monitor/alerts/alerts-unified-log.md), and the [activity log](../azure-monitor/alerts/activity-log-alerts.md). Different types of alerts have benefits and drawbacks.
93+
94+
If you're creating or running an application that run on Functions [Azure Monitor Application Insights](../azure-monitor/overview.md#application-insights) may offer other types of alerts.
95+
96+
The following table lists common and recommended alert rules for Functions.
97+
98+
| Alert type | Condition | Examples |
99+
|:---|:---|:---|
100+
| Metric | Average connections| When number of connections exceed a set value|
101+
| Metric | HTTP 404| When HTTP 404 responses exceed a set value|
102+
| Metric | HTTP Server Errors| When HTTP 5xx errors exceed a set value|
103+
| Activity Log | Create or Update Web App | When app is created or updated|
104+
| Activity Log | Delete Web App | When app is deleted|
105+
| Activity Log | Restart Web App| When app is restarted|
106+
| Activity Log | Stop Web App| When app is stopped|
107+
108+
## Next steps
109+
110+
For more information about monitoring Azure Functions, see the following articles:
111+
112+
* [Monitor Azure Functions](functions-monitoring.md) - details how-to monitor a function app.
113+
* [Monitoring Azure Functions data reference](monitor-functions-reference.md) - reference of the metrics, logs, and other important values created by your function app.
114+
* [Monitoring Azure resources with Azure Monitor](../azure-monitor/essentials/monitor-azure-resource.md) - details monitoring Azure resources.
115+
* [Analyze Azure Functions telemetry in Application Insights](analyze-telemetry-data.md) - details how-to view and query the data being collected from a function app.

0 commit comments

Comments
 (0)