tracing

package
v0.0.0-...-339b0c3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(opts ...Option) middleware.Middleware

Client returns a new client middleware for OpenTelemetry.

func Server

func Server(opts ...Option) middleware.Middleware

Server returns a new server middleware for OpenTelemetry.

func SpanID

func SpanID() log.Valuer

SpanID returns a spanid valuer.

func TraceID

func TraceID() log.Valuer

TraceID returns a traceid valuer.

Types

type ClientHandler

type ClientHandler struct{}

ClientHandler is tracing ClientHandler

func (*ClientHandler) HandleConn

func (c *ClientHandler) HandleConn(_ context.Context, _ stats.ConnStats)

HandleConn exists to satisfy gRPC stats.Handler.

func (*ClientHandler) HandleRPC

func (c *ClientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats)

HandleRPC implements per-RPC tracing and stats instrumentation.

func (*ClientHandler) TagConn

TagConn exists to satisfy gRPC stats.Handler.

func (*ClientHandler) TagRPC

TagRPC implements per-RPC context management.

type Metadata

type Metadata struct{}

Metadata is tracing metadata propagator

func (Metadata) Extract

func (b Metadata) Extract(parent context.Context, carrier propagation.TextMapCarrier) context.Context

Extract returns a copy of parent with the metadata from the carrier added.

func (Metadata) Fields

func (b Metadata) Fields() []string

Fields returns the keys who's values are set with Inject.

func (Metadata) Inject

func (b Metadata) Inject(ctx context.Context, carrier propagation.TextMapCarrier)

Inject sets metadata key-values from ctx into the carrier.

type Option

type Option func(*options)

Option is tracing option.

func WithPropagator

func WithPropagator(propagator propagation.TextMapPropagator) Option

WithPropagator with tracer propagator.

func WithTracerName

func WithTracerName(tracerName string) Option

WithTracerName with tracer name

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider with tracer provider. By default, it uses the global provider that is set by otel.SetTracerProvider(provider).

type Tracer

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

Tracer is otel span tracer

func NewTracer

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

NewTracer create tracer instance

func (*Tracer) End

func (t *Tracer) End(_ context.Context, span trace.Span, m interface{}, err error)

End finish tracing span

func (*Tracer) Start

func (t *Tracer) Start(ctx context.Context, operation string, carrier propagation.TextMapCarrier) (context.Context, trace.Span)

Start start tracing span

Jump to

Keyboard shortcuts

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