Skip to content

Commit fd58295

Browse files
Merge pull request #299406 from TimShererWithAquent/us424061-11
Freshness Edit: Azure Functions (11 of several)
2 parents faf8353 + 1e5d655 commit fd58295

File tree

2 files changed

+40
-41
lines changed

2 files changed

+40
-41
lines changed
Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
---
22
title: Monitor executions in Azure Functions
3-
description: Learn how to use Azure Application Insights with Azure Functions to monitor function executions.
3+
description: Learn how to use Azure Application Insights with Azure Functions to monitor function executions. Application Insights collects log, performance, and error data.
44
ms.assetid: 501722c3-f2f7-4224-a220-6d59da08a320
55
ms.topic: conceptual
6-
ms.date: 07/05/2022
6+
ms.date: 05/07/2025
77
ms.custom: devx-track-csharp, fasttrack-edit
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

1111
# Monitor executions in Azure Functions
1212

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

15-
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/azure-monitor/app/app-insights-overview).
15+
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 [Introduction to Application Insights](/azure/azure-monitor/app/app-insights-overview).
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).
19+
You can also monitor the function app itself by using Azure Monitor. To learn more, see [Monitor Azure Functions](monitor-functions.md).
2020

2121
## Application Insights pricing and limits
2222

2323
You can try out Application Insights integration with Azure Functions for free featuring a daily limit to how much data is processed for free.
2424

25-
If you enable Applications Insights during development, you might hit this limit during testing. Azure provides portal and email notifications when you're approaching your daily limit. If you miss those alerts and hit the limit, new logs won't appear in Application Insights queries. Be aware of the limit to avoid unnecessary troubleshooting time. For more information, see [Application Insights billing](/azure/azure-monitor/logs/cost-logs#application-insights-billing).
25+
If you enable Applications Insights during development, you might hit this limit during testing. Azure provides portal and email notifications when you're approaching your daily limit. If you miss those alerts and hit the limit, new logs don't appear in Application Insights queries. Be aware of the limit to avoid unnecessary troubleshooting time. For more information, see [Application Insights billing](/azure/azure-monitor/logs/cost-logs#application-insights-billing).
2626

2727
> [!IMPORTANT]
2828
> Application Insights has a [sampling](/azure/azure-monitor/app/sampling) feature that can protect you from producing too much telemetry data on completed executions at times of peak load. Sampling is enabled by default. If you appear to be missing data, you might need to adjust the sampling settings to fit your particular monitoring scenario. To learn more, see [Configure sampling](configure-monitoring.md#configure-sampling).
@@ -37,9 +37,9 @@ Typically, you create an Application Insights instance when you create your func
3737
3838
The following table details the supported features of Application Insights available for monitoring your function apps:
3939

40-
| Azure Functions runtime version | 1.x | 2.x+ |
40+
| Azure Functions runtime version | 1.x | 4.x+ |
4141
|-----------------------------------|:---------------:|:------------------:|
42-
| | | |
42+
| | | |
4343
| **Automatic collection of** | | |
4444
| • Requests |||
4545
| • Exceptions |||
@@ -51,26 +51,26 @@ The following table details the supported features of Application Insights avail
5151
|    — SQL\* | ||
5252
| | | |
5353
| **Supported features** | | |
54-
| • QuickPulse/LiveMetrics | Yes | Yes |
55-
|    — Secure Control Channel | | Yes |
56-
| • Sampling | Yes | Yes |
57-
| • Heartbeats | | Yes |
54+
| • QuickPulse/LiveMetrics | Yes | Yes |
55+
|    — Secure Control Channel | | Yes |
56+
| • Sampling | Yes | Yes |
57+
| • Heartbeats | | Yes |
5858
| | | |
5959
| **Correlation** | | |
6060
| • Service Bus | | Yes |
6161
| • Event Hubs | | Yes |
6262
| | | |
63-
| **Configurable** | | |
64-
| •[Fully configurable](#custom-telemetry-data) | | Yes |
63+
| **Configurable** | | |
64+
| •[Fully configurable](#custom-telemetry-data) | | Yes |
6565

6666
\* To enable the collection of SQL query string text, see [Enable SQL query collection](./configure-monitoring.md#enable-sql-query-collection).
6767

6868
## Collecting telemetry data
6969

70-
With Application Insights integration enabled, telemetry data is sent to your connected Application Insights instance. This data includes logs generated by the Functions host, traces written from your functions code, and performance data.
70+
With Application Insights integration enabled, telemetry data is sent to your connected Application Insights instance. This data includes logs generated by the Functions host, traces written from your functions code, and performance data.
7171

7272
>[!NOTE]
73-
>In addition to data from your functions and the Functions host, you can also collect data from the [Functions scale controller](#scale-controller-logs).
73+
>In addition to data from your functions and the Functions host, you can also collect data from the [Functions scale controller](#scale-controller-logs).
7474
7575
### Log levels and categories
7676

@@ -90,71 +90,70 @@ In [C#](functions-dotnet-class-library.md#log-custom-telemetry-in-c-functions),
9090

9191
Starting with version 2.x of Functions, Application Insights automatically collects data on dependencies for bindings that use certain client SDKs. Application Insights collects data on the following dependencies:
9292

93-
+ Azure Cosmos DB
94-
+ Azure Event Hubs
95-
+ Azure Service Bus
96-
+ Azure Storage services (Blob, Queue, and Table)
93+
- Azure Cosmos DB
94+
- Azure Event Hubs
95+
- Azure Service Bus
96+
- Azure Storage services (Blob, Queue, and Table)
9797

9898
HTTP requests and database calls using `SqlClient` are also captured. For the complete list of dependencies supported by Application Insights, see [automatically tracked dependencies](/azure/azure-monitor/app/asp-net-dependencies#automatically-tracked-dependencies).
9999

100100
Application Insights generates an _application map_ of collected dependency data. The following is an example of an application map of an HTTP trigger function with a Queue storage output binding.
101101

102-
![Application map with dependency](./media/functions-monitoring/app-map.png)
102+
:::image type="content" source="./media/functions-monitoring/app-map.png" alt-text="Screenshot shows an application map with dependency in the Azure portal.":::
103103

104-
Dependencies are written at the `Information` level. If you filter at `Warning` or above, you won't see the dependency data. Also, automatic collection of dependencies happens at a non-user scope. To capture dependency data, make sure the level is set to at least `Information` outside the user scope (`Function.<YOUR_FUNCTION_NAME>.User`) in your host.
104+
Dependencies are written at the `Information` level. If you filter at `Warning` or above, you don't see the dependency data. Also, automatic collection of dependencies happens at a non-user scope. To capture dependency data, make sure the level is set to at least `Information` outside the user scope (`Function.<YOUR_FUNCTION_NAME>.User`) in your host.
105105

106106
In addition to automatic dependency data collection, you can also use one of the language-specific Application Insights SDKs to write custom dependency information to the logs. For an example how to write custom dependencies, see one of the following language-specific examples:
107107

108-
+ [Log custom telemetry in C# functions](functions-dotnet-class-library.md#log-custom-telemetry-in-c-functions)
109-
+ [Log custom telemetry in JavaScript functions](functions-reference-node.md#track-custom-data)
110-
+ [Log custom telemetry in Python functions](functions-reference-python.md#log-custom-telemetry)
108+
- [Log custom telemetry in C# functions](functions-dotnet-class-library.md#log-custom-telemetry-in-c-functions)
109+
- [Log custom telemetry in JavaScript functions](functions-reference-node.md#track-custom-data)
110+
- [Log custom telemetry in Python functions](functions-reference-python.md#log-custom-telemetry)
111111

112112
### Performance Counters
113113

114114
Automatic collection of Performance Counters isn't supported when running on Linux.
115115

116-
## Writing to logs
116+
## Writing to logs
117117

118-
The way that you write to logs and the APIs you use depend on the language of your function app project.
119-
See the developer guide for your language to learn more about writing logs from your functions.
118+
The way that you write to logs and the APIs you use depend on the language of your function app project. See the developer guide for your language to learn more about writing logs from your functions.
120119

121-
+ [C# (.NET class library)](functions-dotnet-class-library.md#logging)
122-
+ [Java](functions-reference-java.md#logger)
123-
+ [JavaScript](functions-reference-node.md#logging)
124-
+ [PowerShell](functions-reference-powershell.md#logging)
125-
+ [Python](functions-reference-python.md#logging)
120+
- [C# (.NET class library)](functions-dotnet-class-library.md#logging)
121+
- [Java](functions-reference-java.md#logger)
122+
- [JavaScript](functions-reference-node.md#logging)
123+
- [PowerShell](functions-reference-powershell.md#logging)
124+
- [Python](functions-reference-python.md#logging)
126125

127126
## Analyze data
128127

129-
By default, the data collected from your function app is stored in Application Insights. In the [Azure portal](https://portal.azure.com), Application Insights provides an extensive set of visualizations of your telemetry data. You can drill into error logs and query events and metrics. To learn more, including basic examples of how to view and query your collected data, see [Analyze Azure Functions telemetry in Application Insights](analyze-telemetry-data.md).
128+
By default, the data collected from your function app is stored in Application Insights. In the [Azure portal](https://portal.azure.com), Application Insights provides an extensive set of visualizations of your telemetry data. You can drill into error logs and query events and metrics. To learn more, including basic examples of how to view and query your collected data, see [Analyze Azure Functions telemetry in Application Insights](analyze-telemetry-data.md).
130129

131130
## Streaming Logs
132131

133132
While developing an application, you often want to see what's being written to the logs in near real time when running in Azure.
134133

135134
There are two ways to view a stream of the log data being generated by your function executions.
136135

137-
* **Built-in log streaming**: the App Service platform lets you view a stream of your application log files. This stream is equivalent to the output seen when you debug your functions during [local development](functions-develop-local.md) and when you use the **Test** tab in the portal. All log-based information is displayed. For more information, see [Stream logs](../app-service/troubleshoot-diagnostic-logs.md#stream-logs). This streaming method supports only a single instance, and can't be used with an app running on Linux in a Consumption plan.
136+
- **Built-in log streaming**: the App Service platform lets you view a stream of your application log files. This stream is equivalent to the output seen when you debug your functions during [local development](functions-develop-local.md) and when you use the **Test** tab in the portal. All log-based information is displayed. For more information, see [Stream logs](../app-service/troubleshoot-diagnostic-logs.md#stream-logs). This streaming method supports only a single instance, and can't be used with an app running on Linux in a Consumption plan.
138137

139-
* **Live Metrics Stream**: when your function app is [connected to Application Insights](configure-monitoring.md#enable-application-insights-integration), you can view log data and other metrics in near real time in the Azure portal using [Live Metrics Stream](/azure/azure-monitor/app/live-stream). Use this method when monitoring functions running on multiple-instances or on Linux in a Consumption plan. This method uses [sampled data](configure-monitoring.md#configure-sampling).
138+
- **Live Metrics Stream**: when your function app is [connected to Application Insights](configure-monitoring.md#enable-application-insights-integration), you can view log data and other metrics in near real time in the Azure portal using [Live Metrics Stream](/azure/azure-monitor/app/live-stream). Use this method when monitoring functions running on multiple-instances or on Linux in a Consumption plan. This method uses [sampled data](configure-monitoring.md#configure-sampling).
140139

141140
Log streams can be viewed both in the portal and in most local development environments. To learn how to enable log streams, see [Enable streaming execution logs in Azure Functions](streaming-logs.md).
142141

143142
## Diagnostic logs
144143

145144
Application Insights lets you export telemetry data to long-term storage or other analysis services.
146145

147-
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).
146+
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 [Monitor Azure Functions](functions-monitor-log-analytics.md).
148147

149148
## Scale controller logs
150149

151-
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.
150+
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.
152151

153152
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).
154153

155154
## Azure Monitor metrics
156155

157-
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/azure-monitor/essentials/data-platform-metrics). To learn more, see [Monitoring with Azure Monitor](monitor-functions.md).
156+
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/azure-monitor/essentials/data-platform-metrics). To learn more, see [Monitor Azure Functions](monitor-functions.md).
158157

159158
## Report issues
160159

@@ -164,5 +163,5 @@ To report an issue with Application Insights integration in Functions, or to mak
164163

165164
For more information, see the following resources:
166165

167-
* [Application Insights](/azure/azure-monitor/app/app-insights-overview)
168-
* [ASP.NET Core logging](/aspnet/core/fundamentals/logging/)
166+
- [Application Insights](/azure/azure-monitor/app/app-insights-overview)
167+
- [ASP.NET Core logging](/aspnet/core/fundamentals/logging/)
-16.5 KB
Loading

0 commit comments

Comments
 (0)