Skip to content

Commit ba6e95e

Browse files
committed
initial pass
1 parent ba4e5e8 commit ba6e95e

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

articles/azure-monitor/profiler/profiler-trackrequests.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@ title: Write code to track requests with Azure Application Insights | Microsoft
33
description: Write code to track requests with Application Insights so you can get profiles for your requests.
44
ms.topic: conceptual
55
ms.custom: devx-track-csharp
6-
ms.date: 08/06/2018
7-
ms.reviewer: jogrima
6+
ms.date: 08/09/2022
7+
ms.reviewer: charles.weininger
88
---
99

1010
# Write code to track requests with Application Insights
1111

12-
To view profiles for your application on the Performance page, Azure Application Insights needs to track requests for your application. Application Insights can automatically track requests for applications that are built on already-instrumented frameworks. Two examples are ASP.NET and ASP.NET Core.
12+
To view profiles for your application on the Performance page, Azure Application Insights needs to track requests for your application.
1313

14-
For other applications, such as Azure Cloud Services worker roles and Service Fabric stateless APIs, you need to write code to tell Application Insights where your requests begin and end. After you've written this code, requests telemetry is sent to Application Insights. You can view the telemetry on the Performance page, and profiles are collected for those requests.
14+
For applications built on already-instrumented frameworks, like ASP.NET and ASP.NET Core, Application Insights can automatically track requests.
1515

16-
[!INCLUDE [azure-monitor-log-analytics-rebrand](../../../includes/azure-monitor-instrumentation-key-deprecation.md)]
16+
For other applications, such as Azure Cloud Services worker roles and Service Fabric stateless APIs:
17+
18+
1. You need to write code to tell Application Insights where your requests begin and end.
19+
1. Requests telemetry is sent to Application Insights, which you can view on the Performance page.
20+
1. Profiles are collected for those requests.
1721

18-
To manually track requests, do the following:
22+
To manually track requests:
1923

2024
1. Early in the application lifetime, add the following code:
2125

@@ -25,6 +29,7 @@ To manually track requests, do the following:
2529
// Replace with your own Application Insights instrumentation key.
2630
TelemetryConfiguration.Active.InstrumentationKey = "00000000-0000-0000-0000-000000000000";
2731
```
32+
2833
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).
2934

3035
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:
@@ -41,7 +46,7 @@ To manually track requests, do the following:
4146
}
4247
```
4348

44-
Calling `StartOperation<RequestTelemetry>` within another `StartOperation<RequestTelemetry>` scope isn't supported. You can use `StartOperation<DependencyTelemetry>` in the nested scope instead. For example:
49+
Calling `StartOperation<RequestTelemetry>` within another `StartOperation<RequestTelemetry>` scope isn't supported. You can use `StartOperation<DependencyTelemetry>` in the nested scope instead. For example:
4550

4651
```csharp
4752
using (var getDetailsOperation = client.StartOperation<RequestTelemetry>("GetProductDetails"))
@@ -81,3 +86,9 @@ To manually track requests, do the following:
8186
}
8287
}
8388
```
89+
90+
[!INCLUDE [azure-monitor-log-analytics-rebrand](../../../includes/azure-monitor-instrumentation-key-deprecation.md)]
91+
92+
## Next steps
93+
94+
Troubleshoot the [Application Insights Profiler](./profiler-troubleshooting.md).

0 commit comments

Comments
 (0)