rkmuxctx

package
v1.2.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package rkmuxctx defines utility functions and variables used by gorilla/mux middleware

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHeaderToClient

func AddHeaderToClient(writer http.ResponseWriter, key, value string)

AddHeaderToClient headers that would be sent to client. Values would be merged.

func EndTraceSpan

func EndTraceSpan(span trace.Span, success bool)

EndTraceSpan end span

func GetCsrfToken

func GetCsrfToken(req *http.Request) string

GetCsrfToken return csrf token if exists

func GetCursor added in v1.0.3

func GetCursor(req *http.Request, writer http.ResponseWriter) *rkcursor.Cursor

GetCursor create rkcursor.Cursor instance

func GetEntryName

func GetEntryName(req *http.Request) string

GetEntryName extract entry name from Request.

func GetEvent

func GetEvent(req *http.Request) rkquery.Event

GetEvent extract takes the call-scoped EventData from middleware.

func GetIncomingHeaders

func GetIncomingHeaders(req *http.Request) http.Header

GetIncomingHeaders extract call-scoped incoming headers

func GetJwtToken

func GetJwtToken(req *http.Request) *jwt.Token

GetJwtToken return jwt.Token if exists

func GetLogger

func GetLogger(req *http.Request, writer http.ResponseWriter) *zap.Logger

GetLogger extract takes the call-scoped zap logger from middleware.

func GetRequestId

func GetRequestId(w http.ResponseWriter) string

GetRequestId extract request id from ResponseWriter. If user enabled meta interceptor, then a random request Id would e assigned and set to ResponseWriter 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 ResponseWriter.

func GetTraceSpan

func GetTraceSpan(req *http.Request) trace.Span

GetTraceSpan extract the call-scoped span from Request.

func GetTracer

func GetTracer(req *http.Request) trace.Tracer

GetTracer extract the call-scoped tracer from Request.

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 Request.

func GormCtx added in v1.2.5

func GormCtx(req *http.Request, writer http.ResponseWriter) context.Context

func InjectSpanToHttpRequest

func InjectSpanToHttpRequest(src *http.Request, dest *http.Request)

InjectSpanToHttpRequest inject span to http request

func NewTraceSpan

func NewTraceSpan(req *http.Request, name string) (*http.Request, trace.Span)

NewTraceSpan start a new span

func SetHeaderToClient

func SetHeaderToClient(writer http.ResponseWriter, key, value string)

SetHeaderToClient headers that would be sent to client. Values would be overridden.

func SetPointerCreator added in v1.2.14

func SetPointerCreator(creator rkcursor.PointerCreator)

SetPointerCreator override rkcursor.PointerCreator

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL