Documentation ¶
Overview ¶
Package rkgfctx defines utility functions and variables used by GoFrame middleware
Index ¶
- Constants
- func AddHeaderToClient(ctx *ghttp.Request, key, value string)
- func EndTraceSpan(ctx *ghttp.Request, span trace.Span, success bool)
- func GetCsrfToken(ctx *ghttp.Request) string
- func GetEntryName(ctx *ghttp.Request) string
- func GetEvent(ctx *ghttp.Request) rkquery.Event
- func GetIncomingHeaders(ctx *ghttp.Request) http.Header
- func GetJwtToken(ctx *ghttp.Request) *jwt.Token
- func GetLogger(ctx *ghttp.Request) *zap.Logger
- func GetRequestId(ctx *ghttp.Request) string
- func GetTraceId(ctx *ghttp.Request) string
- func GetTraceSpan(ctx *ghttp.Request) trace.Span
- func GetTracer(ctx *ghttp.Request) trace.Tracer
- func GetTracerPropagator(ctx *ghttp.Request) propagation.TextMapPropagator
- func GetTracerProvider(ctx *ghttp.Request) trace.TracerProvider
- func InjectSpanToHttpRequest(ctx *ghttp.Request, req *http.Request)
- func NewTraceSpan(ctx *ghttp.Request, name string) trace.Span
- func SetHeaderToClient(ctx *ghttp.Request, key, value string)
Constants ¶
const ( // RequestIdKey is the header key sent to client RequestIdKey = "X-Request-Id" // TraceIdKey is the header sent to client TraceIdKey = "X-Trace-Id" )
Variables ¶
This section is empty.
Functions ¶
func AddHeaderToClient ¶
AddHeaderToClient headers that would be sent to client. Values would be merged.
func EndTraceSpan ¶
EndTraceSpan end span
func GetCsrfToken ¶
GetCsrfToken return csrf token if exists
func GetEntryName ¶
GetEntryName extract entry name from context.
func GetIncomingHeaders ¶
GetIncomingHeaders extract call-scoped incoming headers
func GetJwtToken ¶
GetJwtToken return jwt.Token if exists
func GetRequestId ¶
GetRequestId extract request id from context. If user enabled meta interceptor, then a random request Id would e assigned and set to context as value. If user called AddHeaderToClient() with key of RequestIdKey, then a new request id would be updated.
func GetTraceId ¶
GetTraceId extract trace id from context.
func GetTraceSpan ¶
GetTraceSpan extract the call-scoped span from context.
func GetTracerPropagator ¶
func GetTracerPropagator(ctx *ghttp.Request) propagation.TextMapPropagator
GetTracerPropagator extract takes the call-scoped propagator from middleware.
func GetTracerProvider ¶
func GetTracerProvider(ctx *ghttp.Request) trace.TracerProvider
GetTracerProvider extract the call-scoped tracer provider from context.
func InjectSpanToHttpRequest ¶
InjectSpanToHttpRequest inject span to http request
func NewTraceSpan ¶
NewTraceSpan start a new span
func SetHeaderToClient ¶
SetHeaderToClient headers that would be sent to client. Values would be overridden.
Types ¶
This section is empty.