Show / Hide Table of Contents

    Azure Monitor Exporter client library for .NET

    The OpenTelemetry .NET exporters which send telemetry data to Azure Monitor following the OpenTelemetry Specification.

    Getting started

    Prerequisites

    • Azure Subscription: To use Azure services, including Azure Monitor Exporter for OpenTelemetry .NET, you'll need a subscription. If you do not have an existing Azure account, you may sign up for a free trial or use your Visual Studio Subscription benefits when you create an account.
    • Azure Application Insights Connection String: To send telemetry data to the monitoring service you'll need connection string from Azure Application Insights. If you are not familiar with creating Azure resources, you may wish to follow the step-by-step guide for Create an Application Insights resource and copy the connection string.

    Install the package

    Install the Azure Monitor Exporter for OpenTelemetry .NET with NuGet:

    dotnet add package Microsoft.OpenTelemetry.Exporter.AzureMonitor
    

    Authenticate the client

    Exporter does not use authentication.

    Key concepts

    This exporter sends traces to the configured Azure Monitor Resource using HTTPS. IP addresses used by the Azure Monitor is documented in IP addresses used by Application Insights and Log Analytics.

    Examples

    Refer to DemoTrace.cs for a complete demo.

    using Microsoft.OpenTelemetry.Exporter.AzureMonitor;
    using OpenTelemetry.Trace;
    
    OpenTelemetry.Sdk.CreateTracerProviderBuilder()
        .AddSource("Demo.DemoClient")
        .AddAzureMonitorTraceExporter(o => {
            o.ConnectionString = "<Your Connection String>";
        })
        .Build();
    

    Troubleshooting

    This exporter logs event using the .NET EventSource to emit information. The exporter logs are available to any EventListener by opting into the source named "OpenTelemetry-TraceExporter-AzureMonitor".

    Next steps

    For more information on Azure SDK, please refer to this website

    Contributing

    See CONTRIBUTING.md for details on contribution process.

    Back to top Azure SDK for Net