Documentation ¶
Index ¶
- Constants
- Variables
- func ID(ctx context.Context) string
- func NewAuthUnaryInterceptor() grpc.UnaryServerInterceptor
- func NewFromContext(ctx context.Context) context.Context
- func NewHandler(delegate http.Handler) http.Handler
- func WithID(ctx context.Context) context.Context
- func WithMetaFromContext(ctx context.Context) context.Context
- func WithMetaFromRequest(req *http.Request) context.Context
- type Correlator
- type RequestContext
Constants ¶
const IDSize = 12
IDSize specifies a size in characters for the correlation ID
Variables ¶
var CorrelationIDgRPCHeaderName = "x-correlation-id"
CorrelationIDgRPCHeaderName specifies default name for gRPC header
Functions ¶
func NewAuthUnaryInterceptor ¶
func NewAuthUnaryInterceptor() grpc.UnaryServerInterceptor
NewAuthUnaryInterceptor returns grpc.UnaryServerInterceptor that identity to the context
func NewFromContext ¶
NewFromContext returns new Background context with Correlation ID from incoming context
func NewHandler ¶
NewHandler returns a handler that will extact/add the correlationID from the request and stash them away in the request context for later handlers to use.
func WithID ¶
WithID returns context with Correlation ID, if the context alread has Correlation ID, the original is returned
func WithMetaFromContext ¶
WithMetaFromContext returns context with Correlation ID for the outgoing gRPC call
Types ¶
type Correlator ¶
type Correlator interface {
CorrelationID() string
}
Correlator interface allows to provide request ID
type RequestContext ¶
type RequestContext struct {
ID string
}
RequestContext represents user contextual information about a request being processed by the server, it includes ID, aka Request-ID or Correlation-ID (for cross system request correlation).
func Value ¶
func Value(ctx context.Context) *RequestContext
Value returns correlation RequestContext from the context