BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Open Source Elastic's OpenTelemetry SDK for .NET

Open Source Elastic's OpenTelemetry SDK for .NET

This item in japanese

Elastic announced the alpha release of the Elastic distribution of the OpenTelemetry SDK for .NET. This distribution preconfigures the collection of tracing, metrics and logs. Additionally, the distribution ensures that the OTLP exporter is enabled by default. The project is released as open-source.

To get started with the Elastic OpenTelemetry distribution, it is needed to add a reference to the Elastic OpenTelemetry NuGet package to a project. This can be achieved by adding a package reference to the project file: 

<PackageReference Include="Elastic.OpenTelemetry" Version="1.0.0-alpha.1" />

After adding the package reference, a developer can use the Elastic OpenTelemetry distribution in an application. The distribution includes a transitive dependency on the OpenTelemetry SDK, so there is no need to add it to the project.

To take advantage of the OpenTelemetry SDK instrumentation for ASP.NET Core, developers should also add the OpenTelemetry.Instrumentation.AspNetCore NuGet package. This package includes support to collect instrumentation (traces and metrics) for requests handled by ASP.NET Core endpoints. The OpenTelemetry SDK contains extension methods on the IServiceCollection to enable and configure the trace, metric, and log providers. The Elastic distribution overrides the default SDK registration.

At a minimum, it is necessary to configure two environment variables: OTEL_EXPORTER_OTLP_ENDPOINT and OTLP_EXPORTER_OTLP_HEADERS. The Elastic distribution will automatically enable the exporting of telemetry signals by the OTLP exporter. The OTLP exporter requires at least one endpoint to be configured. A common mechanism for configuring endpoints is via environment variables.

The current alpha release of the distribution is feature-limited. Elastic shares that their goal is to assess the fitness of the API design and ease of use. However, they underline that it is not suited to all application scenarios, so they discourage its use in production. 

Martijn Laarman, a principal software engineer at Elastic, shared with InfoQ some insights regarding this solution: 

The SDK aligns with Elastic's company-wide efforts to make OpenTelemetry natively part of the stack. Our APM solution has had support for native OLTP intake through OpenTelemetry SDKs for three years already. Our proprietary open-source agent also for the longest time has had an OpenTelemetry Bridge allowing users to use the OpenTelemetry SDK/Activity to instrument their code.

Moreover, Laarman emphasised that their OpenTelemetry .NET distribution is the next step in this journey allowing them to develop a vendor-neutral offering to their users where they can evaluate new features before contributing them back upstream to the wider OpenTelemetry community.

The code is fully open-sourced and available on GitHub

About the Author

Rate this Article

Adoption
Style

BT