OpenTelemetry (OTel) — CNCF-graduated vendor-neutral standard and tooling for collecting + exporting observability data. Merges OpenTracing + OpenCensus (2019). Supports: metrics, logs, traces via a single SDK for 15+ languages. Auto-instrumentation for popular frameworks (Express, FastAPI, Django, Spring). Export to any backend: Jaeger, Prometheus, Datadog, New Relic, Grafana Tempo.
Below: details, example, related terms, FAQ.
Free online tool — HTTP header checker: instant results, no signup.
// Node.js Express auto-instrumentation
const { NodeSDK } = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const sdk = new NodeSDK({
instrumentations: [getNodeAutoInstrumentations()],
});
sdk.start(); // All Express routes auto-tracedOpenTelemetry provides a comprehensive architecture designed to facilitate the collection, processing, and export of observability data. The architecture is built around three primary components: Instrumentation, Collection, and Export.
Instrumentation is the process of adding telemetry data collection capabilities to your application. OpenTelemetry supports auto-instrumentation for popular frameworks, allowing developers to gather metrics, logs, and traces with minimal code changes. Additionally, manual instrumentation can be done using the OpenTelemetry API, providing fine-grained control over what data is collected.
The Collection component acts as an intermediary that gathers telemetry data from the instrumented applications. OpenTelemetry Collector is a key part of this architecture, enabling the aggregation and processing of data. The Collector can receive data in various formats and from multiple sources, allowing for a flexible and scalable observability solution.
Finally, the Export component is responsible for sending the collected telemetry data to various backends for storage and analysis. OpenTelemetry supports a wide range of exporters, including Jaeger for distributed tracing, Prometheus for metrics, and logging frameworks for logs. This flexibility allows organizations to choose the best tools that fit their observability strategy.
In summary, OpenTelemetry's architecture is designed to be modular and extensible, making it suitable for diverse observability needs across different environments.
Configuring OpenTelemetry for your application can be straightforward, especially with its comprehensive SDKs. Below are practical examples for setting up OpenTelemetry in a Node.js application using Express and a Python application using FastAPI.
To instrument an Express application, follow these steps:
npm install @opentelemetry/sdk-node @opentelemetry/instrumentation-express Next, create a basic setup file:
const { NodeSDK } = require('@opentelemetry/sdk-node');
const { ExpressInstrumentation } = require('@opentelemetry/instrumentation-express');
const sdk = new NodeSDK({
traceExporter: new SomeTraceExporter(),
instrumentations: [new ExpressInstrumentation()]
});
sdk.start(); This configuration will automatically instrument all routes in your Express application.
For a FastAPI application, you can set up OpenTelemetry as follows:
pip install opentelemetry-api opentelemetry-sdk opentelemetry-instrumentation-fastapi Then, configure it in your main application file:
from opentelemetry import trace
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
app = FastAPI()
FastAPIInstrumentor.instrument_app(app)
# Your routes here
if __name__ == '__main__':
trace.get_tracer_provider().start() # Start the tracer provider This setup will automatically trace requests to your FastAPI endpoints. By following these examples, you can quickly implement OpenTelemetry to enhance your application's observability.
OpenTelemetry is versatile and can be applied across various use cases in software development and operations. Here are some common scenarios where OpenTelemetry shines:
These use cases demonstrate the power of OpenTelemetry in enhancing observability and operational efficiency, making it an essential tool for modern software development and monitoring.
OTel — open standard, vendor-neutral. Datadog agent — vendor-specific, deeper integrations. OTel migration easier if you switch vendors.
2-5% CPU overhead with auto-instrumentation. Sampling (1-10% traces) reduces it.
Tracing — stable since 2021. Metrics — stable since 2023. Logs — stable since 2024. All three usable in prod.
Free plan — 10 monitors, checks every 5 min, no card required. Upgrade for 1-minute interval and multi-region monitoring.