tracing

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWS

func AWS(config cfg.Config, c *client.Client)

func AddProvider

func AddProvider(name string, provider Provider)

func ContextTraceFieldsResolver

func ContextTraceFieldsResolver(ctx context.Context) map[string]interface{}

func ContextWithSpan

func ContextWithSpan(ctx context.Context, span Span) context.Context

func ContextWithTrace

func ContextWithTrace(ctx context.Context, trace *Trace) context.Context

func NewAwsTracerWithInterfaces

func NewAwsTracerWithInterfaces(logger log.Logger, appId cfg.AppId, settings *XRaySettings) (*awsTracer, error)

func TraceToString

func TraceToString(trace *Trace) string

Types

type ContextMissingWarnSamplingConfig

type ContextMissingWarnSamplingConfig struct {
	Enabled  bool
	Interval time.Duration
}

type ContextMissingWarnStrategy

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

func NewContextMissingWarningLogStrategy

func NewContextMissingWarningLogStrategy(logger log.Logger) *ContextMissingWarnStrategy

func (ContextMissingWarnStrategy) ContextMissing

func (c ContextMissingWarnStrategy) ContextMissing(v interface{})

type LoggerErrorHandler

type LoggerErrorHandler struct{}

func NewLoggerErrorHandler

func NewLoggerErrorHandler() *LoggerErrorHandler

func (*LoggerErrorHandler) Channels

func (h *LoggerErrorHandler) Channels() []string

func (*LoggerErrorHandler) Level

func (h *LoggerErrorHandler) Level() int

func (*LoggerErrorHandler) Log

func (h *LoggerErrorHandler) Log(_ time.Time, _ int, _ string, _ []interface{}, err error, data log.Data) error

type MessageWithTraceEncoder

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

func NewMessageWithTraceEncoder

func NewMessageWithTraceEncoder(strategy TraceIdErrorStrategy) *MessageWithTraceEncoder

func (MessageWithTraceEncoder) Decode

func (m MessageWithTraceEncoder) Decode(ctx context.Context, _ interface{}, attributes map[string]string) (context.Context, map[string]string, error)

func (MessageWithTraceEncoder) Encode

func (m MessageWithTraceEncoder) Encode(ctx context.Context, _ interface{}, attributes map[string]string) (context.Context, map[string]string, error)

type Provider

type Provider func(config cfg.Config, logger log.Logger) (Tracer, error)

type SampleRule

type SampleRule struct {
	Description string  `json:"description" cfg:"description" default:"default"`
	ServiceName string  `json:"service_name" cfg:"service_name"`
	HttpMethod  string  `json:"http_method" cfg:"http_method"`
	UrlPath     string  `json:"url_path" cfg:"url_path"`
	FixedTarget uint64  `json:"fixed_target" cfg:"fixed_target" default:"1"`
	Rate        float64 `json:"rate" cfg:"rate" default:"0.05"`
}

type SamplingConfiguration

type SamplingConfiguration struct {
	Version int          `json:"version" cfg:"version" default:"1"`
	Default SampleRule   `json:"default" cfg:"default"`
	Rules   []SampleRule `json:"rules" cfg:"rules"`
}

type Span

type Span interface {
	AddAnnotation(key string, value string)
	AddError(err error)
	AddMetadata(key string, value interface{})
	Finish()
	GetId() string
	GetTrace() *Trace
}

func GetSpanFromContext

func GetSpanFromContext(ctx context.Context) Span

type Trace

type Trace struct {
	TraceId  string `json:"traceId"`
	Id       string `json:"id"`
	ParentId string `json:"parentId"`
	Sampled  bool   `json:"sampled"`
}

func GetTraceFromContext

func GetTraceFromContext(ctx context.Context) *Trace

func StringToTrace

func StringToTrace(traceId string) (*Trace, error)

func (*Trace) GetId

func (t *Trace) GetId() string

func (*Trace) GetParentId

func (t *Trace) GetParentId() string

func (*Trace) GetSampled

func (t *Trace) GetSampled() bool

func (*Trace) GetTraceId

func (t *Trace) GetTraceId() string

type TraceAble

type TraceAble interface {
	GetTrace() *Trace
}

type TraceIdErrorReturnStrategy

type TraceIdErrorReturnStrategy struct{}

func (TraceIdErrorReturnStrategy) TraceIdInvalid

func (t TraceIdErrorReturnStrategy) TraceIdInvalid(err error) error

type TraceIdErrorStrategy

type TraceIdErrorStrategy interface {
	TraceIdInvalid(err error) error
}

type TraceIdErrorWarningStrategy

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

func NewTraceIdErrorWarningStrategy

func NewTraceIdErrorWarningStrategy(logger log.Logger) *TraceIdErrorWarningStrategy

func NewTraceIdErrorWarningStrategyWithInterfaces

func NewTraceIdErrorWarningStrategyWithInterfaces(logger log.Logger, stacktraceProvider log.StackTraceProvider) *TraceIdErrorWarningStrategy

func (TraceIdErrorWarningStrategy) TraceIdInvalid

func (t TraceIdErrorWarningStrategy) TraceIdInvalid(err error) error

type Tracer

type Tracer interface {
	HttpHandler(h http.Handler) http.Handler
	StartSpan(name string) (context.Context, Span)
	StartSpanFromContext(ctx context.Context, name string) (context.Context, Span)
	StartSubSpan(ctx context.Context, name string) (context.Context, Span)
}

func NewAwsTracer

func NewAwsTracer(config cfg.Config, logger log.Logger) (Tracer, error)

func NewNoopTracer

func NewNoopTracer() Tracer

func NewTracer

func NewTracer(config cfg.Config, logger log.Logger) (Tracer, error)

func ProvideTracer

func ProvideTracer(config cfg.Config, logger log.Logger) (Tracer, error)

type TracerSettings

type TracerSettings struct {
	Provider                    string                `cfg:"provider" default:"xray" validate:"required"`
	Enabled                     bool                  `cfg:"enabled" default:"false"`
	AddressType                 string                `cfg:"addr_type" default:"local" validate:"required"`
	AddressValue                string                `cfg:"add_value" default:""`
	Sampling                    SamplingConfiguration `cfg:"sampling"`
	StreamingMaxSubsegmentCount int                   `cfg:"streaming_max_subsegment_count" default:"20"`
}

type XRaySettings

type XRaySettings struct {
	Enabled                     bool
	Address                     string
	CtxMissingStrategy          ctxmissing.Strategy
	SamplingStrategy            sampling.Strategy
	StreamingMaxSubsegmentCount int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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