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-monitor/profiler/profiler-aspnetcore-linux.md
+21-17Lines changed: 21 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,9 @@ In this guide, you'll:
22
22
23
23
- Install the [latest and greatest .NET Core SDK](https://dotnet.microsoft.com/download/dotnet).
24
24
- Install Git by following the instructions at [Getting Started - Installing Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
25
+
- Review the following samples for context:
26
+
-[Enable Service Profiler for containerized ASP.NET Core Application (.NET 6)](https://github.com/microsoft/ApplicationInsights-Profiler-AspNetCore/tree/main/examples/EnableServiceProfilerForContainerAppNet6)
27
+
-[Application Insights Profiler for Worker Service Example](https://github.com/microsoft/ApplicationInsights-Profiler-AspNetCore/tree/main/examples/ServiceProfilerInWorkerNet6)
1. In your preferred code editor, enable Application Insights and Profiler in `Program.cs`:
47
+
1. In your preferred code editor, enable Application Insights and Profiler in `Program.cs`. [Add custom Profiler settings, if applicable](https://github.com/microsoft/ApplicationInsights-Profiler-AspNetCore/blob/main/Configurations.md).
@@ -16,170 +16,132 @@ If your ASP.NET or ASP.NET Core application runs in App Service and requires a c
16
16
17
17
If your application runs in Azure Service Fabric, Cloud Service, Virtual Machines, or on-premises machines, you can skip enabling Snapshot Debugger on App Services and jump into following this guide.
18
18
19
+
## Before you begin
20
+
21
+
-[Enable Application Insights in your web app](../app/asp-net.md).
22
+
23
+
- Include the [Microsoft.ApplicationInsights.SnapshotCollector](https://www.nuget.org/packages/Microsoft.ApplicationInsights.SnapshotCollector) NuGet package version 1.3.5 or above in your app.
24
+
19
25
## Configure snapshot collection for ASP.NET applications
20
26
21
-
### Prerequisite
22
-
23
-
[Enable Application Insights in your web app](../app/asp-net.md).
24
-
25
-
1. Include the [Microsoft.ApplicationInsights.SnapshotCollector](https://www.nuget.org/packages/Microsoft.ApplicationInsights.SnapshotCollector) NuGet package in your app.
26
-
27
-
1. If needed, customize the Snapshot Debugger configuration added to [ApplicationInsights.config](../app/configuration-with-applicationinsights-config.md).
28
-
29
-
The default Snapshot Debugger configuration is mostly empty and all settings are optional. Here's an example showing a configuration equivalent to the default configuration:
<!-- The limit on the number of failed requests to request snapshots before the telemetry processor is disabled. -->
58
-
<FailedRequestLimit>3</FailedRequestLimit>
59
-
</Add>
60
-
</TelemetryProcessors>
61
-
```
62
-
63
-
1. Snapshots are collected only on exceptions that are reported to Application Insights. In some cases (for example, older versions of the .NET platform), you might need to [configure exception collection](../app/asp-net-exceptions.md#exceptions) to see exceptions with snapshots in the portal.
27
+
The default Snapshot Debugger configuration is mostly empty and all settings are optional. You can customize the Snapshot Debugger configuration added to [ApplicationInsights.config](../app/configuration-with-applicationinsights-config.md).
28
+
29
+
The following example shows a configuration equivalent to the default configuration:
<!-- The limit on the number of failed requests to request snapshots before the telemetry processor is disabled. -->
58
+
<FailedRequestLimit>3</FailedRequestLimit>
59
+
</Add>
60
+
</TelemetryProcessors>
61
+
```
62
+
63
+
Snapshots are collected _only_ on exceptions reported to Application Insights. In some cases (for example, older versions of the .NET platform), you may need to [configure exception collection](../app/asp-net-exceptions.md#exceptions) to see exceptions with snapshots in the portal.
64
64
65
65
## Configure snapshot collection for applications using ASP.NET Core LTS or above
66
66
67
67
### Prerequisites
68
68
69
-
[Enable Application Insights in your ASP.NET Core web app](../app/asp-net-core.md), if you haven't done it yet.
70
-
> [!NOTE]
71
-
> Be sure that your application references version 2.1.1, or newer, of the Microsoft.ApplicationInsights.AspNetCore package.
72
-
73
-
1. Include the [Microsoft.ApplicationInsights.SnapshotCollector](https://www.nuget.org/packages/Microsoft.ApplicationInsights.SnapshotCollector) NuGet package in your app.
74
-
75
-
1. Modify your application's `Startup` class to add and configure the Snapshot Collector's telemetry processor.
76
-
1. If [Microsoft.ApplicationInsights.SnapshotCollector](https://www.nuget.org/packages/Microsoft.ApplicationInsights.SnapshotCollector) NuGet package version 1.3.5 or above is used, then add the following using statements to *Startup.cs*:
77
-
78
-
```csharp
79
-
using Microsoft.ApplicationInsights.SnapshotCollector;
80
-
```
81
-
82
-
Add the following at the end of the ConfigureServices method in the `Startup` class in *Startup.cs*:
1. If [Microsoft.ApplicationInsights.SnapshotCollector](https://www.nuget.org/packages/Microsoft.ApplicationInsights.SnapshotCollector) NuGet package version 1.3.4 or below is used, then add the following using statements to *Startup.cs*.
89
-
90
-
```csharp
91
-
using Microsoft.ApplicationInsights.SnapshotCollector;
92
-
using Microsoft.Extensions.Options;
93
-
using Microsoft.ApplicationInsights.AspNetCore;
94
-
using Microsoft.ApplicationInsights.Extensibility;
95
-
```
96
-
97
-
Add the following `SnapshotCollectorTelemetryProcessorFactory` class to `Startup` class:
98
-
99
-
```csharp
100
-
class Startup
101
-
{
102
-
private class SnapshotCollectorTelemetryProcessorFactory : ITelemetryProcessorFactory
1. If your application isn't already instrumented with Application Insights, get started by [enabling Application Insights and setting the instrumentation key](https://github.com/Microsoft/appcenter).
1. Add the [Microsoft.ApplicationInsights.SnapshotCollector](https://www.nuget.org/packages/Microsoft.ApplicationInsights.SnapshotCollector) NuGet package in your app.
If needed, customize the Snapshot Debugger configuration by adding a `SnapshotCollectorConfiguration` section to *appsettings.json*. The following example shows a configuration equivalent to the default configuration:
106
+
107
+
```json
108
+
{
109
+
"SnapshotCollectorConfiguration": {
110
+
"IsEnabledInDeveloperMode": false,
111
+
"ThresholdForSnapshotting": 1,
112
+
"MaximumSnapshotsRequired": 3,
113
+
"MaximumCollectionPlanSize": 50,
114
+
"ReconnectInterval": "00:15:00",
115
+
"ProblemCounterResetInterval":"1.00:00:00",
116
+
"SnapshotsPerTenMinutesLimit": 1,
117
+
"SnapshotsPerDayLimit": 30,
118
+
"SnapshotInLowPriorityThread": true,
119
+
"ProvideAnonymousTelemetry": true,
120
+
"FailedRequestLimit": 3
121
+
}
122
+
}
123
+
```
162
124
163
-
1. Snapshots are collected only on exceptions that are reported to Application Insights. You may need to modify your code to report them. The exception handling code depends on the structure of your application, but an example is below:
125
+
## Configure snapshot collection for other .NET applications
Snapshots are collected only on exceptions that are reported to Application Insights. You may need to modify your code to report them. The exception handling code depends on the structure of your application, but an example is below:
0 commit comments