tracer

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSpanID

func GetSpanID(ctx context.Context) string

GetSpanID get current span id

func GetTraceID

func GetTraceID(ctx context.Context) string

GetTraceID get active trace id

func New

func New(ServiceName string, opts ...OptionTracer)

func SetTracerPlatformType

func SetTracerPlatformType(t Platform)

SetTracerPlatformType function for set tracer platform

Types

type FinishOption

type FinishOption struct {
	Tags  map[string]interface{}
	Error error
}

FinishOption for an option when trace is finished

type FinishOptionFunc

type FinishOptionFunc func(*FinishOption)

FinishOptionFunc func

type OptionTracer

type OptionTracer func(t *optTracer)

func WithRatioSampler

func WithRatioSampler(ratio float64) OptionTracer

func WithServiceInstanceId

func WithServiceInstanceId(instanceId string) OptionTracer

func WithServiceVersion

func WithServiceVersion(version string) OptionTracer

func WithTracerAgentHost

func WithTracerAgentHost(uri string) OptionTracer

func WithTracerAgentPlatform

func WithTracerAgentPlatform(exporterPlatform PlatformType) OptionTracer

func WithTracerServiceName

func WithTracerServiceName(name string) OptionTracer

func WithTracerTLS

func WithTracerTLS(tls *tls.Config) OptionTracer

type Platform

type Platform interface {
	Start(ctx context.Context, operationName string) Tracer
	GetTraceID(ctx context.Context) string
	GetSpanID(ctx context.Context) string
}

Platform defines the tracing platform

type PlatformType

type PlatformType string
const (
	// Open-Telemetry Collector
	OTLP PlatformType = "otlp"
)

type Tracer

type Tracer interface {
	Context() context.Context
	NewContext() context.Context
	Tags() map[string]interface{}
	SetTag(key string, value interface{})
	Log(key string, value interface{})
	SetError(err error)
	Finish(opts ...FinishOptionFunc)
}

func StartTrace

func StartTrace(ctx context.Context, operationName string) Tracer

StartTrace starting trace child span from parent span

func StartTraceWithContext

func StartTraceWithContext(ctx context.Context, operationName string) (Tracer, context.Context)

StartTraceWithContext starting trace child span from parent span with context

Jump to

Keyboard shortcuts

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