Instana Introduces OpenTelemetry Exporter for .NET
Tags: announcement, engineering
Published: 2022-08-02 20:15:02

---
title: Instana Introduces OpenTelemetry Exporter for .NET
published: true
date: 2022-07-20 13:39:39 UTC
tags: Announcement,Engineering
canonical_url: https://www.instana.com/blog/instana-introduces-opentelemetry-exporter-for-net/
---

### What is OpenTelemetry?

[**OpenTelemetry**](https://opentelemetry.io/) is an open-source project hosted by the [**CNCF**](https://www.cncf.io/) that provides APIs and SDKs for a variety of programming languages to instrument and collect observability data from applications. OpenTelemetry gives a framework for instrumenting, generating, collecting, and exporting telemetry data for analysis and understanding of software performance and behavior.

[**OpenTelemetry**](https://www.instana.com/blog/the-rise-of-distributed-tracing-with-opentelemetry/) offers a vendor-neutral data format that can be integrated with any data processing backend. This is possible thanks to a concept called “exporters.” An exporter allows you to configure which backend(s) you want it sent to. The exporter decouples the instrumentation from the backend configuration. This makes it easy to switch backends without the pain of re-instrumenting your code.

### OpenTelemetry and .NET

.NET is one of many languages supported by OpenTelemetry.

To instrument the .NET application, you have to add a corresponding [NuGet package](https://www.nuget.org/packages?q=opentelemetry.instrumentation) for the targeting runtime.

From there on, every collected trace will be exported by the .NET Instana exporter and directly sent to Instana’s backend.

### The Span Exporter

Once the OpenTelemetry instrumentation package is added, it will trace appropriate library, generating spans for every time that an instrumented library is called.

But you have to tell the tracer what to do with these spans. That’s where the exporter comes in.

The  **exporter** understands the vendor-neutral span format, converts it to a specific format, and sends this data to a backend to be processed and displayed later.

### Example

Let’s say we have one simple ASP .NET Core application which uses MSSQL database as storage. The Application exposes two endpoints to interact with database. The first endpoint named `/init` is used for initialize database and insert one random integer value. Second endpoint `/read` is used to read previously generated and inserted random integer value. ![](https://ibm.ent.box.com/file/image-20220603115251508.png)

![](https://www.instana.com/media/image-20220603115251508-1.png)

If we want to instrument this application using OpenTelemetry we have to add appropriate OpenTelemetry instrumentation packages. For this ASP .Net Core app we have to add `OpenTelemetry.Instrumentation.AspNetCore` and because we are using MsSQL we have to add `OpenTelemetry.Instrumentation.SqlClient` packages to generate spans every time those two libraries are called.

![](https://www.instana.com/media/image-20220603115454335-1.png)  
 ![](https://ibm.ent.box.com/file/image-20220603115454335.png)  
At the end, we want to report it somewhere, so we need OTel exporter. In order to export traces from serverless environment to Instana backend we choose [OpenTelemetry.Exporter.Instana](https://www.nuget.org/packages/OpenTelemetry.Exporter.Instana/).

The crucial thing, in OTel .Net world everything starts with `TraceProvider`so during initialization of this object we have to list all instrumentations and exporters. In our case that is `SqlClientInstrumentation`, `AspNetCoreInstrumentation` and because we want to report to Instana backend we have to add `InstanaExporter`.

![Adding InstanaExporter](https://www.instana.com/media/image-20220603115523444.png)

Also we have to provide two environment variables to the application before or during application starts. These variables are mandatory because exporter needs to know were to report generated spans:  
`ENV INSTANA_ENDPOINT_URL=endpoint_url`  
`ENV INSTANA_AGENT_KEY=the_agent_key`

Each HTTP call which results with database call will be captured in this case and immediately reported to Instana’s backend. Here we can see HTTP entry call `/init` with all following DB calls that are reported to Instana’s backend.

![Instana injesting Open Telemetry Distrubuted Traces](https://www.instana.com/media/InitCall-1024x485.png)

Same for `/read`:  
 ![Instana and OpenTelemetry](https://www.instana.com/media/readCall-1024x488.png)

We can see the converted and processed span data from OpenTelemetry in the Stan dashboard.

In conclusion, OpenTelemetry is rapidly gaining popularity in the observability world, especially with the flexibility to be exported, consumed and processed by a vendor specific backend.

Instana offers a convenient way to convert OpenTelemetry traces to the Instana platform for customers hosting the Instana Agent. But also for Node.js applications running in a serverless environment through the InstanaExporter.

Instana is wherever our customers are. By introducing an OpenTelemetry exporter for span data, we continue supporting use cases of our customers and continue with our integration of OpenTelemetry as a first class citizen into our observability platform.

### Check our solution on OpenTelemetry Github repository

Let us know what you think! Check our OTel solution on [**OTel Github repository**](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Exporter.Instana) and leave us some feedback there or with [**support@instana.com**](mailto:support@instana.com).

Come back to see how we work with and support the OpenTelemetry project.

For more on Instana’s support of OpenTelemetry, here’s some additional reading material:

- [**Dissecting the OpenTelemetry Collector: An  
Overview** ](https://www.instana.com/blog/dissecting-the-opentelemetry-collector-overview/)
- [**OpenTelemetry  
documentation** ](https://www.instana.com/docs/ecosystem/opentelemetry/#main)
- [**Instana AutoTrace: Fully Embracing  
OpenTelemetry** ](https://www.instana.com/blog/instana-autotrace-fully-embracing-opentelemetry/)
- [**The Rise of Distributed Tracing with  
OpenTelemetry** ](https://www.instana.com/blog/the-rise-of-distributed-tracing-with-opentelemetry/)
- [**Latest Instana OpenShift Operator Automatically Collects  
OpenTelemetry on Red Hat  
OpenShift** ](https://www.instana.com/blog/latest-instana-openshift-operator-automatically-collects-opentelemetry-on-red-hat-openshift/)

The post [Instana Introduces OpenTelemetry Exporter for .NET](https://www.instana.com/blog/instana-introduces-opentelemetry-exporter-for-net/) appeared first on [Instana](https://www.instana.com).