Documentation
¶
Overview ¶
Package requestx provides the canonical request metadata model used by Kernel middleware. It is inspired by Kubernetes apiserver RequestInfo: every request is normalized once, then authn/authz/audit/ratelimit/log/metrics/trace stages read the same contract instead of each transport inventing its own metadata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
NewContext attaches Info to ctx.
func OperationKey ¶
OperationKey returns a stable operation/method key for rate limit, metrics and logs.
Types ¶
type Direction ¶
type Direction string
Direction identifies whether the request is entering this service or calling a downstream.
type Info ¶
type Info struct {
Direction Direction
Protocol Protocol
Service string
Method string
Operation string
Endpoint string
Exposure accessv1.Exposure
Action string
Resource string
TenantID string
RequestID string
TraceID string
UserID string
CallerService string
TargetService string
IsSystem bool
IsInternal bool
IsLongRunning bool
Labels map[string]string
}
Info is Kernel's normalized request metadata. Middleware should enrich and consume this value instead of re-parsing operation strings and headers.
func EnrichFromContext ¶
EnrichFromContext copies canonical contextx fields into info when missing.
func FromContext ¶
FromContext returns Info from ctx.
func FromContextOr ¶
FromContextOr returns Info from ctx or fallback.
func FromTransport ¶
FromTransport builds base Info from transport context.