You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/durable/durable-functions-diagnostics.md
+28-24Lines changed: 28 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ There are several options for diagnosing issues with [Durable Functions](durable
15
15
16
16
## Application Insights
17
17
18
-
[Application Insights](/azure/azure-monitor/app/app-insights-overview) is the recommended way to do diagnostics and monitoring in Azure Functions. The same applies to Durable Functions. For an overview of how to leverage Application Insights in your function app, see [Monitor Azure Functions](../functions-monitoring.md).
18
+
[Application Insights](/azure/azure-monitor/app/app-insights-overview) is the recommended way to do diagnostics and monitoring in Azure Functions. The same applies to Durable Functions. For an overview of how to use Application Insights in your function app, see [Monitor Azure Functions](../functions-monitoring.md).
19
19
20
20
The Azure Functions Durable Extension also emits *tracking events* that allow you to trace the end-to-end execution of an orchestration. These tracking events can be found and queried using the [Application Insights Analytics](/azure/azure-monitor/logs/log-query-overview) tool in the Azure portal.
21
21
@@ -31,15 +31,15 @@ Each lifecycle event of an orchestration instance causes a tracking event to be
31
31
***instanceId**: The unique ID of the orchestration instance.
32
32
***state**: The lifecycle execution state of the instance. Valid values include:
33
33
***Scheduled**: The function was scheduled for execution but hasn't started running yet.
34
-
***Started**: The function has started running but has not yet awaited or completed.
34
+
***Started**: The function started running but has not yet awaited or completed.
35
35
***Awaited**: The orchestrator has scheduled some work and is waiting for it to complete.
36
36
***Listening**: The orchestrator is listening for an external event notification.
37
-
***Completed**: The function has completed successfully.
37
+
***Completed**: The function completed successfully.
38
38
***Failed**: The function failed with an error.
39
-
***reason**: Additional data associated with the tracking event. For example, if an instance is waiting for an external event notification, this field indicates the name of the event it is waiting for. If a function has failed, this field will contain the error details.
39
+
***reason**: Additional data associated with the tracking event. For example, if an instance is waiting for an external event notification, this field indicates the name of the event it is waiting for. If a function fails, this field contains the error details.
40
40
***isReplay**: Boolean value indicating whether the tracking event is for replayed execution.
41
41
***extensionVersion**: The version of the Durable Task extension. The version information is especially important data when reporting possible bugs in the extension. Long-running instances may report multiple versions if an update occurs while it is running.
42
-
***sequenceNumber**: Execution sequence number for an event. Combined with the timestamp helps to order the events by execution time. *Note that this number will be reset to zero if the host restarts while the instance is running, so it's important to always sort by timestamp first, then sequenceNumber.*
42
+
***sequenceNumber**: Execution sequence number for an event. Combined with the timestamp helps to order the events by execution time. *Note that this number resets to zero if the host restarts while the instance is running, so it's important to always sort by timestamp first, then sequenceNumber.*
43
43
44
44
The verbosity of tracking data emitted to Application Insights can be configured in the `logger` (Functions 1.x) or `logging` (Functions 2.0) section of the `host.json` file.
45
45
@@ -69,10 +69,10 @@ The verbosity of tracking data emitted to Application Insights can be configured
69
69
}
70
70
```
71
71
72
-
By default, all *non-replay* tracking events are emitted. The volume of data can be reduced by setting `Host.Triggers.DurableTask` to `"Warning"` or `"Error"` in which case tracking events will only be emitted for exceptional situations. To enable emitting the verbose orchestration replay events, set the `logReplayEvents` to `true` in the [host.json](durable-functions-bindings.md#host-json) configuration file.
72
+
By default, all *non-replay* tracking events are emitted. The volume of data can be reduced by setting `Host.Triggers.DurableTask` to `"Warning"` or `"Error"` in which case tracking events are only emitted for exceptional situations. To enable emitting the verbose orchestration replay events, set the `logReplayEvents` to `true` in the [host.json](durable-functions-bindings.md#host-json) configuration file.
73
73
74
74
> [!NOTE]
75
-
> By default, Application Insights telemetry is sampled by the Azure Functions runtime to avoid emitting data too frequently. This can cause tracking information to be lost when many lifecycle events occur in a short period of time. The [Azure Functions Monitoring article](../configure-monitoring.md#configure-sampling) explains how to configure this behavior.
75
+
> By default, the Azure Functions runtime samples Application Insights telemetry to avoid emitting data too frequently. Sampling can cause tracking information to be lost when many lifecycle events occur in a short period of time. The [Azure Functions Monitoring article](../configure-monitoring.md#configure-sampling) explains how to configure this behavior.
76
76
77
77
Inputs and outputs of orchestrator, activity, and entity functions are not logged by default. This default behavior is recommended because logging inputs and outputs could increase Application Insights costs. Function input and output payloads may also contain sensitive information. Instead, the number of bytes for function inputs and outputs are logged instead of the actual payloads by default. If you want the Durable Functions extension to log the full input and output payloads, set the `traceInputsAndOutputs` property to `true` in the [host.json](durable-functions-bindings.md#host-json) configuration file.
78
78
@@ -150,10 +150,10 @@ You can enable these logs by updating the `logging/logLevel` section of your fun
150
150
}
151
151
```
152
152
153
-
If you have Application Insights enabled, these logs will be automatically added to the `trace` collection. You can search them the same way that you search for other `trace` logs using Kusto queries.
153
+
If you have Application Insights enabled, these logs are automatically added to the `trace` collection. You can search them the same way that you search for other `trace` logs using Kusto queries.
154
154
155
155
> [!NOTE]
156
-
> For production applications, it is recommended that you enable `DurableTask.Core` and the appropriate storage provider (e.g. `DurableTask.AzureStorage`) logs using the `"Warning"` filter. Higher verbosity filters such as `"Information"` are very useful for debugging performance issues. However, these log events can be high-volume and can significantly increase Application Insights data storage costs.
156
+
> For production applications, it is recommended that you enable `DurableTask.Core` and the appropriate storage provider (e.g. `DurableTask.AzureStorage`) logs using the `"Warning"` filter. Higher verbosity filters such as `"Information"` are useful for debugging performance issues. However, these log events can be high-volume and can significantly increase Application Insights data storage costs.
157
157
158
158
The following Kusto query shows how to query for DTFx logs. The most important part of the query is `where customerDimensions.Category startswith "DurableTask"` since that filters the results to logs in the `DurableTask.Core` and `DurableTask.AzureStorage` categories.
159
159
@@ -287,7 +287,7 @@ Done!
287
287
```
288
288
289
289
> [!NOTE]
290
-
> Remember that while the logs claim to be calling F1, F2, and F3, those functions are only *actually* called the first time they are encountered. Subsequent calls that happen during replay are skipped and the outputs are replayed to the orchestrator logic.
290
+
> Remember that while the logs claim to be calling F1, F2, and F3, those functions are *only* called the first time they are encountered. Subsequent calls that happen during replay are skipped and the outputs are replayed to the orchestrator logic.
291
291
292
292
If you want to only write logs on non-replay executions, you can write a conditional expression to log only if the "is replaying" flag is `false`. Consider the example above, but this time with replay checks.
293
293
@@ -309,7 +309,7 @@ public static async Task Run(
309
309
}
310
310
```
311
311
312
-
Starting in Durable Functions 2.0, .NET orchestrator functions also have the option to create an `ILogger` that automatically filters out log statements during replay. This automatic filtering is done using the [IDurableOrchestrationContext.CreateReplaySafeLogger(ILogger)](/dotnet/api/microsoft.azure.webjobs.extensions.durabletask.durablecontextextensions.createreplaysafelogger) API.
312
+
Starting in Durable Functions 2.0, .NET orchestrator functions can create an `ILogger` that automatically filters out log statements during replay. This automatic filtering is done using the [IDurableOrchestrationContext.CreateReplaySafeLogger(ILogger)](/dotnet/api/microsoft.azure.webjobs.extensions.durabletask.durablecontextextensions.createreplaysafelogger) API.
313
313
314
314
```csharp
315
315
[FunctionName("FunctionChain")]
@@ -351,7 +351,7 @@ public static async Task Run([OrchestrationTrigger] TaskOrchestrationContext con
351
351
```
352
352
353
353
> [!NOTE]
354
-
> The ability to wrap an existing `ILogger` into a replay-safe logger has been removed in Durable Functions for .NET isolated worker.
354
+
> The ability to wrap an existing `ILogger` into a replay-safe logger is removed in Durable Functions for .NET isolated worker.
355
355
356
356
# [JavaScript](#tab/javascript)
357
357
@@ -523,7 +523,7 @@ GET /runtime/webhooks/durabletask/instances/instance123?code=XYZ
523
523
524
524
```
525
525
526
-
Clients will get the following response:
526
+
Clients get the following response:
527
527
528
528
```json
529
529
{
@@ -544,32 +544,36 @@ Clients will get the following response:
544
544
Distributed Tracing tracks requests and shows how different services interact with each other. In Durable Functions, it also correlates orchestrations and activities together. This is helpful to understand how much time steps of the orchestration take relative to the entire orchestration. It is also useful to understand where an application is having an issue or where an exception was thrown. This feature is supported for all languages and storage providers.
545
545
546
546
> [!NOTE]
547
-
> Distributed Tracing V2 requires [Durable Functions v2.12.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask/2.12.0) or greater. Also, Distributed Tracing V2 is in a preview state and therefore some Durable Functions patterns are not instrumented. For example, Durable Entities operations are not instrumented and traces will not show up in Application Insights.
547
+
> Distributed Tracing V2 requires [Durable Functions v2.12.0](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.DurableTask/2.12.0) or greater. Also, Distributed Tracing V2 is in a preview state and therefore some Durable Functions patterns are not instrumented. For example, Durable Entities operations are not instrumented and traces do not show up in Application Insights.
548
548
549
549
### Setting up Distributed Tracing
550
550
551
-
To set up distributed tracing, please update the host.json and set up an Application Insights resource.
551
+
To set up distributed tracing, update the host.json and set up an Application Insights resource.
552
552
553
553
#### host.json
554
554
```
555
-
"durableTask": {
556
-
"tracing": {
557
-
"distributedTracingEnabled": true,
558
-
"Version": "V2"
559
-
}
560
-
}
555
+
{
556
+
"extensions": {
557
+
"durableTask": {
558
+
"tracing": {
559
+
"distributedTracingEnabled": true,
560
+
"version": "V2"
561
+
}
562
+
}
563
+
}
564
+
}
561
565
```
562
566
563
567
#### Application Insights
564
-
If the Function app is not configured with an Application Insights resource, then please configure it following the instructions [here](../configure-monitoring.md#enable-application-insights-integration).
568
+
If the Function app is not configured with an Application Insights resource, then configure it following the instructions [here](../configure-monitoring.md#enable-application-insights-integration).
565
569
566
570
### Inspecting the traces
567
-
In the Application Insights resource, navigate to **Transaction Search**. In the results, check for `Request` and `Dependency` events that start with Durable Functions specific prefixes (e.g. `orchestration:`, `activity:`, etc.). Selecting one of these events will open up a Gantt chart that will show the end to end distributed trace.
571
+
In the Application Insights resource, navigate to **Transaction Search**. In the results, check for `Request` and `Dependency` events that start with Durable Functions specific prefixes (e.g. `orchestration:`, `activity:`, etc.). Selecting one of these events opens up a Gantt chart that shows the end to end distributed trace.
If you don't see the traces in Application Insights, please make sure to wait about five minutes after running the application to ensure that all of the data is propagated to the Application Insights resource.
576
+
If you don't see the traces in Application Insights, make sure to wait about five minutes after running the application to ensure that all of the data is propagated to the Application Insights resource.
0 commit comments