From 0166bad49b4546c42d810809be948c37c7f18ebd Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Thu, 13 Jul 2023 18:07:31 -0700 Subject: [PATCH] update readme to include Azure SDK support (#37606) * update readme to include Azure SDK support * changelog * fix md error --- .../CHANGELOG.md | 7 +++---- .../README.md | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md b/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/CHANGELOG.md index eb881e8995899..f878d54610bbc 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](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. +* 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 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).