Skip to content

Commit 1bc57e7

Browse files
author
Glenn Gailey
committed
1 parent 2858abc commit 1bc57e7

File tree

8 files changed

+27
-58
lines changed

8 files changed

+27
-58
lines changed

articles/azure-functions/functions-monitoring.md

Lines changed: 27 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,22 @@ Early versions of Functions used built-in monitoring, which is no longer recomme
4848

4949
With [Application Insights integration enabled](#enable-application-insights-integration), you can view telemetry data in the **Monitor** tab.
5050

51-
1. In the function app page, select a function that has run at least once after Application Insights was configured. Then select the **Monitor** tab.
52-
53-
![Select Monitor tab](media/functions-monitoring/monitor-tab.png)
54-
55-
1. Select **Refresh** periodically, until the list of function invocations appears.
56-
57-
It can take up to five minutes for the list to appear while the telemetry client batches data for transmission to the server. (The delay doesn't apply to the [Live Metrics Stream](../azure-monitor/app/live-stream.md). That service connects to the Functions host when you load the page, so logs are streamed directly to the page.)
51+
1. In the function app page, select a function that has run at least once after Application Insights was configured. Then select the **Monitor** tab. Select **Refresh** periodically, until the list of function invocations appears.
5852

5953
![Invocations list](media/functions-monitoring/monitor-tab-ai-invocations.png)
6054

61-
1. To see the logs for a particular function invocation, select the **Date** column link for that invocation.
62-
63-
![Invocation details link](media/functions-monitoring/invocation-details-link-ai.png)
55+
> [!NOTE]
56+
> It can take up to five minutes for the list to appear while the telemetry client batches data for transmission to the server. The delay doesn't apply to the [Live Metrics Stream](../azure-monitor/app/live-stream.md). That service connects to the Functions host when you load the page, so logs are streamed directly to the page.
6457
65-
The logging output for that invocation appears in a new page.
58+
1. To see the logs for a particular function invocation, select the **Date (UTC)** column link for that invocation. The logging output for that invocation appears in a new page.
6659

6760
![Invocation details](media/functions-monitoring/invocation-details-ai.png)
6861

69-
You can see that both pages have a **Run in Application Insights** link to the Application Insights Analytics query that retrieves the data.
62+
1. Choose the **Run in Application Insights** link to view the source of the query that retrieves the Azure Monitor log data in Azure Log If this is the first time using Azure Log Analytics in your subscription, you are asked to enable to.
7063

71-
![Run in Application Insights](media/functions-monitoring/run-in-ai.png)
64+
1. When you choose that link and choose to enable Log Analytic. the following query is displayed. You can see that the query results are limited to the last 30 days (`where timestamp > ago(30d)`). In addition, the results show no more than 20 rows (`take 20`). In contrast, the invocation details list for your function is for the last 30 days with no limit.
7265

73-
The following query is displayed. You can see that the query results are limited to the last 30 days (`where timestamp > ago(30d)`). In addition, the results show no more than 20 rows (`take 20`). In contrast, the invocation details list for your function is for the last 30 days with no limit.
74-
75-
![Application Insights Analytics invocation list](media/functions-monitoring/ai-analytics-invocation-list.png)
66+
![Application Insights Analytics invocation list](media/functions-monitoring/ai-analytics-invocation-list.png)
7667

7768
For more information, see [Query telemetry data](#query-telemetry-data) later in this article.
7869

@@ -88,30 +79,29 @@ For information about how to use Application Insights, see the [Application Insi
8879

8980
The following areas of Application Insights can be helpful when evaluating the behavior, performance, and errors in your functions:
9081

91-
| Tab | Description |
82+
| Investigate | Description |
9283
| ---- | ----------- |
9384
| **[Failures](../azure-monitor/app/asp-net-exceptions.md)** | Create charts and alerts based on function failures and server exceptions. The **Operation Name** is the function name. Failures in dependencies aren't shown unless you implement custom telemetry for dependencies. |
94-
| **[Performance](../azure-monitor/app/performance-counters.md)** | Analyze performance issues. |
95-
| **Servers** | View resource utilization and throughput per server. This data can be useful for debugging scenarios where functions are bogging down your underlying resources. Servers are referred to as **Cloud role instances**. |
85+
| **[Performance](../azure-monitor/app/performance-counters.md)** | Analyze performance issues by viewing resource utilization and throughput per **Cloud role instances**. This data can be useful for debugging scenarios where functions are bogging down your underlying resources. |
9686
| **[Metrics](../azure-monitor/app/metrics-explorer.md)** | Create charts and alerts that are based on metrics. Metrics include the number of function invocations, execution time, and success rates. |
97-
| **[Live Metrics Stream](../azure-monitor/app/live-stream.md)** | View metrics data as it's created in near real-time. |
87+
| **[Live Metrics ](../azure-monitor/app/live-stream.md)** | View metrics data as it's created in near real-time. |
9888

9989
## Query telemetry data
10090

101-
[Application Insights Analytics](../azure-monitor/app/analytics.md) gives you access to all telemetry data in the form of tables in a database. Analytics provides a query language for extracting, manipulating, and visualizing the data.
91+
[Application Insights Analytics](../azure-monitor/app/analytics.md) gives you access to all telemetry data in the form of tables in a database. Analytics provides a query language for extracting, manipulating, and visualizing the data.
10292

103-
![Select Analytics](media/functions-monitoring/select-analytics.png)
93+
Choose **Logs** to explore or query for logged events.
10494

10595
![Analytics example](media/functions-monitoring/analytics-traces.png)
10696

10797
Here's a query example that shows the distribution of requests per worker over the last 30 minutes.
10898

109-
```
99+
<pre>
110100
requests
111101
| where timestamp > ago(30m)
112102
| summarize count() by cloud_RoleInstance, bin(timestamp, 1m)
113103
| render timechart
114-
```
104+
</pre>
115105

116106
The tables that are available are shown in the **Schema** tab on the left. You can find data generated by function invocations in the following tables:
117107

@@ -128,10 +118,10 @@ The other tables are for availability tests, and client and browser telemetry. Y
128118

129119
Within each table, some of the Functions-specific data is in a `customDimensions` field. For example, the following query retrieves all traces that have log level `Error`.
130120

131-
```
121+
<pre>
132122
traces
133123
| where customDimensions.LogLevel == "Error"
134-
```
124+
</pre>
135125

136126
The runtime provides the `customDimensions.LogLevel` and `customDimensions.Category` fields. You can provide additional fields in logs that you write in your function code. See [Structured logging](#structured-logging) later in this article.
137127

@@ -141,11 +131,20 @@ You can use Application Insights without any custom configuration. The default c
141131

142132
### Categories
143133

144-
The Azure Functions logger includes a *category* for every log. The category indicates which part of the runtime code or your function code wrote the log.
134+
The Azure Functions logger includes a *category* for every log. The category indicates which part of the runtime code or your function code wrote the log. The following chart describes the main categories of logs that the runtime creates.
135+
136+
| Category | Description |
137+
| ----- | ----- |
138+
| Host.Results | These logs show as **requests** in Application Insights. They indicate success or failure of a function. All of these logs are written at `Information` level. If you filter at `Warning` or above, you won't see any of this data. |
139+
| Host.Aggregator | These logs provide counts and averages of function invocations over a [configurable](#configure-the-aggregator) period of time. The default period is 30 seconds or 1,000 results, whichever comes first. The logs are available in the **customMetrics** table in Application Insights. Examples are the number of runs, success rate, and duration. All of these logs are written at `Information` level. If you filter at `Warning` or above, you won't see any of this data. |
140+
141+
All logs for categories other than these are available in the **traces** table in Application Insights.
142+
143+
All logs with categories that begin with `Host` are written by the Functions runtime. The **Function started** and **Function completed** logs have category `Host.Executor`. For successful runs, these logs are `Information` level. Exceptions are logged at `Error` level. The runtime also creates `Warning` level logs, for example: queue messages sent to the poison queue.
145144

146145
The Functions runtime creates logs with a category that begin with "Host." In version 1.x, the `function started`, `function executed`, and `function completed` logs have the category `Host.Executor`. Starting in version 2.x, these logs have the category `Function.<YOUR_FUNCTION_NAME>`.
147146

148-
If you write logs in your function code, the category is `Function` in version 1.x of the Functions runtime. In version 2.x, the category is `Function.<YOUR_FUNCTION_NAME>.User`.
147+
If you write logs in your function code, the category is is `Function.<YOUR_FUNCTION_NAME>.User` and can be any log level. In version 1.x of the Functions runtime, the category is `Function`.
149148

150149
### Log levels
151150

@@ -247,36 +246,6 @@ If [host.json] includes multiple categories that start with the same string, the
247246

248247
To suppress all logs for a category, you can use log level `None`. No logs are written with that category and there's no log level above it.
249248

250-
The following sections describe the main categories of logs that the runtime creates.
251-
252-
### Category Host.Results
253-
254-
These logs show as "requests" in Application Insights. They indicate success or failure of a function.
255-
256-
![Requests chart](media/functions-monitoring/requests-chart.png)
257-
258-
All of these logs are written at `Information` level. If you filter at `Warning` or above, you won't see any of this data.
259-
260-
### Category Host.Aggregator
261-
262-
These logs provide counts and averages of function invocations over a [configurable](#configure-the-aggregator) period of time. The default period is 30 seconds or 1,000 results, whichever comes first.
263-
264-
The logs are available in the **customMetrics** table in Application Insights. Examples are the number of runs, success rate, and duration.
265-
266-
![customMetrics query](media/functions-monitoring/custom-metrics-query.png)
267-
268-
All of these logs are written at `Information` level. If you filter at `Warning` or above, you won't see any of this data.
269-
270-
### Other categories
271-
272-
All logs for categories other than the ones already listed are available in the **traces** table in Application Insights.
273-
274-
![traces query](media/functions-monitoring/analytics-traces.png)
275-
276-
All logs with categories that begin with `Host` are written by the Functions runtime. The "Function started" and "Function completed" logs have category `Host.Executor`. For successful runs, these logs are `Information` level. Exceptions are logged at `Error` level. The runtime also creates `Warning` level logs, for example: queue messages sent to the poison queue.
277-
278-
Logs written by your function code have category `Function` and can be any log level.
279-
280249
## Configure the aggregator
281250

282251
As noted in the previous section, the runtime aggregates data about function executions over a period of time. The default period is 30 seconds or 1,000 runs, whichever comes first. You can configure this setting in the [host.json] file. Here's an example:
87.4 KB
Loading
12.6 KB
Loading
69.2 KB
Loading
Binary file not shown.
118 KB
Loading
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)