github.com/clubpay/ronykit/kit@v0.14.4-0.20240515065620-d0dace45cbc7/trace.go (about)

     1  package kit
     2  
     3  import "context"
     4  
     5  // TracePropagator propagates cross-cutting concerns as key-value text
     6  // pairs within a carrier that travels in-band across process boundaries.
     7  type TracePropagator interface {
     8  	// Inject set cross-cutting concerns from the Context into the carrier.
     9  	Inject(ctx context.Context, carrier TraceCarrier)
    10  
    11  	// Extract reads cross-cutting concerns from the carrier into a Context.
    12  	Extract(ctx context.Context, carrier TraceCarrier) context.Context
    13  }
    14  
    15  // TraceCarrier is the storage medium used by a TracePropagator.
    16  type TraceCarrier interface {
    17  	// Get returns the value associated with the passed key.
    18  	Get(key string) string
    19  
    20  	// Set stores the key-value pair.
    21  	Set(key string, value string)
    22  }
    23  
    24  type Tracer interface {
    25  	TracePropagator
    26  	Handler() HandlerFunc
    27  }