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/app/asp-net-core.md
+86-89Lines changed: 86 additions & 89 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ The [Application Insights SDK for ASP.NET Core](https://nuget.org/packages/Micro
32
32
***IDE**: Visual Studio, VS Code, or command line.
33
33
34
34
> [!NOTE]
35
-
> If you are using ASP.NET Core 3.0-preview along with Application Insights, please use the [2.8.0-beta3](https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore/2.8.0-beta3) version or higher. This is the only version known to work well with ASP.NET Core 3.0. Also, Visual Studio based onboarding is not yet supported for ASP.NET Core 3.0 apps.
35
+
> If you are using ASP.NET Core 3.0 along with Application Insights, please use the [2.8.0](https://www.nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore/2.8.0) version or higher. This is the only version that supports ASP.NET Core 3.0.
36
36
37
37
## Prerequisites
38
38
@@ -113,24 +113,26 @@ The [Application Insights SDK for ASP.NET Core](https://nuget.org/packages/Micro
Typically, `APPINSIGHTS_INSTRUMENTATIONKEY` specifies the instrumentation key for applications deployed to Web Apps.
116
+
Typically, `APPINSIGHTS_INSTRUMENTATIONKEY` specifies the instrumentation key for applications deployed to Azure Web Apps.
117
117
118
118
> [!NOTE]
119
119
> An instrumentation key specified in code wins over the environment variable `APPINSIGHTS_INSTRUMENTATIONKEY`, which wins over other options.
120
120
121
121
## Run your application
122
122
123
-
Run your application and make requests to it. Telemetry should now flow to Application Insights. The Application Insights SDK automatically collects the following telemetry.
123
+
Run your application and make requests to it. Telemetry should now flow to Application Insights. The Application Insights SDK automatically collects incoming web requests to your application, along with the following telemetry as well.
124
124
125
-
|Requests/dependencies |Details|
126
-
|---------------|-------|
127
-
|Requests | Incoming web requests to your application. |
128
-
|HTTP or HTTPS | Calls made with `HttpClient`. |
129
-
|SQL | Calls made with `SqlClient`. |
130
-
|[Azure Storage](https://www.nuget.org/packages/WindowsAzure.Storage/) | Calls made with the Azure Storage client. |
131
-
|[EventHubs client SDK](https://www.nuget.org/packages/Microsoft.Azure.EventHubs) | Version 1.1.0 and later. |
132
-
|[ServiceBus client SDK](https://www.nuget.org/packages/Microsoft.Azure.ServiceBus)| Version 3.0.0 and later. |
133
-
|Azure Cosmos DB | Tracked automatically only if HTTP/HTTPS is used. Application Insights doesn't capture TCP mode. |
125
+
### Live Metrics
126
+
127
+
[Live Metrics](https://docs.microsoft.com/azure/application-insights/app-insights-live-stream) can be used to quickly verify if Application Insights is setup correctly. While it might take a few minutes before telemetry starts appearing in the portal and analytics, Live Metrics would show CPU usage of the running process in near real-time. It can also show other telemetry like Requests, Dependencies, Traces etc.
128
+
129
+
### ILogger logs
130
+
131
+
Logs emitted via `ILogger` of severity `Warning` or greater are automatically captured. Follow [ILogger docs](ilogger.md#control-logging-level) to customize which log levels are captured by Application Insights.
132
+
133
+
### Dependencies
134
+
135
+
Dependency collection is enabled by default. [This](asp-net-dependencies.md#automatically-tracked-dependencies) article explains the dependencies that are automatically collected, and also contain steps to do manual tracking.
134
136
135
137
### Performance counters
136
138
@@ -139,20 +141,12 @@ Support for [performance counters](https://azure.microsoft.com/documentation/art
139
141
* SDK versions 2.4.1 and later collect performance counters if the application is running in Azure Web Apps (Windows).
140
142
* SDK versions 2.7.1 and later collect performance counters if the application is running in Windows and targets `NETSTANDARD2.0` or later.
141
143
* For applications targeting the .NET Framework, all versions of the SDK support performance counters.
142
-
* SDK Versions 2.8.0-beta3 and later support cpu/memory counter in Linux. No other counter is supported in Linux. The recommended way to get system counters in Linux (and other non-Windows environments) is by using [EventCounters](#eventcounter)
144
+
* SDK Versions 2.8.0 and later support cpu/memory counter in Linux. No other counter is supported in Linux. The recommended way to get system counters in Linux (and other non-Windows environments) is by using [EventCounters](#eventcounter)
143
145
144
146
### EventCounter
145
147
146
148
`EventCounterCollectionModule` is enabled by default, and it will collect a default set of counters from .NET Core 3.0 apps. The [EventCounter](eventcounters.md) tutorial lists the default set of counters collected. It also has instructions on customizing the list.
147
149
148
-
### ILogger logs
149
-
150
-
Logs emitted via `ILogger` of severity `Warning` or greater are automatically captured. Follow [ILogger docs](ilogger.md#control-logging-level) to customize which log levels are captured by Application Insights.
151
-
152
-
### Live Metrics
153
-
154
-
[Live Metrics](https://docs.microsoft.com/azure/application-insights/app-insights-live-stream) can be used to quickly verify if Application Insights is setup correctly. While it might take a few minutes before telemetry starts appearing in the portal and analytics, Live Metrics would show CPU usage of the running process in near real-time. It can also show other telemetry like Requests, Dependencies, Traces etc.
155
-
156
150
## Enable client-side telemetry for web applications
157
151
158
152
The preceding steps are enough to help you start collecting server-side telemetry. If your application has client-side components, follow the next steps to start collecting [usage telemetry](https://docs.microsoft.com/azure/azure-monitor/app/usage-overview).
@@ -186,17 +180,17 @@ You can customize the Application Insights SDK for ASP.NET Core to change the de
186
180
You can modify a few common settings by passing `ApplicationInsightsServiceOptions` to `AddApplicationInsightsTelemetry`, as in this example:
187
181
188
182
```csharp
189
-
public void ConfigureServices(IServiceCollection services)
Full List of settings in `ApplicationInsightsServiceOptions`
@@ -224,49 +218,49 @@ Use [telemetry initializers](https://docs.microsoft.com/azure/azure-monitor/app/
224
218
Add any new `TelemetryInitializer` to the `DependencyInjection` container as shown in the following code. The SDK automatically picks up any `TelemetryInitializer` that's added to the `DependencyInjection` container.
Telemetry initializers are present by default. To remove all or specific telemetry initializers, use the following sample code *after* you call `AddApplicationInsightsTelemetry()`.
You can add custom telemetry processors to `TelemetryConfiguration` by using the extension method `AddApplicationInsightsTelemetryProcessor` on `IServiceCollection`. You use telemetry processors in [advanced filtering scenarios](https://docs.microsoft.com/azure/azure-monitor/app/api-filtering-sampling#filtering-itelemetryprocessor) to allow for more direct control over what's included or excluded from the telemetry you send to the Application Insights service. Use the following example.
### Configuring or removing default TelemetryModules
@@ -281,42 +275,42 @@ The following automatic-collection modules are enabled by default. These modules
281
275
*`QuickPulseTelemetryModule` - Collects telemetry for showing in Live Metrics portal.
282
276
*`AppServicesHeartbeatTelemetryModule` - Collects heart beats (which are send as custom metrics), about Azure App Service environment where application is hosted.
283
277
*`AzureInstanceMetadataTelemetryModule` - Collects heart beats (which are send as custom metrics), about Azure VM environment where application is hosted.
284
-
*`EventCounterCollectionModule` - Collects [EventCounters.](#eventcounter). This module is a new feature and is available in SDK Version 2.8.0-beta3 and higher.
278
+
*`EventCounterCollectionModule` - Collects [EventCounters.](#eventcounter). This module is a new feature and is available in SDK Version 2.8.0 and higher.
285
279
286
280
To configure any default `TelemetryModule`, use the extension method `ConfigureTelemetryModule<T>` on `IServiceCollection`, as shown in the following example.
@@ -360,7 +354,8 @@ Note that the above does not prevent any auto collection modules from collecting
360
354
### Does Application Insights support ASP.NET Core 3.0?
361
355
362
356
Yes. Update to [Application Insights SDK for ASP.NET Core](https://nuget.org/packages/Microsoft.ApplicationInsights.AspNetCore) version 2.8.0 or higher. Older versions of the SDK do not support ASP.NET Core 3.0.
363
-
Also, if you are using Visual Studio based instructions from [here](#enable-application-insights-server-side-telemetry-visual-studio), please update to the latest version of Visual Studio 2019 (16.3.0) to onboard. Previous versions of Visual Studio do not support automatic onboarding.
357
+
358
+
Also, if you are using Visual Studio based instructions from [here](#enable-application-insights-server-side-telemetry-visual-studio), please update to the latest version of Visual Studio 2019 (16.3.0) to onboard. Previous versions of Visual Studio do not support automatic onboarding for ASP.NET Core 3.0 apps.
364
359
365
360
### How can I track telemetry that's not automatically collected?
366
361
@@ -393,9 +388,7 @@ For more information about custom data reporting in Application Insights, see [A
393
388
394
389
### Some Visual Studio templates used the UseApplicationInsights() extension method on IWebHostBuilder to enable Application Insights. Is this usage still valid?
395
390
396
-
Yes, enablingApplicationInsightswiththismethodisvalid. ThistechniqueisusedinVisualStudioonboardingandintheWebAppsextensions. However, werecommendusing `services.AddApplicationInsightsTelemetry()` becauseitprovidesoverloadstocontrolsomeconfiguration. Bothmethodsdothesamethinginternally, soifyoudon'tneedtoapplycustomconfiguration, youcancalleithermethod.
### I'm deploying my ASP.NET Core application to Web Apps. Should I still enable the Application Insights extension from Web Apps?
401
394
@@ -442,6 +435,10 @@ using Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel;
442
435
}
443
436
```
444
437
438
+
### Is this SDK supported for the new .NET Core 3.0 Worker Service template applications?
439
+
440
+
This SDK requires `HttpContext`, and hence does not work in any non-httpapplications, includingthe .NETCore 3.0 WorkerServiceapplications. Referto [this](worker-service.md) documentforenablingapplicationinsightsinsuchapplications, usingthenewlyreleaseMicrosoft.ApplicationInsights.WorkerServiceSDK.
Copy file name to clipboardExpand all lines: articles/azure-monitor/app/azure-web-apps.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.author: mbullwin
13
13
---
14
14
# Monitor Azure App Service performance
15
15
16
-
Enabling monitoring on your .NET and .NET Core based web applications running on [Azure App Services](https://docs.microsoft.com/azure/app-service/) is now easier than ever. Whereas previously you needed to manually install a site extension, the latest extension/agent is now built into the app service image by default. This article will walk you through enabling Application Insights monitoring as well as provide preliminary guidance for automating the process for large-scale deployments.
16
+
Enabling monitoring on your ASP.NET and ASP.NET Core based web applications running on [Azure App Services](https://docs.microsoft.com/azure/app-service/) is now easier than ever. Whereas previously you needed to manually install a site extension, the latest extension/agent is now built into the app service image by default. This article will walk you through enabling Application Insights monitoring as well as provide preliminary guidance for automating the process for large-scale deployments.
17
17
18
18
> [!NOTE]
19
19
> Manually adding an Application Insights site extension via **Development Tools** > **Extensions** is deprecated. This method of extension installation was dependent on manual updates for each new version. The latest stable release of the extension is now [preinstalled](https://github.com/projectkudu/kudu/wiki/Azure-Site-Extensions) as part of the App Service image. The files are located in `d:\Program Files (x86)\SiteExtensions\ApplicationInsightsAgent` and are automatically updated with each stable release. If you follow the agent based instructions to enable monitoring below, it will automatically remove the deprecated extension for you.
@@ -372,4 +372,4 @@ For the latest information on the Application Insights agent/extension, check ou
372
372
*[Monitor service health metrics](../platform/data-platform.md) to make sure your service is available and responsive.
373
373
*[Receive alert notifications](../platform/alerts-overview.md) whenever operational events happen or metrics cross a threshold.
374
374
* Use [Application Insights for JavaScript apps and web pages](javascript.md) to get client telemetry from the browsers that visit a web page.
375
-
*[Set up Availability web tests](monitor-web-app-availability.md) to be alerted if your site is down.
375
+
*[Set up Availability web tests](monitor-web-app-availability.md) to be alerted if your site is down.
0 commit comments