Documentation ¶
Overview ¶
Package rkzeroctx defines utility functions and variables used by go-zero middleware
Index ¶
- func AddHeaderToClient(w http.ResponseWriter, key, value string)
- func EndTraceSpan(span trace.Span, success bool)
- func GetCsrfToken(req *http.Request) string
- func GetEntryName(req *http.Request) string
- func GetEvent(req *http.Request) rkquery.Event
- func GetIncomingHeaders(req *http.Request) http.Header
- func GetJwtToken(req *http.Request) *jwt.Token
- func GetLogger(req *http.Request, w http.ResponseWriter) *zap.Logger
- func GetRequestId(w http.ResponseWriter) string
- func GetTraceId(w http.ResponseWriter) string
- func GetTraceSpan(req *http.Request) trace.Span
- func GetTracer(req *http.Request) trace.Tracer
- func GetTracerPropagator(req *http.Request) propagation.TextMapPropagator
- func GetTracerProvider(req *http.Request) trace.TracerProvider
- func InjectSpanToHttpRequest(src *http.Request, dest *http.Request)
- func NewTraceSpan(req *http.Request, name string) (*http.Request, trace.Span)
- func SetHeaderToClient(w http.ResponseWriter, key, value string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddHeaderToClient ¶
func AddHeaderToClient(w http.ResponseWriter, key, value string)
AddHeaderToClient headers that would be sent to client. Values would be merged.
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 ¶
func GetRequestId(w http.ResponseWriter) string
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 ¶
func GetTraceId(w http.ResponseWriter) string
GetTraceId extract trace id from context.
func GetTraceSpan ¶
GetTraceSpan extract the call-scoped span from context.
func GetTracerPropagator ¶
func GetTracerPropagator(req *http.Request) propagation.TextMapPropagator
GetTracerPropagator extract takes the call-scoped propagator from middleware.
func GetTracerProvider ¶
func GetTracerProvider(req *http.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 ¶
func SetHeaderToClient(w http.ResponseWriter, key, value string)
SetHeaderToClient headers that would be sent to client. Values would be overridden.
Types ¶
This section is empty.