trace

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSimpleReqIDToContext

func AddSimpleReqIDToContext(ctx context.Context, reqID string) context.Context

AddSimpleReqIDToContext adds the simple request ID to the context

func ClientBaseUnaryInterceptor added in v0.0.9

func ClientBaseUnaryInterceptor(from string) grpc.UnaryClientInterceptor

ClientBaseUnaryInterceptor add reqID to outgoing context from main context

func GenerateSimpleReqID

func GenerateSimpleReqID() string

GenerateSimpleReqID generates a simple request ID

func GetSimpleReqIDFromContext

func GetSimpleReqIDFromContext(ctx context.Context) string

GetSimpleReqIDFromContext returns the simple request ID from the context if no simple request ID is found, returns an empty string

func GetSimpleReqIDFromMetaData added in v0.0.9

func GetSimpleReqIDFromMetaData(ctx context.Context) (string, context.Context)

GetSimpleReqIDFromMetaData returns the simple request ID from the metadata metadata is incoming metadata if req-id contains in metadata we will add it to context

func MustGetSimpleReqIDFromContext

func MustGetSimpleReqIDFromContext(ctx context.Context) (context.Context, string)

MustGetSimpleReqIDFromContext returns the simple request ID from the context if no simple request ID is found, generates a new one and returns it and adds it to the context if simple request ID is found, returns new ctx with the simple request ID

func MustGetSimpleReqIDFromMetaData added in v0.0.9

func MustGetSimpleReqIDFromMetaData(ctx context.Context) (string, context.Context)

MustGetSimpleReqIDFromMetaData returns the simple request ID from the metadata metadata is incoming metadata if req-id not contains in metadata we will generate new one and add it to context

func ServerSimpleRequestIDUnaryInterceptor

func ServerSimpleRequestIDUnaryInterceptor() func(ctx context.Context,
	req interface{},
	info *grpc.UnaryServerInfo,
	handler grpc.UnaryHandler) (interface{}, error)

ServerSimpleRequestIDUnaryInterceptor returns a new unary server interceptor for simple request ID if reqID is not found in the context, generates a new one and adds it to the context

Types

type FromKeyType added in v0.0.9

type FromKeyType string
var FromKey FromKeyType = "x-api-from"

FromKey is the key hold from service name

Jump to

Keyboard shortcuts

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