Skip to content

Support Span links for PubSub Tracing #2650

@coolwednesday

Description

@coolwednesday

Key Highlights:

Why This Matters:

  • GoFr currently uses parent-child tracing which doesn't fit asynchronous pub/sub patterns
  • OpenTelemetry recommends span links as the standard for messaging systems
  • Span links enable proper correlation across decoupled, asynchronous message flows

What It Proposes:

  1. Producer-side enhancements: Inject W3C trace context into message metadata
  2. Consumer-side enhancements: Extract context and create span links to producer spans
  3. Batch operation support: Create appropriate span hierarchies with multiple links

Technical Implementation:

  • Uses trace.WithLinks() from OpenTelemetry Go SDK
  • Follows messaging semantic conventions
  • Supports multiple backends (Kafka, Google Pub/Sub, NATS)
  • Maintains backward compatibility with configuration options

Benefits:

  • ✅ Correct async correlation between producers and consumers
  • ✅ Supports fan-out (1→many) and fan-in (many→1) patterns
  • ✅ Aligns with OpenTelemetry standards
  • ✅ Better observability for event-driven architectures

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgoPull requests that update Go code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions