Overview of OpenTelemetry concepts
You can find information about an overview of the OpenTelemetry concepts.
OpenTelemetry key components
The OpenTelemetry architecture
consists of several key components that work together to collect and export telemetry data:
- Application Programming Interfaces (APIs)
- These are the interfaces used by developers to instrument their code. They define how to create traces, spans, metrics, and logs. The APIs are language-specific but follow a common specification.
- Software Development Kits (SDKs)
- The SDKs implement the APIs and provide the actual logic for processing and exporting telemetry data. This includes functionality like sampling, batching, and adding resource information.
- Collector
- The OpenTelemetry Collector is an agent that can receive, process, and export telemetry data. It's an optional, but highly recommended component. It can be deployed as a sidecar, a daemon set, or a standalone service.
- Exporters
- Exporters are responsible for sending the collected telemetry data to a specific backend. OpenTelemetry has a wide range of exporters for various platforms, including Prometheus, Jaeger, and many commercial services.
The way OpenTelemetry works
- Instrumentation
- Developers use the OpenTelemetry APIs and SDKs to instrument their code. This involves adding code to generate traces, metrics, and logs at key points in the lifecycle of applications.
- Data generation
- While the application runs, it generates telemetry data based on the instrumentation. This data is collected and processed by the OpenTelemetry SDK.
- Collection and processing
- The OpenTelemetry Collector receives
the data from the SDKs. The Collector can then perform various actions, such as:
- Filtering
- Dropping data that isn't needed.
- Transformation
- Changing the data format or adding metadata.
- Batching
- Grouping data together to reduce network overhead.
- Export
- Finally, the Collector or the SDKs export the processed data to an observability backend. The backend is where you can store, visualize, and analyze the telemetry data to understand the behavior and performance of your applications.
Spans
A span is the fundamental building block of a trace. It represents a single operation or unit of
work within a service, such as a database query, a function call, or an HTTP request. Spans are
organized in a parent-child relationship to form a complete trace. Each span contains the following information:
- Operation name
- A human-readable name for the operation. For example, GetUserProfile.
- Start and end timestamps
- The precise time the operation began and finished.
- Span context
- An immutable object that contains the Trace ID and Span ID, which are crucial for linking the spans together.
- Attributes
- Key-value pairs that provide additional context about the operation, such as HTTP status codes, user IDs, or database query parameters.
- Events
- A time-stamped log message with an optional set of attributes, useful for marking specific moments within a span.
- Links
- A connection to a different trace, useful in scenarios like batch processing where a single request may spawn multiple new traces.
Trace
A trace is a collection of spans that share the same Trace ID. The Trace ID is a unique identifier that links all spans belonging to a single request together. The spans are structured as a directed acyclic graph, where a single root span represents the initial request and its child spans represent subsequent operations. This structure allows developers to visualize the flow of a request and pinpoint bottlenecks or errors
Benefits
- Vendor neutrality
- OpenTelemetry is an open-source standard and frees you from vendor lock-ins. You can change your observability backend without having to re-instrument your applications.
- Distributed Context Propagation
- OpenTelemetry provides a standardized way to pass trace information between services.
- Performance Monitoring
- Helps in identifying performance bottlenecks and latency issues.
- Error Troubleshooting
- Facilitates the diagnosis of errors by providing the full context of a request's journey.
- Standardization
- By providing a single standard for telemetry, OpenTelemetry simplifies the process of integrating various tools and services.
- Rich Context
- Spans can be enriched with detailed attributes and events, providing deep insights into application behavior.
- Rich ecosystem
- The OpenTelemetry project is a Cloud Native Computing Foundation (CNCF) project with a strong community and a growing ecosystem of supported languages and tools.