trace

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSignal os.Signal = syscall.SIGTERM

var DefaultSignal os.Signal = syscall.SIGUSR1

Functions

func Init

func Init()

func NewJaegerFileReporter

func NewJaegerFileReporter(name string, opts ...JaegerReporterOption) jaeger.Reporter

NewFileReporter returns a new file Reporter.

func NewJaegerTracer

func NewJaegerTracer(serviceName, traceFileName string, samplingRate float64, sig os.Signal, bufferSize int, options ...jaeger.TracerOption) (opentracing.Tracer, io.Closer, error)

NewJaegerTracer构造返回一个opentracing.Tracer。采样率小于0会被修正为0; 修正后的采样率 大于1,使用限速采样,每秒最多采样指定数量的trace; 修正后的采样率介于0和1之间则使用概率采样。

Types

type DefaultThrottler

type DefaultThrottler struct{}

DefaultThrottler doesn't throttle at all.

func (DefaultThrottler) IsAllowed

func (t DefaultThrottler) IsAllowed(operation string) bool

IsAllowed implements Throttler#IsAllowed.

type Field

type Field struct {
	Key     string   `json:"key"`
	VType   string   `json:"vType"`
	VStr    *string  `json:"vStr,omitempty"`
	VDouble *float64 `json:"vDouble,omitempty"`
	VBool   *bool    `json:"vBool,omitempty"`
	VLong   *int64   `json:"vLong,omitempty"`
	VBinary []byte   `json:"vBinary,omitempty"`
}

type JaegerReporterOption

type JaegerReporterOption func(r *jaegerFileReporter)

JaegerReporterOption sets a parameter for the HTTP Reporter

func JaegerBufferSize

func JaegerBufferSize(size int) JaegerReporterOption

func JaegerReopenSignal

func JaegerReopenSignal(sig os.Signal) JaegerReporterOption

type LocalSpan

type LocalSpan map[string]interface{}

func BuildSpan

func BuildSpan(span *jaeger.Span) LocalSpan

func NewSpan

func NewSpan() LocalSpan

func (LocalSpan) Set

func (s LocalSpan) Set(key string, value interface{})

func (LocalSpan) SetHostname

func (s LocalSpan) SetHostname(hostname string)

func (LocalSpan) SetIP

func (s LocalSpan) SetIP(ip string)

func (LocalSpan) SetOperationName

func (s LocalSpan) SetOperationName(operationName string)

func (LocalSpan) SetParentSpanID

func (s LocalSpan) SetParentSpanID(parentSpanID int64)

func (LocalSpan) SetServiceName

func (s LocalSpan) SetServiceName(serviceName string)

func (LocalSpan) SetSpanID

func (s LocalSpan) SetSpanID(spanID int64)

func (LocalSpan) SetTag

func (s LocalSpan) SetTag(key string, value string)

func (LocalSpan) SetTraceID

func (s LocalSpan) SetTraceID(traceIDHigh, traceIDLow int64)

type Log

type Log struct {
	Timestamp string   `json:"timestamp"`
	Fields    []*Field `json:"fields"`
}

type ProbabilisticSampler

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

ProbabilisticSampler is a sampler that randomly samples a certain percentage of traces.

func NewProbabilisticSampler

func NewProbabilisticSampler(samplingRate float64) *ProbabilisticSampler

NewProbabilisticSampler creates a sampler that randomly samples a certain percentage of traces specified by the samplingRate, in the range between 0.0 and 1.0.

It relies on the fact that new trace IDs are 63bit random numbers themselves, thus making the sampling decision without generating a new random number, but simply calculating if traceID < (samplingRate * 2^63).

func (*ProbabilisticSampler) Close

func (s *ProbabilisticSampler) Close()

Close implements Close() of Sampler.

func (*ProbabilisticSampler) Equal

func (s *ProbabilisticSampler) Equal(other jaeger.Sampler) bool

Equal implements Equal() of Sampler.

func (*ProbabilisticSampler) IsSampled

func (s *ProbabilisticSampler) IsSampled(id jaeger.TraceID, operation string) (bool, []jaeger.Tag)

IsSampled implements IsSampled() of Sampler.

func (*ProbabilisticSampler) SamplingRate

func (s *ProbabilisticSampler) SamplingRate() float64

SamplingRate returns the sampling probability this sampled was constructed with.

Jump to

Keyboard shortcuts

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