trace

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTP_METHOD    = "http.method"
	HTTP_ROUTE     = "http.route"
	HTTP_CLIENT_IP = "http.client_ip"
	FUNC_PATH      = "func.path"
)

Variables

This section is empty.

Functions

func CloseSpan

func CloseSpan(span trace.Span, errs ...error)

func End

func End(ctx context.Context)

func EndSpan

func EndSpan(ctx context.Context, err error)

EndSpan 关闭span

func InitTracer

func InitTracer(tc *telemetry.Config, instance string) *sdktrace.TracerProvider

InitTracer 初始化trace

func MiddlewareTrace

func MiddlewareTrace() gin.HandlerFunc

MiddlewareTrace 接口层链路追踪,设置span

func NewOTELHttpClient20

func NewOTELHttpClient20() *http.Client

func NewOTELHttpClientParam

func NewOTELHttpClientParam(timeout time.Duration, transport *http.Transport) *http.Client

func NewOTELHttpClientWithTimeout

func NewOTELHttpClientWithTimeout(timeout time.Duration) *http.Client

func NewOtelHttpClient

func NewOtelHttpClient() *http.Client

func OpenSpan

func OpenSpan(ctx *context.Context) trace.Span

func ReleaseFunc

func ReleaseFunc(tracerProvider *sdktrace.TracerProvider) func()

func SetAttributes

func SetAttributes(ctx context.Context, kv ...attribute.KeyValue)

func Span

func Span(ctx context.Context) trace.Span

func StartConsumerSpan

func StartConsumerSpan(ctx context.Context) (context.Context, trace.Span)

StartConsumerSpan 消费者消费消息时记录使用

func StartInternalSpan

func StartInternalSpan(ctx context.Context) (context.Context, trace.Span)

StartInternalSpan 内部方法调用

func StartProducerSpan

func StartProducerSpan(ctx context.Context) (context.Context, trace.Span)

StartProducerSpan 生产者生产消息时记录使用

func StartServerSpan

func StartServerSpan(c *gin.Context) (ctx context.Context, span trace.Span)

StartServerSpan 接口层调用时使用

func StartSpan

func StartSpan(ctx context.Context) context.Context

func TelemetrySpanEnd

func TelemetrySpanEnd(span trace.Span, err error)

TelemetrySpanEnd 关闭span

Types

This section is empty.

Jump to

Keyboard shortcuts

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