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
For more information about `ILogger`, see [Logging in C# and .NET](/dotnet/core/extensions/logging) and [code examples](https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/logs).
40
40
41
41
#### [.NET](#tab/net)
@@ -188,7 +188,6 @@ Instrumentations can be configured using AzureMonitorOpenTelemetryOptions
Copy file name to clipboardExpand all lines: articles/azure-monitor/app/opentelemetry-configuration.md
+24-13Lines changed: 24 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,6 @@ ms.reviewer: mmcc
13
13
14
14
This article covers configuration settings for the Azure Monitor OpenTelemetry distro.
15
15
16
-
17
16
## Connection string
18
17
19
18
A connection string in Application Insights defines the target location for sending telemetry data, ensuring it reaches the appropriate resource for monitoring and analysis.
@@ -22,7 +21,8 @@ A connection string in Application Insights defines the target location for send
22
21
23
22
Use one of the following three ways to configure the connection string:
24
23
25
-
- Add `UseAzureMonitor()` to your application startup. Depending on your version of .NET, it is in either your `startup.cs` or `program.cs` class.
24
+
- Add `UseAzureMonitor()` to your application startup. This is in your `program.cs` class.
25
+
26
26
```csharp
27
27
// Create a new ASP.NET Core web application builder.
28
28
varbuilder=WebApplication.CreateBuilder(args);
@@ -39,11 +39,15 @@ Use one of the following three ways to configure the connection string:
SettheCloudRoleNameandtheCloudRoleInstancevia [Resource](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/sdk.md#resource-sdk) attributes. Cloud Role Name uses `service.namespace` and `service.name` attributes, although it falls back to `service.name` if `service.namespace` isn't set. Cloud Role Instance uses the `service.instance.id` attribute value. For information on standard attributes for resources, see [OpenTelemetry Semantic Conventions](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/README.md).
Ifyoudon't set the `service.namespace` Resource attribute, you can alternatively set the Cloud Role Name with only the OTEL_SERVICE_NAME environment variable or the `service.name` Resource attribute. For example, to set the Cloud Role Name to `my-helloworld-service` and set Cloud Role Instance to `my-instance`, you can set `OTEL_RESOURCE_ATTRIBUTES` and `OTEL_SERVICE_NAME` as such:
Youmightwanttoenablesamplingtoreduceyourdataingestionvolume, whichreducesyourcost. AzureMonitorprovidesacustom*fixed-rate*samplerthatpopulateseventswithasamplingratio, whichApplicationInsightsconvertsto `ItemCount`. The*fixed-rate*samplerensuresaccurateexperiencesandeventcounts. Thesamplerisdesignedtopreserveyourtracesacrossservices, andit's interoperable with older Application Insights SDKs. For more information, see [Learn More about sampling](sampling.md#brief-summary).
298
306
299
-
> [!NOTE]
307
+
> [!NOTE]
300
308
>MetricsandLogsareunaffectedbysampling.
301
309
302
310
#### [ASP.NET Core](#tab/aspnetcore)
@@ -393,11 +401,13 @@ We support the credential classes provided by [Azure Identity](https://github.co
Copy file name to clipboardExpand all lines: articles/azure-monitor/app/opentelemetry-enable.md
+13-5Lines changed: 13 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ Follow the steps in this section to instrument your application with OpenTelemet
33
33
34
34
### [ASP.NET Core](#tab/aspnetcore)
35
35
36
-
-[ASP.NET Core Application](/aspnet/core/introduction-to-aspnet-core) using an officially supported version of [.NET Core](https://dotnet.microsoft.com/download/dotnet)
36
+
-[ASP.NET Core Application](/aspnet/core/introduction-to-aspnet-core) using an officially supported version of [.NET](https://dotnet.microsoft.com/download/dotnet)
To enable Azure Monitor Application Insights, you make a minor modification to your application and set your "Connection String." The Connection String tells your application where to send the telemetry the Distro collects, and it's unique to you.
132
133
133
134
#### Modify your Application
134
135
135
136
##### [ASP.NET Core](#tab/aspnetcore)
136
137
137
-
Add `UseAzureMonitor()` to your application startup. Depending on your version of .NET, it is in either your`startup.cs` or`program.cs` class.
138
+
Add `UseAzureMonitor()` to your application startup. This is in your `program.cs` class.
138
139
139
140
```csharp
140
141
// Import the Azure.Monitor.OpenTelemetry.AspNetCore namespace.
@@ -143,7 +144,7 @@ using Azure.Monitor.OpenTelemetry.AspNetCore;
143
144
// Create a new WebApplicationBuilder instance.
144
145
varbuilder=WebApplication.CreateBuilder(args);
145
146
146
-
// Add the OpenTelemetry NuGet package to the application's services and configure OpenTelemetry to use Azure Monitor.
147
+
// Add OpenTelemetry and configure it to use Azure Monitor.
Add the Azure Monitor Exporter to each OpenTelemetry signal in application startup. Depending on your version of .NET, it is in either your `startup.cs` or `program.cs` class.
160
+
159
161
```csharp
160
162
// Create a new tracer provider builder and add an Azure Monitor trace exporter to the tracer provider builder.
161
163
// It is important to keep the TracerProvider instance active throughout the process lifetime.
164
+
// See https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/trace#tracerprovider-management
// It is important to keep the LoggerFactory instance active throughout the process lifetime.
176
+
// See https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/logs#logger-management
172
177
varloggerFactory=LoggerFactory.Create(builder=>
173
178
{
174
179
builder.AddOpenTelemetry(options=>
@@ -237,6 +242,7 @@ input()
237
242
---
238
243
239
244
#### Copy the Connection String from your Application Insights Resource
245
+
240
246
> [!TIP]
241
247
> If you don't already have one, now is a great time to [Create an Application Insights Resource](create-workspace-resource.md#create-a-workspace-based-resource). Here's when we recommend you [create a new Application Insights Resource versus use an existing one](create-workspace-resource.md#when-to-use-a-single-application-insights-resource).
242
248
@@ -263,20 +269,22 @@ To paste your Connection String, select from the following options:
263
269
B. Set via Configuration File - Java Only (Recommended)
264
270
265
271
Create a configuration file named `applicationinsights.json`, and place it in the same directory as `applicationinsights-agent-3.4.19.jar` with the following content:
266
-
272
+
267
273
```json
268
274
{
269
275
"connectionString": "<Your Connection String>"
270
276
}
271
277
```
278
+
272
279
Replace `<Your Connection String>` in the preceding JSON with *your* unique connection string.
273
280
274
281
C. Set via Code - ASP.NET Core, Node.js, and Python Only (Not recommended)
275
282
276
283
See [Connection String Configuration](opentelemetry-configuration.md#connection-string) for an example of setting Connection String via code.
277
284
278
285
> [!NOTE]
279
-
> If you set the connection string in more than one place, we adhere to the following precendence:
286
+
> If you set the connection string in more than one place, we adhere to the following precedence:
Copy file name to clipboardExpand all lines: articles/azure-monitor/includes/azure-monitor-app-insights-opentelemetry-faqs.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,24 +17,25 @@ It's a new open-source standard for observability. Learn more at [OpenTelemetry]
17
17
### Why is Microsoft Azure Monitor investing in OpenTelemetry?
18
18
19
19
Microsoft is among the largest contributors to OpenTelemetry.
20
-
20
+
21
21
The key value propositions of OpenTelemetry are that it's vendor-neutral and provides consistent APIs/SDKs across languages.
22
-
22
+
23
23
Over time, we believe OpenTelemetry will enable Azure Monitor customers to observe applications written in languages beyond our [supported languages](../app/app-insights-overview.md#supported-languages). It also expands the types of data you can collect through a rich set of [instrumentation libraries](https://opentelemetry.io/docs/concepts/components/#instrumentation-libraries). Furthermore, OpenTelemetry SDKs tend to be more performant at scale than their predecessors, the Application Insights SDKs.
24
24
25
25
Finally, OpenTelemetry aligns with Microsoft's strategy to [embrace open source](https://opensource.microsoft.com/).
26
26
27
27
### What's the status of OpenTelemetry?
28
28
29
-
See the [OpenTelemetry Spec Compliance Matrix](https://github.com/open-telemetry/opentelemetry-specification/blob/main/spec-compliance-matrix.md).
29
+
See [OpenTelemetry Status](https://opentelemetry.io/status/).
30
30
31
31
### What is the "Azure Monitor OpenTelemetry Distro"?
32
32
33
-
You can think of it as a thin wrapper that bundles together all the OpenTelemetry components for a first class experience on Azure.
33
+
You can think of it as a thin wrapper that bundles together all the OpenTelemetry components for a first class experience on Azure. This is also called [Distribution](https://opentelemetry.io/docs/concepts/distributions/) in OpenTelemetry.
34
34
35
35
### Why should I use the "Azure Monitor OpenTelemetry Distro"?
36
36
37
37
There are several advantages to using the Azure Monitor OpenTelemetry Distro over native OpenTelemetry from the community:
38
+
38
39
- Reduces enablement effort
39
40
- Supported by Microsoft
40
41
- Brings in Azure Specific features such as:
@@ -45,8 +46,9 @@ There are several advantages to using the Azure Monitor OpenTelemetry Distro ove
45
46
-[Application Insights Standard Metrics](../app/standard-metrics.md)
46
47
- Detect resource metadata to autopopulate [Cloud Role Name](../app/app-map.md#understand-the-cloud-role-name-within-the-context-of-an-application-map) on Azure
47
48
-[Live Metrics](../app/live-stream.md) (future)
48
-
49
+
49
50
In the spirit of OpenTelemetry, we designed the distro to be open and extensible. For example, you can add:
51
+
50
52
- An OTLP exporter and send to a second destination simultaneously
51
53
- Other instrumentation libraries not included in the distro
52
54
@@ -62,9 +64,9 @@ Adopting OpenTelemetry now prevents having to migrate at a later date.
62
64
63
65
### When should I use the Azure Monitor OpenTelemetry exporter?
64
66
65
-
For ASP..NET Core, Java, Node.js, and Python, we recommend using the OpenTelemetry distro. It's one line of code to get started.
67
+
For ASP.NET Core, Java, Node.js, and Python, we recommend using the OpenTelemetry distro. It's one line of code to get started.
66
68
67
-
For all other .NET scenarios, we recommend using our exporter: `Azure.Monitor.OpenTelemetry.Exporter`.
69
+
For all other .NET scenarios (like classic ASP.NET, Console apps etc.), we recommend using our exporter: `Azure.Monitor.OpenTelemetry.Exporter`.
68
70
69
71
### What's the current release state of features within the Azure Monitor OpenTelemetry Distro?
0 commit comments