Span Links

Span link support is in beta.

Overview

Span links are an OpenTelemetry concept and a part of the OpenTelemetry Tracing API. Datadog supports span links for:

  • Applications instrumented with OpenTelemetry SDKs.
  • Applications instrumented with Datadog client libraries using the OpenTelemetry API.
    Note: This beta release only supports the PHP client library.

Span links correlate one or more spans together that are causally related but don’t have a typical parent-child relationship. These links may correlate spans within the same trace or across different traces.

Span links help trace operations in distributed systems, where workflows often deviate from linear execution patterns. They are useful to trace the flow of operations in systems that execute requests in batches or process events asynchronously.

Common use cases

Span links are most applicable in fan-in scenarios, where multiple operations converge into a single span. The single span links back to multiple converging operations.

For example:

  • Scatter-Gather and Map-Reduce: Here, span links trace and correlate multiple parallel processes that converge into a single combined process. They connect the results of these parallel processes to their collective outcome.

  • Message Aggregation: In systems like Kafka Streams, span links connect each message in a group of messages to their aggregated result, showing how individual messages contribute to the final output.

  • Transactional Messaging: In scenarios where multiple messages are part of a single transaction, such as in message queues, span links trace the relationship between each message and the overarching transactional process.

  • Event Sourcing: Span links in event sourcing track how multiple change messages contribute to the current state of an entity.

If your application is instrumented with:

You can view span links from the Trace Explorer in Datadog.

Further reading