Skip to main content

OpenTelemetry Exporters - Types and Configuration Steps

· 10 min read
Favour Daniel

In this post, we will talk about OpenTelemetry exporters. OpenTelemetry exporters help in exporting the telemetry data collected by OpenTelemetry. OpenTelemetry frees you from any kind of vendor lock-in by letting you export the collected telemetry data to any backend of your choice.

Cover Image

In modern distributed systems, efficiently collecting, transmitting, and analyzing telemetry data from diverse sources poses a significant challenge. The sheer complexity and scale of these environments require a streamlined solution that can collect and export data from various components seamlessly.

Once you have collected data with OpenTelemetry, OpenTelemetry exporters provide a standardized way to export telemetry data to various backend systems, enabling efficient transmission and analysis and ensuring that data is collected in a consistent format and sent to the appropriate backend for further processing.

This article discusses the need for OpenTelemetry Exporters, the types of OpenTelemetry exporters, and how they can be configured. Before we get into it, let us understand what OpenTelemetry is first.

What is OpenTelemetry?

OpenTelemetry is an open-source collection of tools, APIs, and SDKs that aims to standardize the way we generate and collect telemetry data. It follows a specification-driven development. The OpenTelemetry specification  has design and implementation guidelines for how the instrumentation libraries should be implemented. In addition, it provides client libraries in all the major programming languages that follow the specification.

OpenTelemetry was formed after the merger of two open-source projects - OpenCensus and OpenTracing in 2019. Since then, it has been the go-to open-source standard for instrumenting cloud-native applications.

The specification is designed into distinct types of telemetry known as signals. Presently, OpenTelemetry has specifications for these three signals:

  • Logs
  • Metrics and
  • Traces

Together, these three signals form the three pillars of observability. OpenTelemetry is the bedrock for setting up an observability framework. The application code is instrumented using OpenTelemetry client libraries, which enables the generation of telemetry data. Once the telemetry data is generated and collected, you need to configure the OpenTelemetry exporter to send data to a backed analysis tool like SigNoz.

Why do we need OpenTelemetry Exporters?

OpenTelemetry plays a crucial role in the data collection process, offering invaluable insights into the behavior and performance of applications. However, once this data is acquired, it's important to note that it remains within the application environment and isn't readily available for immediate analysis or further processing.

OpenTelemetry provides exporters, which serve as the conduits for transferring collected data to an OpenTelemetry Collector or a specified backend. This ensures that the data can be effectively utilized for comprehensive analysis, monitoring, and optimization of the application's performance and behavior.

What are OpenTelemetry Exporters?

An OpenTelemetry Exporter is an OpenTelemetry component responsible for transmitting the collected telemetry data from the application to the chosen backend. These software components are designed to transform code objects, which represent the collected telemetry data, into a format (typically binary or JSON) that's easily storable or transmittable.

Once the telemetry data is converted, the Exporters use standard network protocols like HTTP or gRPC to send the formatted data to its designated destination. This destination may be an OpenTelemetry Collector or any backend system tailored to receive and process this type of data. OpenTelemetry Exporters take charge of communication protocols, data formats, and authentication mechanisms, ensuring a smooth interaction with the backend. This ensures that the telemetry data seamlessly reaches its destination for analysis and interpretation.

In essence, OpenTelemetry Exporters serve as the vital link between the application's internal data structure and the external systems tasked with additional analysis, storage, or monitoring. Without Exporters, the data collected by OpenTelemetry would stay confined within the application, making it inaccessible and underutilized.

Types of OpenTelemetry Exporters

In this section, we'll look at different types of OpenTelemetry Exporters and their unique capabilities in enhancing observability and data analysis workflows. They are:

  • OTLP
  • Zipkin
  • Jaeger
  • OpenCensus

OpenTelemetry Protocol (OTLP)

OTLP, the native protocol for OpenTelemetry, serves as a library facilitating the standardized transmission of tracing data to an OTLP collector. This lightweight solution seamlessly sends telemetry data to OpenTelemetry-compatible backends. The protocol encompasses encoding, transport, and delivery mechanisms for data exchange between telemetry sources, collectors, and backends.

OTLP employs protocol buffers for efficient telemetry data serialization, utilizing either gRPC or HTTP for transmission. This protocol operates across all nodes in the telemetry data flow, encompassing clients, observability platforms, services, agents, collectors, and forwarders. Its primary objective is to establish a serialization schema aligned with data models, addressing known issues in existing telemetry protocols.

Additionally, it outlines guidelines for implementing both client and server components, covering serialization, data transmission, and response handling.

It is recommended to use the OTLP exporter for any OpenTelemetry setup.

Zipkin

Zipkin is a distributed tracing system used for tracking and analyzing how requests move through complex systems, especially in setups with many interconnected services, known as microservices.

OpenTelemetry seamlessly integrates with Zipkin, offering two exporters for integrating trace data collected by OpenTelemetry into Zipkin: the OpenTelemetry Zipkin JSON Exporter and the OpenTelemetry Zipkin Protobuf Exporter.

The OpenTelemetry Zipkin JSON Exporter simplifies the process of sending OpenTelemetry traces to Zipkin by packaging it in JSON format over HTTP to the designated Zipkin collector endpoint. This exporter supports multiple versions (v1 and v2), giving you more flexibility in how you manage and analyze your traces.

Additionally, the OpenTelemetry Zipkin Protobuf Exporter efficiently sends traces to Zipkin by transmitting the traces to the designated Zipkin collector endpoint via HTTP, and it supports the efficient v2 protobuf format for trace data.

Jaeger

Jaeger is an open-source, distributed tracing system that monitors and troubleshoots the flow of requests through complex, microservices-based applications, providing a comprehensive view of system interactions.

OpenTelemetry integrates with Jaeger, providing two exporters for sending telemetry data to collected by OpenTelemetry into Jaeger: OpenTelemetry Jaeger Thrift Exporter and OpenTelemetry Jaeger Protobuf Exporter.

The OpenTelemetry Jaeger Thrift Exporter efficiently transmits traces to the designated agent via the Thrift compact protocol over UDP. In cases where deploying the Jaeger Agent alongside an application proves challenging, as in the case of Lambda functions, a collector can be set up to relay spans using Thrift over HTTP. If both the agent and collector are in use, the exporter will exclusively route traces to the collector, avoiding any redundant entries.

The OpenTelemetry Jaeger Protobuf Exporter operates by sending traces to the designated agent through the efficient Protobuf serialization format facilitated by the high-performance gRPC communication protocol. For instance, in a microservices-based application, if one service makes an API call to another, the Jaeger Protobuf Exporter captures this interaction, converts it into Protobuf format, and sends it via gRPC to the configured agent for further processing and analysis. This ensures rapid and reliable transmission of trace data.

OpenCensus

OpenCensus was an open-source project, now merged into OpenTelemetry, that provided a set of libraries and instrumentation to enable observability in software systems. Like OpenTelemetry, OpenCensus focused on collecting metrics, traces, and other telemetry data to help developers and operators monitor and troubleshoot their applications.

Configuring an exporter

In this section, we will see how an exporter can be configured for a Python application with the OTLP Collector or OTLP endpoint.

In order to transmit data to an OTLP endpoint or the OpenTelemetry Collector, the OTLP exporter needs to be configured to the specific endpoint. The endpoint is the specific server or service where the telemetry data will be sent for processing and analysis.

Install the exporter

The first step is to install the exporter. To do this, run the following command:

pip install opentelemetry-exporter-otlp-proto-grpc

Setup tracing

Note that the below instructions are only valid for manual instrumentation. If you want to setup auto-instrumentation, please refer to docs here.

Once the exporter has been installed, we can proceed to setting up traces for the application.

from opentelemetry import trace
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk.resources import SERVICE_NAME, Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor

# Service name is required for most backends
resource = Resource(attributes={
SERVICE_NAME: "your-service-name"
})

provider = TracerProvider(resource=resource)
processor = BatchSpanProcessor(OTLPSpanExporter(endpoint="http://<IP of your Backend>:4317"))
provider.add_span_processor(processor)
trace.set_tracer_provider(provider)

# Merrily go about tracing!

The above sets up tracing capabilities using OpenTelemetry. It imports necessary modules, defines a resource with a service name, creates a tracer provider, configures a span processor with an OTLP exporter, and establishes this provider for tracing. It prepares the environment for generating and exporting traces to a specified endpoint.

Configure metrics collection

from opentelemetry import metrics
from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
from opentelemetry.sdk.resources import SERVICE_NAME, Resource

# Service name is required for most backends
resource = Resource(attributes={
SERVICE_NAME: "your-service-name"
})

reader = PeriodicExportingMetricReader(
OTLPMetricExporter(endpoint="http://<IP of your Backend>:4317")
)
provider = MeterProvider(resource=resource, metric_readers=[reader])
metrics.set_meter_provider(provider)

The above configures a metrics collection system using OpenTelemetry. It imports necessary modules, sets up a resource with a service name, creates a periodic metric reader with an OTLP metric exporter, and establishes a meter provider. This prepares the environment for collecting and exporting metrics to a specified endpoint.

Using HTTP

If you’d prefer to use OTLP/HTTP with the binary-encoded protobuf format, you can install the package:

pip install opentelemetry-exporter-otlp-proto-http

Once the package is installed, replace the import declarations to use the HTTP exporter for tracing with the following:

from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter

Finally, update your exporter endpoint if you’re specifying it in code:

OTLPSpanExporter((endpoint = "<traces-endpoint>/v1/traces"));

Note that there is not currently an OTLP/HTTP metric exporter.

Subsequently, you can configure an exporter for Python applications using Jaeger, Zipkin, and Prometheus.

You can also visit the OpenTelemetry docs to learn how to configure an exporter with other programming languages.

Choosing the right backend solution for your applications

OpenTelemetry provides a vendor-agnostic way of collecting and managing telemetry data. The next step is to choose a backend analysis tool that can help you make sense of the collected data. SigNoz is a full-stack open-source application performance monitoring and observability platform built natively for OpenTelemetry.

SigNoz can be used to visualize metrics and traces with charts that can enable quick insights for your teams.

SigNoz UI showing application overview metrics like RPS, 50th/90th/99th Percentile latencies, and Error Rate
SigNoz UI showing application overview metrics like RPS, 50th/90th/99th Percentile latencies, and Error Rate

The tracing signal from OpenTelemetry instrumentation helps you correlate events across services. With SigNoz, you can visualize your tracing data using Flamegraphs and Gantt charts. It shows you a complete breakdown of the request along with every bit of data collected with OpenTelemetry semantic conventions.

Tracing data collected by OpenTelemetry can be visualized with the help of Flamegraphs and Gantt charts on the SigNoz dashboard
Tracing data collected by OpenTelemetry can be visualized with the help of Flamegraphs and Gantt charts on the SigNoz dashboard

Getting started with SigNoz

SigNoz cloud is the easiest way to run SigNoz. Sign up for a free account and get 30 days of unlimited access to all features.

Try SigNoz Cloud CTA

You can also install and self-host SigNoz yourself since it is open-source. With 16,000+ GitHub stars, open-source SigNoz is loved by developers. Find the instructions to self-host SigNoz.


Related Posts

OpenTelemetry Collector - Complete Guide

OpenTelemetry Tracing - things you need to know