MyObservability

Overview

Distributed tracing aims to address these challenges by creating a trace, which is a representation of a single user request's journey through the various services and components. Each trace consists of a series of interconnected spans, where each span represents an individual operation or activity within a specific service or component. When a request enters a service, the trace context is propagated along with the request. This usually involves injecting trace headers into the request, allowing downstream services to participate in the same trace. As the request flows through the system, each service generates its own span and updates the trace context with information about its operation's duration, metadata, and any relevant context.

List of components

Details

To start tracing, you’ll need to have an initialized TracerProvider that will let you create a Tracer.

Span

A trace includes one or more spans, which are the instances of a particular operation. A span has a parent span that it is linked to, unless it is the first span in the trace in which case its span parent ID is all zeros.

A span represents a unit of work or operation. Spans are the building blocks of Traces. In OpenTelemetry, they include the following information:

The way that we can add spans to an existing trace (or start a new one) is through the API module. Include OTel Module and create a span by making a call to the global tracer provider.

Trace Example

Context

Context is an object that contains the information for the sending and receiving service to correlate one span with another and associate it with the trace overall. For example, if Service A calls Service B, then a span from Service A whose ID is in context will be used as the parent span for the next span created in Service B.

Types: Span & Correlation context

Correlation Context

Correlation Context: It carries user-defined properties, such as customer ID, address, host details, etc. It is not necessary, but we can choose to ignore the correlation context.

Trace Context

OpenTelemetry Propegation

Propagation is the mechanism that moves Context (Span & Correlation) between services and processes. By doing so, it assembles a Distributed Trace. It serializes or deserializes Span Context and provides the relevant Trace information to be propagated from one service to another.

OpenTelemetry Baggage

In OpenTelemetry, Baggage is contextual information that’s passed between spans. It’s a key-value store that resides alongside span context in a trace, making values available to any span created within that trace.

For example, imagine you want to have a CustomerId attribute on every span in your trace, which involves multiple services; however, CustomerId is only available in one specific service. To accomplish your goal, you can use OpenTelemetry Baggage to propagate this value across your system.

OpenTelemetry Baggage
Main Page