rkginctx

package
v1.2.22 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package rkginctx defines utility functions and variables used by Gin middleware

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHeaderToClient added in v1.2.0

func AddHeaderToClient(ctx *gin.Context, key, value string)

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

func EndTraceSpan added in v1.2.0

func EndTraceSpan(ctx *gin.Context, span trace.Span, success bool)

EndTraceSpan end span

func GetCsrfToken added in v1.2.11

func GetCsrfToken(ctx *gin.Context) string

GetCsrfToken return csrf token if exists

func GetEntryName added in v1.2.0

func GetEntryName(ctx *gin.Context) string

GetEntryName extract entry name from context.

func GetEvent

func GetEvent(ctx *gin.Context) rkquery.Event

GetEvent extract takes the call-scoped EventData from middleware.

func GetIncomingHeaders added in v1.2.0

func GetIncomingHeaders(ctx *gin.Context) http.Header

GetIncomingHeaders extract call-scoped incoming headers

func GetJwtToken added in v1.2.11

func GetJwtToken(ctx *gin.Context) *jwt.Token

GetJwtToken return jwt.Token if exists

func GetLogger

func GetLogger(ctx *gin.Context) *zap.Logger

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

func GetRequestId added in v1.2.0

func GetRequestId(ctx *gin.Context) 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 added in v1.2.0

func GetTraceId(ctx *gin.Context) string

GetTraceId extract trace id from context.

func GetTraceSpan added in v1.2.0

func GetTraceSpan(ctx *gin.Context) trace.Span

GetTraceSpan extract the call-scoped span from context.

func GetTracer added in v1.2.0

func GetTracer(ctx *gin.Context) trace.Tracer

GetTracer extract the call-scoped tracer from context.

func GetTracerPropagator added in v1.2.0

func GetTracerPropagator(ctx *gin.Context) propagation.TextMapPropagator

GetTracerPropagator extract takes the call-scoped propagator from middleware.

func GetTracerProvider added in v1.2.0

func GetTracerProvider(ctx *gin.Context) trace.TracerProvider

GetTracerProvider extract the call-scoped tracer provider from context.

func InjectSpanToHttpRequest added in v1.2.0

func InjectSpanToHttpRequest(ctx *gin.Context, req *http.Request)

InjectSpanToHttpRequest inject span to http request

func NewTraceSpan added in v1.2.0

func NewTraceSpan(ctx *gin.Context, name string) trace.Span

NewTraceSpan start a new span

func SetHeaderToClient added in v1.2.0

func SetHeaderToClient(ctx *gin.Context, key, value string)

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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