tracing

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetTracer

func SetTracer(tracer Tracer)

Types

type OTLPTracer

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

OTLPTracer is a tracer that uses OpenTelemetry to send traces to an OTLP collector

func NewOTLPTracer

func NewOTLPTracer(config *TracerConfig) (*OTLPTracer, error)

func NewTmpOLTPTracer

func NewTmpOLTPTracer() *OTLPTracer

func (*OTLPTracer) EndSpan

func (t *OTLPTracer) EndSpan(ctx context.Context)

func (*OTLPTracer) GetSpanID

func (t *OTLPTracer) GetSpanID(ctx context.Context) string

func (*OTLPTracer) GetTraceID

func (t *OTLPTracer) GetTraceID(ctx context.Context) string

func (*OTLPTracer) StartSpan

func (t *OTLPTracer) StartSpan(ctx context.Context, name string) context.Context

type Option

type Option func(f *TracerConfig)

func WithCollectorURL

func WithCollectorURL(CollectorURL string) Option

func WithEnabled

func WithEnabled(isEnabled bool) Option

func WithInsecure

func WithInsecure(isInsecure bool) Option

func WithProvider

func WithProvider(provider Provider) Option

func WithServiceName

func WithServiceName(serviceName string) Option

type Provider

type Provider string
const (
	Jaeger  Provider = "JEAGER"
	Datadog Provider = "DATADOG"
	OTLP    Provider = "OTLP"
)

type Tracer

type Tracer interface {
	StartSpan(ctx context.Context, name string) context.Context
	EndSpan(ctx context.Context)
	GetTraceID(ctx context.Context) string
	GetSpanID(ctx context.Context) string
}

Tracer is the interface for the tracer

func GetTracer

func GetTracer() Tracer

func TracerFactory

func TracerFactory(opts ...Option) (Tracer, error)

TracerFactory returns a tracer based on the type

type TracerConfig

type TracerConfig struct {
	Provider     Provider
	ServiceName  string
	CollectorURL string
	Insecure     bool
	Enabled      bool
}

TracerConfig is the configuration for the tracer

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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