From 37a4854781fcf1f3fc4900af9439b70d373d009e Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Thu, 13 Jul 2023 15:50:13 -0700 Subject: [PATCH 1/4] update readme to include Azure SDK support --- .../README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/README.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/README.md index ba0f1c0e1661c..96155e20bb0d2 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/README.md +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/README.md @@ -180,6 +180,24 @@ builder.Services.AddOpenTelemetry().UseAzureMonitor(); builder.Services.ConfigureOpenTelemetryTracerProvider((sp, builder) => builder.AddGrpcClientInstrumentation()); ``` +#### Enable Azure SDK Instrumentation + +Azure SDK instrumentation is supported under the experimental feature flag which can be enabled using one of the following ways: + +* Set the `AZURE_EXPERIMENTAL_ENABLE_ACTIVITY_SOURCE` environment variable to `true`. + +* Set the Azure.Experimental.EnableActivitySource context switch to true in your app’s code: + ```csharp + AppContext.SetSwitch("Azure.Experimental.EnableActivitySource", true); + ``` + +* Add the RuntimeHostConfigurationOption setting to your project file: + ```csharp + + + + ``` + #### Adding Another Exporter Azure Monitor Distro uses the Azure Monitor exporter to send data to Application Insights. However, if you need to send data to other services, including Application Insights, you can add another exporter. For example, to add the Console exporter, you can install the [OpenTelemetry.Exporter.Console](https://www.nuget.org/packages/OpenTelemetry.Exporter.Console) package and use the following code: @@ -206,7 +224,6 @@ environmental variables: | `OTEL_RESOURCE_ATTRIBUTES` | Key-value pairs to be used as resource attributes. See the [Resource SDK specification](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.5.0/specification/resource/sdk.md#specifying-resource-information-via-an-environment-variable) for more details. | | `OTEL_SERVICE_NAME` | Sets the value of the `service.name` resource attribute. If `service.name` is also provided in `OTEL_RESOURCE_ATTRIBUTES`, then `OTEL_SERVICE_NAME` takes precedence. | - ## Key concepts The Azure Monitor Distro is a distribution package which enables users to send telemetry data to Azure Monitor. It includes the .NET OpenTelemetry SDK and instrumentation libraries for [ASP.NET Core](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.AspNetCore/), [HttpClient](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.Http/), and [SQLClient](https://www.nuget.org/packages/OpenTelemetry.Instrumentation.SqlClient). From 2f20fa84ba2d7c3b4272b7c9a43800da6b731b52 Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Thu, 13 Jul 2023 15:57:54 -0700 Subject: [PATCH 2/4] changelog --- .../Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md index eb881e8995899..62a0b166b18e8 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md @@ -4,11 +4,10 @@ ### Features Added -* Added Azure.* activity sources. - Users will need to enable the collection by turning on the feature by following one of the ways listed in - [Introducing experimental OpenTelemetry support in the Azure SDK for .NET](https://devblogs.microsoft.com/azure-sdk/introducing-experimental-opentelemetry-support-in-the-azure-sdk-for-net/). +* Added instrumentation support for Azure SDKs. + See [Enable Azure SDK Instrumentation](README.md####Enable-Azure-SDK-Instrumentation) for details. ([#37505](https://github.com/Azure/azure-sdk-for-net/pull/37505)) -* Added `SamplingRatio` property to customize the sampling rate in Azure Monitor Exporter. +* Added `SamplingRatio` property to customize the sampling rate in Azure Monitor Exporter. **Note**: This package no longer takes dependency on [OpenTelemetry.Extensions.AzureMonitor](https://www.nuget.org/packages/OpenTelemetry.Extensions.AzureMonitor) ([#36972](https://github.com/Azure/azure-sdk-for-net/pull/36972)) ### Other Changes From b92369a6bf18e993d3b1adb9882899e9720daeb3 Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Thu, 13 Jul 2023 17:42:07 -0700 Subject: [PATCH 3/4] fix md error --- sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md index 62a0b166b18e8..0f6b63c211386 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md @@ -5,7 +5,7 @@ ### Features Added * Added instrumentation support for Azure SDKs. - See [Enable Azure SDK Instrumentation](README.md####Enable-Azure-SDK-Instrumentation) for details. + See [Enable Azure SDK Instrumentation](README.md#Enable-Azure-SDK-Instrumentation) for details. ([#37505](https://github.com/Azure/azure-sdk-for-net/pull/37505)) * Added `SamplingRatio` property to customize the sampling rate in Azure Monitor Exporter. **Note**: This package no longer takes dependency on [OpenTelemetry.Extensions.AzureMonitor](https://www.nuget.org/packages/OpenTelemetry.Extensions.AzureMonitor) ([#36972](https://github.com/Azure/azure-sdk-for-net/pull/36972)) From 6b26953126e274b9618d4fa723a3f737e2891ada Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Thu, 13 Jul 2023 17:55:24 -0700 Subject: [PATCH 4/4] changelog links --- sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md index 0f6b63c211386..f878d54610bbc 100644 --- a/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md +++ b/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md @@ -5,7 +5,7 @@ ### Features Added * Added instrumentation support for Azure SDKs. - See [Enable Azure SDK Instrumentation](README.md#Enable-Azure-SDK-Instrumentation) for details. + See [Enable Azure SDK Instrumentation](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/README.md#enable-azure-sdk-instrumentation) for details. ([#37505](https://github.com/Azure/azure-sdk-for-net/pull/37505)) * Added `SamplingRatio` property to customize the sampling rate in Azure Monitor Exporter. **Note**: This package no longer takes dependency on [OpenTelemetry.Extensions.AzureMonitor](https://www.nuget.org/packages/OpenTelemetry.Extensions.AzureMonitor) ([#36972](https://github.com/Azure/azure-sdk-for-net/pull/36972))