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-trackrequests.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: Write code to track requests with Azure Application Insights | Microsoft Docs
2
+
title: Write code to track requests with Application Insights | Microsoft Docs
3
3
description: Write code to track requests with Application Insights so you can get profiles for your requests.
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-csharp
@@ -9,15 +9,15 @@ ms.reviewer: charles.weininger
9
9
10
10
# Write code to track requests with Application Insights
11
11
12
-
Azure Application Insights needs to track requests for your application in order to provide profiles for your application on the Performance page in the Azure portal.
12
+
Application Insights needs to track requests for your application to provide profiles for your application on the **Performance** page in the Azure portal.
13
13
14
-
For applications built on already-instrumented frameworks (like ASP.NET and ASP.NET Core)S, Application Insights can automatically track requests.
14
+
For applications built on already-instrumented frameworks (like ASP.NET and ASP.NET Core), Application Insights can automatically track requests.
15
15
16
-
But for other applications (like Azure Cloud Services worker roles and Service Fabric stateless APIs), you need to track requests with code that tells Application Insights where your requests begin and end. Requests telemetry is then sent to Application Insights, which you can view on the Performance page. Profiles are collected for those requests.
16
+
For other applications (like Azure Cloud Services worker roles and Azure Service Fabric stateless APIs), you need to track requests with code that tells Application Insights where your requests begin and end. Requests telemetry is then sent to Application Insights, which you can view on the **Performance** page. Profiles are collected for those requests.
17
17
18
18
To manually track requests:
19
19
20
-
1. Early in the application lifetime, add the following code:
20
+
1. Early in the application lifetime, add the following code:
21
21
22
22
```csharp
23
23
using Microsoft.ApplicationInsights.Extensibility;
For more information about this global instrumentation key configuration, see [Use Service Fabric with Application Insights](https://github.com/Azure-Samples/service-fabric-dotnet-getting-started/blob/dev/appinsights/ApplicationInsights.md).
29
+
For more information about this global instrumentation key configuration, see [Use Service Fabric with Application Insights](https://github.com/Azure-Samples/service-fabric-dotnet-getting-started/blob/dev/appinsights/ApplicationInsights.md).
30
30
31
31
1. For any piece of code that you want to instrument, add a `StartOperation<RequestTelemetry>`**using** statement around it, as shown in the following example:
32
32
@@ -42,7 +42,7 @@ To manually track requests:
42
42
}
43
43
```
44
44
45
-
Calling `StartOperation<RequestTelemetry>` within another `StartOperation<RequestTelemetry>` scope isn't supported. You can use `StartOperation<DependencyTelemetry>` in the nested scope instead. For example:
45
+
Calling `StartOperation<RequestTelemetry>` within another `StartOperation<RequestTelemetry>` scope isn't supported. You can use `StartOperation<DependencyTelemetry>` in the nested scope instead. For example:
46
46
47
47
```csharp
48
48
using (var getDetailsOperation = client.StartOperation<RequestTelemetry>("GetProductDetails"))
Copy file name to clipboardExpand all lines: articles/azure-monitor/profiler/profiler.md
+36-37Lines changed: 36 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,130 +8,129 @@ ms.reviewer: jogrima
8
8
9
9
# Enable Profiler for Azure App Service apps
10
10
11
-
Application Insights Profiler is pre-installed as part of the App Services runtime. You can run Profiler on ASP.NET and ASP.NET Core apps running on Azure App Service using Basic service tier or higher. Follow these steps even if you've included the App Insights SDK in your application at build time.
11
+
Application Insights Profiler is preinstalled as part of the Azure App Service runtime. You can run Profiler on ASP.NET and ASP.NET Core apps running on App Service by using the Basic service tier or higher. Follow these steps even if you've included the Application Insights SDK in your application at build time.
12
12
13
13
To enable Profiler on Linux, walk through the [ASP.NET Core Azure Linux web apps instructions](profiler-aspnetcore-linux.md).
14
14
15
15
> [!NOTE]
16
16
> Codeless installation of Application Insights Profiler follows the .NET Core support policy.
17
17
> For more information about supported runtime, see [.NET Core Support Policy](https://dotnet.microsoft.com/platform/support/policy/dotnet-core).
18
18
19
-
20
19
## Prerequisites
21
20
22
-
- An [Azure App Services ASP.NET/ASP.NET Core app](../../app-service/quickstart-dotnetcore.md).
23
-
-[Application Insights resource](/previous-versions/azure/azure-monitor/app/create-new-resource) connected to your App Service app.
21
+
- An [Azure App Service ASP.NET/ASP.NET Core app](../../app-service/quickstart-dotnetcore.md).
22
+
-[Application Insights resource](/previous-versions/azure/azure-monitor/app/create-new-resource) connected to your App Service app.
24
23
25
24
## Verify "Always On" setting is enabled
26
25
27
-
1. In the Azure portal, navigate to your App Service.
28
-
1. Under **Settings**in the left side menu, select **Configuration**.
26
+
1. In the Azure portal, go to your App Service.
27
+
1. Under **Settings**on the left side menu, select **Configuration**.
29
28
30
-
:::image type="content" source="./media/profiler/configuration-menu.png" alt-text="Screenshot of selecting Configuration from the left side menu.":::
29
+
:::image type="content" source="./media/profiler/configuration-menu.png" alt-text="Screenshot that shows selecting Configuration from the left side menu.":::
31
30
32
31
1. Select the **General settings** tab.
33
-
1. Verify **Always On** > **On** is selected.
32
+
1. Verify that **Always On** > **On** is selected.
34
33
35
-
:::image type="content" source="./media/profiler/always-on.png" alt-text="Screenshot of the General tab on the Configuration pane and showing the Always On being enabled.":::
34
+
:::image type="content" source="./media/profiler/always-on.png" alt-text="Screenshot that shows the General tab on the Configuration pane showing that Always On is enabled.":::
36
35
37
-
1. Select **Save** if you've made changes.
36
+
1. Select **Save** if you made changes.
38
37
39
38
## Enable Application Insights and Profiler
40
39
41
40
### For Application Insights and App Service in the same subscription
42
41
43
42
If your Application Insights resource is in the same subscription as your App Service:
44
43
45
-
1. Under **Settings**in the left side menu, select **Application Insights**.
44
+
1. Under **Settings**on the left side menu, select **Application Insights**.
46
45
47
-
:::image type="content" source="./media/profiler/app-insights-menu.png" alt-text="Screenshot of selecting Application Insights from the left side menu.":::
46
+
:::image type="content" source="./media/profiler/app-insights-menu.png" alt-text="Screenshot that shows selecting Application Insights from the left side menu.":::
48
47
49
48
1. Under **Application Insights**, select **Enable**.
50
-
1. Verify you've connected an Application Insights resource to your app.
49
+
1. Verify that you connected an Application Insights resource to your app.
51
50
52
-
:::image type="content" source="./media/profiler/enable-app-insights.png" alt-text="Screenshot of enabling App Insights on your app.":::
51
+
:::image type="content" source="./media/profiler/enable-app-insights.png" alt-text="Screenshot that shows enabling Application Insights on your app.":::
53
52
54
53
1. Scroll down and select the **.NET** or **.NET Core** tab, depending on your app.
55
-
1. Verify **Collection Level** > **Recommended** is selected.
56
-
1. Under **Profiler**, select **On**.
57
-
- If you chose the **Basic** collection level earlier, the Profiler setting is disabled.
58
-
1. Select **Apply**, then**Yes** to confirm.
54
+
1. Verify that **Collection Level** > **Recommended** is selected.
55
+
1. Under **Profiler**, select **On**.
56
+
- If you chose the **Basic** collection level earlier, the Profiler setting is disabled.
57
+
1. Select **Apply** >**Yes** to confirm.
59
58
60
-
:::image type="content" source="./media/profiler/enable-profiler.png" alt-text="Screenshot of enabling Profiler on your app.":::
59
+
:::image type="content" source="./media/profiler/enable-profiler.png" alt-text="Screenshot that shows enabling Profiler on your app.":::
61
60
62
61
### For Application Insights and App Service in different subscriptions
63
62
64
-
If your Application Insights resource is in a different subscription from your App Service, you'll need to enable Profiler manually by creating app settings for your Azure App Service. You can automate the creation of these settings using a template or other means. The settings needed to enable the Profiler:
63
+
If your Application Insights resource is in a different subscription from your App Service, you need to enable Profiler manually by creating app settings for your App Service. You can automate the creation of these settings by using a template or other means. The settings needed to enable the Profiler:
65
64
66
-
|App Setting| Value |
65
+
|App setting| Value |
67
66
|---------------|----------|
68
67
|APPINSIGHTS_INSTRUMENTATIONKEY | iKey for your Application Insights resource |
Currently the only regions that require endpoint modifications are [Azure Government](../../azure-government/compare-azure-government-global-azure.md#application-insights) and [Azure China](/azure/china/resources-developer-guide).
78
+
Currently, the only regions that require endpoint modifications are [Azure Government](../../azure-government/compare-azure-government-global-azure.md#application-insights) and [Azure China](/azure/china/resources-developer-guide).
## Enable Azure Active Directory authentication for profile ingestion
87
86
88
-
Application Insights Profiler supports Azure AD authentication for profiles ingestion. For all profiles of your application to be ingested, your application must be authenticated and provide the required application settings to the Profiler agent.
87
+
Application Insights Profiler supports Azure Active Directory (Azure AD) authentication for profiles ingestion. For all profiles of your application to be ingested, your application must be authenticated and provide the required application settings to the Profiler agent.
89
88
90
89
Profiler only supports Azure AD authentication when you reference and configure Azure AD using the [Application Insights SDK](../app/asp-net-core.md#configure-the-application-insights-sdk) in your application.
91
90
92
91
To enable Azure AD for profiles ingestion:
93
92
94
93
1. Create and add the managed identity to authenticate against your Application Insights resource to your App Service.
95
94
96
-
a. [System-Assigned Managed identity documentation](../../app-service/overview-managed-identity.md?tabs=portal%2chttp#add-a-system-assigned-identity)
1.[Configure and enable Azure AD](../app/azure-ad-authentication.md?tabs=net#configure-and-enable-azure-ad-based-authentication) in your Application Insights resource.
101
100
102
101
1. Add the following application setting to let the Profiler agent know which managed identity to use:
| APPLICATIONINSIGHTS_AUTHENTICATION_STRING |`Authorization=AAD;ClientId={Client id of the User-Assigned Identity}`|
115
114
116
115
## Disable Profiler
117
116
118
117
To stop or restart Profiler for an individual app's instance:
119
118
120
-
1. Under **Settings**in the left side menu, select **WebJobs**.
119
+
1. Under **Settings**on the left side menu, select **WebJobs**.
121
120
122
-
:::image type="content" source="./media/profiler/web-jobs-menu.png" alt-text="Screenshot of selecting web jobs from the left side menu.":::
121
+
:::image type="content" source="./media/profiler/web-jobs-menu.png" alt-text="Screenshot that shows selecting web jobs from the left side menu.":::
123
122
124
123
1. Select the webjob named `ApplicationInsightsProfiler3`.
125
124
126
-
1.Click**Stop**from the top menu.
125
+
1.Select**Stop**on the top menu.
127
126
128
-
:::image type="content" source="./media/profiler/stop-web-job.png" alt-text="Screenshot of selecting stop for stopping the webjob.":::
127
+
:::image type="content" source="./media/profiler/stop-web-job.png" alt-text="Screenshot that shows selecting stop for stopping the webjob.":::
129
128
130
129
1. Select **Yes** to confirm.
131
130
132
131
We recommend that you have Profiler enabled on all your apps to discover any performance issues as early as possible.
133
132
134
-
Profiler's files can be deleted when using WebDeploy to deploy changes to your web application. You can prevent the deletion by excluding the App_Data folder from being deleted during deployment.
133
+
You can delete Profiler's files when you use WebDeploy to deploy changes to your web application. You can prevent the deletion by excluding the *App_Data* folder from being deleted during deployment.
0 commit comments