Skip to content

Commit 99ccddc

Browse files
committed
edit pass: app-articles-batch-16
1 parent 082a0a5 commit 99ccddc

File tree

2 files changed

+80
-76
lines changed

2 files changed

+80
-76
lines changed

articles/azure-monitor/app/asp-net-core.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ Application Insights can collect the following telemetry from your ASP.NET Core
2323
2424
We'll use an [MVC application](/aspnet/core/tutorials/first-mvc-app) example. If you're using the [Worker Service](/aspnet/core/fundamentals/host/hosted-services#worker-service-template), use the instructions in [Application Insights for Worker Service applications](./worker-service.md).
2525

26-
> [!NOTE]
27-
> A preview [OpenTelemetry-based .NET offering](opentelemetry-enable.md?tabs=net) is available. For more information, see [OpenTelemetry overview](opentelemetry-overview.md).
26+
A preview [OpenTelemetry-based .NET offering](opentelemetry-enable.md?tabs=net) is available. For more information, see [OpenTelemetry overview](opentelemetry-overview.md).
2827

2928
[!INCLUDE [azure-monitor-log-analytics-rebrand](../../../includes/azure-monitor-instrumentation-key-deprecation.md)]
3029

31-
> [!NOTE]
32-
> You can also use the Microsoft.Extensions.Logging.ApplicationInsights package to capture logs. For more information, see [Application Insights logging with .NET](ilogger.md). For an example, see [Console application](ilogger.md#console-application).
30+
You can also use the Microsoft.Extensions.Logging.ApplicationInsights package to capture logs. For more information, see [Application Insights logging with .NET](ilogger.md). For an example, see [Console application](ilogger.md#console-application).
3331

3432
## Supported scenarios
3533

@@ -39,7 +37,7 @@ The [Application Insights SDK for ASP.NET Core](https://nuget.org/packages/Micro
3937
* **Hosting method**: In process or out of process
4038
* **Deployment method**: Framework dependent or self-contained
4139
* **Web server**: Internet Information Server (IIS) or Kestrel
42-
* **Hosting platform**: The Web Apps feature of Azure App Service, Azure Virtual Machines, Docker, Azure Kubernetes Service (AKS), and so on
40+
* **Hosting platform**: The Web Apps feature of Azure App Service, Azure Virtual Machines, Docker, and Azure Kubernetes Service (AKS)
4341
* **.NET Core version**: All officially [supported .NET Core versions](https://dotnet.microsoft.com/download/dotnet-core) that aren't in preview
4442
* **IDE**: Visual Studio, Visual Studio Code, or command line
4543

@@ -48,6 +46,8 @@ The [Application Insights SDK for ASP.NET Core](https://nuget.org/packages/Micro
4846
4947
## Prerequisites
5048

49+
You need:
50+
5151
- A functioning ASP.NET Core application. If you need to create an ASP.NET Core application, follow this [ASP.NET Core tutorial](/aspnet/core/getting-started/).
5252
- A valid Application Insights connection string. This string is required to send any telemetry to Application Insights. If you need to create a new Application Insights resource to get a connection string, see [Create an Application Insights resource](./create-new-resource.md).
5353

@@ -61,9 +61,9 @@ For Visual Studio for Mac, use the [manual guidance](#enable-application-insight
6161

6262
1. Select **Azure Application Insights** > **Next**.
6363

64-
1. Choose your subscription and Application Insights instance. Or you can create a new instance with **Create new**. Then select **Next**.
64+
1. Choose your subscription and Application Insights instance. Or you can create a new instance with **Create new**. Select **Next**.
6565

66-
1. Add or confirm your Application Insights connection string. It should be prepopulated based on your selection in the previous step. Then select **Finish**.
66+
1. Add or confirm your Application Insights connection string. It should be prepopulated based on your selection in the previous step. Select **Finish**.
6767

6868
1. After you add Application Insights to your project, check to confirm that you're using the latest stable release of the SDK. Go to **Project** > **Manage NuGet Packages** > **Microsoft.ApplicationInsights.AspNetCore**. If you need to, select **Update**.
6969

@@ -75,7 +75,7 @@ For Visual Studio for Mac, use the [manual guidance](#enable-application-insight
7575

7676
We recommend that you always use the latest stable version. Find full release notes for the SDK on the [open-source GitHub repo](https://github.com/Microsoft/ApplicationInsights-dotnet/releases).
7777

78-
The following code sample shows the changes to be added to your project's `.csproj` file:
78+
The following code sample shows the changes to add to your project's `.csproj` file:
7979

8080
```xml
8181
<ItemGroup>
@@ -145,7 +145,7 @@ For Visual Studio for Mac, use the [manual guidance](#enable-application-insight
145145

146146
* `SET ApplicationInsights:ConnectionString = <Copy connection string from Application Insights Resource Overview>`
147147
* `SET APPLICATIONINSIGHTS_CONNECTION_STRING = <Copy connection string from Application Insights Resource Overview>`
148-
* Typically, `APPLICATIONINSIGHTS_CONNECTION_STRING` is used in [Azure Web Apps](./azure-web-apps.md?tabs=net). It can also be used in all places where this SDK is supported.
148+
* Typically, `APPLICATIONINSIGHTS_CONNECTION_STRING` is used in [Web Apps](./azure-web-apps.md?tabs=net). It can also be used in all places where this SDK is supported.
149149

150150
> [!NOTE]
151151
> A connection string specified in code wins over the environment variable `APPLICATIONINSIGHTS_CONNECTION_STRING`, which wins over other options.
@@ -168,7 +168,7 @@ Run your application and make requests to it. Telemetry should now flow to Appli
168168

169169
### ILogger logs
170170

171-
The default configuration collects `ILogger` `Warning` logs and more severe logs. For more information, see the [How do I customize ILogger logs collection?](#how-do-i-customize-ilogger-logs-collection).
171+
The default configuration collects `ILogger` `Warning` logs and more severe logs. For more information, see [How do I customize ILogger logs collection?](#how-do-i-customize-ilogger-logs-collection).
172172

173173
### Dependencies
174174

@@ -178,7 +178,7 @@ Dependency collection is enabled by default. [Dependency tracking in Application
178178

179179
Support for [performance counters](./performance-counters.md) in ASP.NET Core is limited:
180180

181-
* SDK versions 2.4.1 and later collect performance counters if the application is running in Azure Web Apps (Windows).
181+
* SDK versions 2.4.1 and later collect performance counters if the application is running in Web Apps (Windows).
182182
* SDK versions 2.7.1 and later collect performance counters if the application is running in Windows and targets `NETSTANDARD2.0` or later.
183183
* For applications that target the .NET Framework, all versions of the SDK support performance counters.
184184
* SDK versions 2.8.0 and later support the CPU/memory counter in Linux. No other counter is supported in Linux. To get system counters in Linux and other non-Windows environments, use [EventCounters](#eventcounter).
@@ -283,16 +283,16 @@ This table has the full list of `ApplicationInsightsServiceOptions` settings:
283283
|EnableAzureInstanceMetadataTelemetryModule | Enable/Disable `AzureInstanceMetadataTelemetryModule`. | True
284284
|EnableQuickPulseMetricStream | Enable/Disable LiveMetrics feature. | True
285285
|EnableAdaptiveSampling | Enable/Disable Adaptive Sampling. | True
286-
|EnableHeartbeat | Enable/Disable the heartbeats feature, which periodically (15-min default) sends a custom metric named `HeartbeatState` with information about the runtime like .NET version and Azure environment information, if applicable. | True
287-
|AddAutoCollectedMetricExtractor | Enable/Disable the `AutoCollectedMetrics extractor`, which is a telemetry processor that sends pre-aggregated metrics about requests/dependencies before sampling takes place. | True
286+
|EnableHeartbeat | Enable/Disable the heartbeats feature. It periodically (15-min default) sends a custom metric named `HeartbeatState` with information about the runtime like .NET version and Azure environment information, if applicable. | True
287+
|AddAutoCollectedMetricExtractor | Enable/Disable the `AutoCollectedMetrics extractor`. This telemetry processor sends pre-aggregated metrics about requests/dependencies before sampling takes place. | True
288288
|RequestCollectionOptions.TrackExceptions | Enable/Disable reporting of unhandled exception tracking by the request collection module. | False in NETSTANDARD2.0 (because exceptions are tracked with `ApplicationInsightsLoggerProvider`). True otherwise.
289289
|EnableDiagnosticsTelemetryModule | Enable/Disable `DiagnosticsTelemetryModule`. Disabling will cause the following settings to be ignored: `EnableHeartbeat`, `EnableAzureInstanceMetadataTelemetryModule`, and `EnableAppServicesHeartbeatTelemetryModule`. | True
290290

291291
For the most current list, see the [configurable settings in `ApplicationInsightsServiceOptions`](https://github.com/microsoft/ApplicationInsights-dotnet/blob/develop/NETCORE/src/Shared/Extensions/ApplicationInsightsServiceOptions.cs).
292292

293293
### Configuration recommendation for Microsoft.ApplicationInsights.AspNetCore SDK 2.15.0 and later
294294

295-
In `Microsoft.ApplicationInsights.AspNetCore` SDK version [2.15.0](https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore/2.15.0) and later, we recommend configuring every setting available in `ApplicationInsightsServiceOptions`, including **ConnectionString** by using the application's `IConfiguration` instance. The settings must be under the section "ApplicationInsights", as shown in the following example. The following section from *appsettings.json* configures the connection string and disables adaptive sampling and performance counter collection.
295+
In Microsoft.ApplicationInsights.AspNetCore SDK version [2.15.0](https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore/2.15.0) and later, configure every setting available in `ApplicationInsightsServiceOptions`, including `ConnectionString`. Use the application's `IConfiguration` instance. The settings must be under the section `ApplicationInsights`, as shown in the following example. The following section from *appsettings.json* configures the connection string and disables adaptive sampling and performance counter collection.
296296

297297
```json
298298
{
@@ -329,7 +329,7 @@ var app = builder.Build();
329329
```
330330

331331
> [!NOTE]
332-
> `builder.Services.AddSingleton<ITelemetryInitializer, MyCustomTelemetryInitializer>();` works for simple initializers. For others, the following is required: `builder.Services.AddSingleton(new MyCustomTelemetryInitializer() { fieldName = "myfieldName" });`
332+
> `builder.Services.AddSingleton<ITelemetryInitializer, MyCustomTelemetryInitializer>();` works for simple initializers. For others, `builder.Services.AddSingleton(new MyCustomTelemetryInitializer() { fieldName = "myfieldName" });` is required.
333333
334334
### [ASP.NET Core 5 and earlier](#tab/netcoreold)
335335

@@ -341,7 +341,7 @@ public void ConfigureServices(IServiceCollection services)
341341
```
342342

343343
> [!NOTE]
344-
> `services.AddSingleton<ITelemetryInitializer, MyCustomTelemetryInitializer>();` works for simple initializers. For others, the following is required: `services.AddSingleton(new MyCustomTelemetryInitializer() { fieldName = "myfieldName" });`
344+
> `services.AddSingleton<ITelemetryInitializer, MyCustomTelemetryInitializer>();` works for simple initializers. For others, `services.AddSingleton(new MyCustomTelemetryInitializer() { fieldName = "myfieldName" });` is required.
345345
346346
---
347347

@@ -396,7 +396,7 @@ public void ConfigureServices(IServiceCollection services)
396396

397397
### Add telemetry processors
398398

399-
You can add custom telemetry processors to `TelemetryConfiguration` by using the extension method `AddApplicationInsightsTelemetryProcessor` on `IServiceCollection`. You use telemetry processors in [advanced filtering scenarios](./api-filtering-sampling.md#itelemetryprocessor-and-itelemetryinitializer). Use the following example.
399+
You can add custom telemetry processors to `TelemetryConfiguration` by using the extension method `AddApplicationInsightsTelemetryProcessor` on `IServiceCollection`. You use telemetry processors in [advanced filtering scenarios](./api-filtering-sampling.md#itelemetryprocessor-and-itelemetryinitializer). Use the following example:
400400

401401
### [ASP.NET Core 6 and later](#tab/netcorenew)
402402

@@ -438,12 +438,12 @@ By default, the following automatic-collection modules are enabled. These module
438438
* `RequestTrackingTelemetryModule`: Collects RequestTelemetry from incoming web requests.
439439
* `DependencyTrackingTelemetryModule`: Collects [DependencyTelemetry](./asp-net-dependencies.md) from outgoing HTTP calls and SQL calls.
440440
* `PerformanceCollectorModule`: Collects Windows PerformanceCounters.
441-
* `QuickPulseTelemetryModule`: Collects telemetry for showing in Live Metrics portal.
442-
* `AppServicesHeartbeatTelemetryModule`: Collects heartbeats (which are sent as custom metrics), about the Azure App Service environment where the application is hosted.
441+
* `QuickPulseTelemetryModule`: Collects telemetry to show in the Live Metrics portal.
442+
* `AppServicesHeartbeatTelemetryModule`: Collects heartbeats (which are sent as custom metrics), about the App Service environment where the application is hosted.
443443
* `AzureInstanceMetadataTelemetryModule`: Collects heartbeats (which are sent as custom metrics), about the Azure VM environment where the application is hosted.
444444
* `EventCounterCollectionModule`: Collects [EventCounters](eventcounters.md). This module is a new feature and is available in SDK version 2.8.0 and later.
445445

446-
To configure any default `TelemetryModule`, use the extension method `ConfigureTelemetryModule<T>` on `IServiceCollection`, as shown in the following example.
446+
To configure any default `TelemetryModule`, use the extension method `ConfigureTelemetryModule<T>` on `IServiceCollection`, as shown in the following example:
447447

448448
### [ASP.NET Core 6 and later](#tab/netcorenew)
449449

@@ -556,7 +556,7 @@ public void ConfigureServices(IServiceCollection services)
556556
---
557557

558558
> [!NOTE]
559-
> If you want to flush the buffer, see [Flushing data](api-custom-events-metrics.md#flushing-data). For example, if you're using the SDK in an application that shuts down.
559+
> If you want to flush the buffer, see [Flushing data](api-custom-events-metrics.md#flushing-data). For example, you might need to flush the buffer if you're using the SDK in an application that shuts down.
560560
561561
### Disable telemetry dynamically
562562

@@ -738,7 +738,7 @@ This limitation isn't applicable from version [2.15.0](https://www.nuget.org/pac
738738
739739
### Is this SDK supported for the new .NET Core 3.X Worker Service template applications?
740740

741-
This SDK requires `HttpContext`. Therefore, it doesn't work in any non-HTTP applications, including the .NET Core 3.X Worker Service applications. To enable Application Insights in such applications by using the newly released Microsoft.ApplicationInsights.WorkerService SDK, see [Application Insights for Worker Service applications (non-HTTP applications)](worker-service.md).
741+
This SDK requires `HttpContext`. It doesn't work in any non-HTTP applications, including the .NET Core 3.X Worker Service applications. To enable Application Insights in such applications by using the newly released Microsoft.ApplicationInsights.WorkerService SDK, see [Application Insights for Worker Service applications (non-HTTP applications)](worker-service.md).
742742

743743
## Troubleshooting
744744

@@ -756,4 +756,4 @@ For the latest updates and bug fixes, see the [release notes](./release-notes.md
756756
* [Configure a snapshot collection](./snapshot-debugger.md) to see the state of source code and variables at the moment an exception is thrown.
757757
* [Use the API](./api-custom-events-metrics.md) to send your own events and metrics for a detailed view of your app's performance and usage.
758758
* Use [availability tests](./monitor-web-app-availability.md) to check your app constantly from around the world.
759-
* [Dependency injection in ASP.NET Core](/aspnet/core/fundamentals/dependency-injection).
759+
* Learn about [dependency injection in ASP.NET Core](/aspnet/core/fundamentals/dependency-injection).

0 commit comments

Comments
 (0)