tracing

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const (
	TraceID      = "x-b3-traceid"
	SpanID       = "x-b3-spanid"
	ParentSpanID = "x-b3-parentspanid"
	Sampled      = "x-b3-sampled"
	Flags        = "x-b3-flags"
	Context      = "b3"
)

Default B3 Header keys

Variables

This section is empty.

Functions

func SetProvider

func SetProvider(opts ...Option)

SetProvider set otel global provider

Types

type Annotation

type Annotation struct {
	Timestamp int64
	Value     string
}

Annotation associates an event that explains latency with a timestamp.

type ClientHandler

type ClientHandler struct {
}

func (*ClientHandler) HandleConn

func (c *ClientHandler) HandleConn(ctx context.Context, cs 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 Endpoint

type Endpoint struct {
	ServiceName string `json:"serviceName,omitempty"`
	IPv4        string `json:"ipv4,omitempty"`
	IPv6        string `json:"ipv6,omitempty"`
	Port        uint16 `json:"port,omitempty"`
}

Endpoint holds the network context of a node in the service graph.

type Exporter

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

func (*Exporter) ExportSpans

func (e *Exporter) ExportSpans(ctx context.Context, ss []tracesdk.ReadOnlySpan) error

func (*Exporter) Shutdown

func (e *Exporter) Shutdown(ctx context.Context) error

type Option

type Option func(*options)

Option is tracing option.

func WithResource

func WithResource(r *resource.Resource) Option

WithResource with tracer resource.

func WithSampleRatio

func WithSampleRatio(sampleRatio float64) Option

WithSampleRatio samples a given fraction of traces. Fractions >= 1 will always sample. Fractions < 0 are treated as zero. To respect the parent trace's `SampledFlag`, the `TraceIDRatioBased` sampler should be used as a delegate of a `Parent` sampler.

func WithTracerExporter

func WithTracerExporter(exporter tracesdk.SpanExporter) Option

WithTracerExporter with tracer exporter.

type Span

type Span struct {
	TraceID  string `json:"traceId"`
	ID       string `json:"id"`
	ParentID string `json:"parentId,omitempty"`
	Debug    bool   `json:"debug,omitempty"`

	Kind           string            `json:"kind,omitempty"`
	Name           string            `json:"name,omitempty"`
	Timestamp      int64             `json:"timestamp,omitempty"`
	Duration       int64             `json:"duration,omitempty"`
	Shared         bool              `json:"shared,omitempty"`
	LocalEndpoint  *Endpoint         `json:"localEndpoint,omitempty"`
	RemoteEndpoint *Endpoint         `json:"remoteEndpoint,omitempty"`
	Annotations    []Annotation      `json:"annotations,omitempty"`
	Tags           map[string]string `json:"tags,omitempty"`
}

Span is zipkin span model

type Tracer

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

Tracer is otel span tracer

func NewTracer

func NewTracer(kind trace.SpanKind) (*Tracer, error)

NewTracer create tracer instance

func (*Tracer) End

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

End finish tracing span

func (*Tracer) Start

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

Start start tracing span

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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