Asos.OpenTelemetry.Exporter.EventHubs 0.2.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Asos.OpenTelemetry.Exporter.EventHubs --version 0.2.1                
NuGet\Install-Package Asos.OpenTelemetry.Exporter.EventHubs -Version 0.2.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Asos.OpenTelemetry.Exporter.EventHubs" Version="0.2.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Asos.OpenTelemetry.Exporter.EventHubs --version 0.2.1                
#r "nuget: Asos.OpenTelemetry.Exporter.EventHubs, 0.2.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Asos.OpenTelemetry.Exporter.EventHubs as a Cake Addin
#addin nuget:?package=Asos.OpenTelemetry.Exporter.EventHubs&version=0.2.1

// Install Asos.OpenTelemetry.Exporter.EventHubs as a Cake Tool
#tool nuget:?package=Asos.OpenTelemetry.Exporter.EventHubs&version=0.2.1                

Open Telemetry Export for Event Hubs

A library for sending OTLP data to an Azure Event Hubs endpoint.

What's it for?

This library is specifically to simplify in process scenarios where agents or other collector patterns aren't an option and you'd like the process being instrumented to be responsible for transmitting data to the target

How does it work?

This is a bit of syntantic sugar to help with bootstrapping the Event Hubs endpoint and setting up authentication. The exporter option we expose here AddOtlpEventHubExporter builds directly onto AddOtlpExporter and sets up the necessary configuration.

In particular, that's setting the protocol to HttpProtobuf and the HttpClientFactory to take an instance that handles tokens and token refreshes.

The library will support either SAS key authentication or Managed Identity, and sets up the HttpClient to transmit the appropriate authorization header.

Example configurations

Create an EventHubOptions object and choose from either SAS key authentication or managed identity. When configuring your services, you now have an extension named AddOtlpEventHubExporter that you can pass the options to

var eventHubOptions = new EventHubOptions
{
    AuthenticationMode = AuthenticationMode.SasKey,
    KeyName = "the-name-of-the-access-key"    
    AccessKey = "the-event-hub-access-key",
    EventHubFqdn = "fully-qualified-target-eventhub-uri"
};

OR

var eventHubOptions = new EventHubOptions
{
    AuthenticationMode = AuthenticationMode.ManagedIdentity,
    EventHubFqdn = "fully-qualified-target-eventhub-uri"
};

services.AddOpenTelemetryMetrics(builder => builder
    .SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("DemoService"))
    .AddAspNetCoreInstrumentation()
    .AddMeter("MeterName")
    .AddOtlpEventHubExporter(eventHubOptions));

Permissions

When running as a SAS key, the permissions are available from the access key you've used. However, when running in ManagedIdentity, you'll need to grant the Azure Event Hubs Data Sender role to the identity you want to access the Event Hub endpoint.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 6,702 6/13/2024
1.0.2 4,819 4/17/2024
1.0.1 697 4/12/2024
1.0.0 15,543 10/20/2023
0.2.1 1,839 8/22/2023
0.1.2 5,914 9/23/2022
0.1.1 384 9/21/2022