tracing

package
v0.0.0-...-a99f43a Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExporterZipkin   = "zipkin"
	ExporterJaeger   = "jaeger" // jaeger exporter is no longer supported, please use otlp-http or otlp-grpc replace it
	ExporterOtlpHttp = "otlp-http"
	ExporterOtlpGrpc = "otlp-grpc"
	ExporterStdout   = "stdout"
)

Variables

This section is empty.

Functions

func NewExporter

func NewExporter(exporterName, endpoint string, insecure bool) (traceSdk.SpanExporter, error)

NewExporter 创建一个导出器,支持:zipkin、otlp-http、otlp-grpc

func NewOtlpGrpcExporter

func NewOtlpGrpcExporter(ctx context.Context, endpoint string, insecure bool, options ...otlptracegrpc.Option) (traceSdk.SpanExporter, error)

NewOtlpGrpcExporter 创建OTLP/gRPC导出器,默认端口:4317

func NewOtlpHttpExporter

func NewOtlpHttpExporter(ctx context.Context, endpoint string, insecure bool, options ...otlptracehttp.Option) (traceSdk.SpanExporter, error)

NewOtlpHttpExporter 创建OTLP/HTTP导出器,默认端口:4318

func NewTracerProvider

func NewTracerProvider(exporterName, endpoint, serviceName, instanceId, version string, sampler float64) *traceSdk.TracerProvider

NewTracerProvider 创建一个链路追踪器

func NewZipkinExporter

func NewZipkinExporter(_ context.Context, endpoint string) (traceSdk.SpanExporter, error)

NewZipkinExporter 创建一个zipkin导出器,默认对端地址:http://localhost:9411/api/v2/spans

Types

type Option

type Option func(*options)

func WithGlobalPropagator

func WithGlobalPropagator() Option

func WithGlobalTracerProvider

func WithGlobalTracerProvider() Option

func WithPropagator

func WithPropagator(propagator propagation.TextMapPropagator) Option

func WithTracerName

func WithTracerName(tracerName string) Option

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

type Tracer

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

func NewTracer

func NewTracer(kind trace.SpanKind, spanName string, opts ...Option) *Tracer

func (*Tracer) End

func (t *Tracer) End(ctx context.Context, span trace.Span, err error, attrs ...attribute.KeyValue)

func (*Tracer) Inject

func (t *Tracer) Inject(ctx context.Context, carrier propagation.TextMapCarrier)

func (*Tracer) Start

Jump to

Keyboard shortcuts

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