tracer

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TraceCfgKey = "$$tracer_cfg"
)

Variables

This section is empty.

Functions

func GetTraceIDListByRuleID

func GetTraceIDListByRuleID(ruleID string, limit int64) ([]string, error)

func GetTracer

func GetTracer() trace.Tracer

func InitTracer

func InitTracer() error

func SetTracer

func SetTracer(config *TracerConfig) error

Types

type GlobalTracerManager

type GlobalTracerManager struct {
	sync.RWMutex
	Init                 bool
	ServiceName          string
	EnableRemoteEndpoint bool
	RemoteEndpoint       string
	SpanExporter         *SpanExporter
}

func (*GlobalTracerManager) GetTraceById

func (g *GlobalTracerManager) GetTraceById(traceID string) (root *LocalSpan, err error)

func (*GlobalTracerManager) GetTraceByRuleID

func (g *GlobalTracerManager) GetTraceByRuleID(ruleID string, limit int64) ([]string, error)

func (*GlobalTracerManager) InitIfNot

func (g *GlobalTracerManager) InitIfNot()

func (*GlobalTracerManager) SetTracer

func (g *GlobalTracerManager) SetTracer(enableRemote bool, serviceName, endpoint string) error
type LocalLink struct {
	TraceID string `yaml:"traceID"`
}

type LocalSpan

type LocalSpan struct {
	Name         string                 `json:"name"`
	TraceID      string                 `json:"traceID"`
	SpanID       string                 `json:"spanID"`
	ParentSpanID string                 `json:"parentSpanID,omitempty"`
	Attribute    map[string]interface{} `json:"attribute,omitempty"`
	Links        []LocalLink            `json:"links,omitempty"`
	StartTime    time.Time              `json:"startTime"`
	EndTime      time.Time              `json:"endTime"`
	RuleID       string                 `json:"ruleID"`

	ChildSpan []*LocalSpan
}

func FromReadonlySpan

func FromReadonlySpan(readonly sdktrace.ReadOnlySpan) *LocalSpan

func GetSpanByTraceID

func GetSpanByTraceID(traceID string) (root *LocalSpan, err error)

func (*LocalSpan) ToBytes

func (span *LocalSpan) ToBytes() ([]byte, error)

type LocalSpanMemoryStorage

type LocalSpanMemoryStorage struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*LocalSpanMemoryStorage) GetTraceById

func (l *LocalSpanMemoryStorage) GetTraceById(traceID string) (*LocalSpan, error)

func (*LocalSpanMemoryStorage) GetTraceByRuleID

func (l *LocalSpanMemoryStorage) GetTraceByRuleID(ruleID string, limit int64) ([]string, error)

func (*LocalSpanMemoryStorage) SaveSpan

type LocalSpanStorage

type LocalSpanStorage interface {
	SaveSpan(span sdktrace.ReadOnlySpan) error
	GetTraceById(traceID string) (*LocalSpan, error)
	GetTraceByRuleID(ruleID string, limit int64) ([]string, error)
}

type Queue

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

Queue is traceID FIFO queue with sized capacity

func NewQueue

func NewQueue(capacity int) *Queue

func (*Queue) Dequeue

func (q *Queue) Dequeue() string

func (*Queue) Enqueue

func (q *Queue) Enqueue(item *LocalSpan) string

func (*Queue) Len

func (q *Queue) Len() int

type SpanExporter

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

func NewSpanExporter

func NewSpanExporter(remoteCollector bool, remoteEndpoint string) (*SpanExporter, error)

func (*SpanExporter) ExportSpans

func (l *SpanExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error

func (*SpanExporter) GetTraceById

func (l *SpanExporter) GetTraceById(traceID string) (*LocalSpan, error)

func (*SpanExporter) GetTraceByRuleID

func (l *SpanExporter) GetTraceByRuleID(ruleID string, limit int64) ([]string, error)

func (*SpanExporter) Shutdown

func (l *SpanExporter) Shutdown(ctx context.Context) error

type TracerConfig

type TracerConfig struct {
	EnableRemoteCollector bool   `json:"enableRemoteCollector"`
	ServiceName           string `json:"serviceName"`
	RemoteEndpoint        string `json:"remoteEndpoint"`
}

func TracerConfigFromConf

func TracerConfigFromConf() *TracerConfig

Jump to

Keyboard shortcuts

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