gotrace_id

package module
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 4 Imported by: 1

README

Golang

📦 Golang TraceId

godoc goproxy.cn goreportcard.com deps.dev

安装

go get -v -u go.dtapp.net/gotrace_id@v1.0.12

Documentation

Index

Constants

View Source
const (
	TraceIdKey        = "trace_id"
	TraceIdGinKey     = "trace_id"
	TraceIdRequestKey = "X-Request-Id"
	TraceIDRequestKey = "X-Request-ID"
)
View Source
const Nil = "%!s(<nil>)"
View Source
const Version = "1.0.12"

Variables

This section is empty.

Functions

func CustomGetTraceIdContext added in v1.0.12

func CustomGetTraceIdContext(ctx context.Context, key string) string

CustomGetTraceIdContext 通过自定义上下文获取跟踪编号

func CustomTraceIdContext

func CustomTraceIdContext(ctx context.Context) context.Context

CustomTraceIdContext 自定义设置跟踪编号上下文

func GetGinTraceId

func GetGinTraceId(c *gin.Context) string

GetGinTraceId 通过gin中间件获取跟踪编号

func GetTraceIdContext

func GetTraceIdContext(ctx context.Context) string

GetTraceIdContext 通过上下文获取跟踪编号

func SetCustomTraceId added in v1.0.6

func SetCustomTraceId(ctx context.Context, traceId string) context.Context

SetCustomTraceId 自定义设置跟踪编号上下文

func SetGinTraceId

func SetGinTraceId() gin.HandlerFunc

SetGinTraceId 设置跟踪编号 https://www.jianshu.com/p/2a1a74ad3c3a

func SetGinTraceIdContext

func SetGinTraceIdContext(ctx context.Context, c *gin.Context) context.Context

SetGinTraceIdContext 设置跟踪编号上下文

Types

This section is empty.

Jump to

Keyboard shortcuts

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