trace

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 18 Imported by: 0

README

链路追踪

endpoint: "jaeger-collector.example.com"
useSsl: true
header:
  Authorization: "Basic ----"
sample: 0.001

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithSpan

func ContextWithSpan(parent context.Context, span trace.Span) context.Context

func Default

func Default() trace.TracerProvider

func LoggerLabel

func LoggerLabel(ctx context.Context) []zap.Field

LoggerLabel 获取logger的traceID

func Middleware

func Middleware(serviceName string, tracerProvider trace.TracerProvider) gin.HandlerFunc

Middleware 链路追踪中间件

func NewWithConfig

func NewWithConfig(ctx context.Context, cfg *Config, opts ...Option) (trace.TracerProvider, error)

func RegisterExporter

func RegisterExporter(name string, f NewExporterFunc)

func SpanFromContext

func SpanFromContext(ctx context.Context) trace.Span

func Trace

func Trace(ctx context.Context, config *configs.Config) error

Trace 链路追踪组件,尽早注册,其他组件会判断是否存在,再进行使用

func TracerFromContext

func TracerFromContext(ctx context.Context) trace.Tracer

Types

type Config

type Config struct {
	// Sample 采样率 0-1 其它数字为跟随父配置
	Sample   float64           `yaml:"sample"`
	Endpoint string            `yaml:"endpoint"`
	UseSSL   bool              `yaml:"useSSL"`
	Type     string            `yaml:"type"`
	Header   map[string]string `yaml:"header"`
}

type NewExporterFunc

type NewExporterFunc func(ctx context.Context, config *Config) (tracesdk.SpanExporter, error)

type Option

type Option func(*Options)

func AppendAttributes

func AppendAttributes(attrs ...attribute.KeyValue) Option

type Options

type Options struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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