tracing

package module
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: MIT Imports: 20 Imported by: 3

README

tracing

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidConfiguration = errors.New("invalid configuration")

Functions

func EnablePrometheusMetrics added in v0.13.0

func EnablePrometheusMetrics() error

func InjectHeaders

func InjectHeaders(ctx context.Context, carrier http.Header)

func InjectMap

func InjectMap(ctx context.Context, carrier map[string]string)

func SpanFromContext

func SpanFromContext(ctx context.Context) trace.Span

Types

type Configuration added in v0.15.0

type Configuration struct {
	ServiceName string
	Addr        string
	Disabled    bool

	Sampler              tracesdk.Sampler
	Attributes           []attribute.KeyValue
	SpanProcessorOptions []tracesdk.BatchSpanProcessorOption
}

func DefaultConfiguration

func DefaultConfiguration(service, addr string) *Configuration

type Span

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

func ChildSpan

func ChildSpan(ctx *context.Context) (s *Span)

func (*Span) AddEvent added in v0.15.0

func (s *Span) AddEvent(name string, options ...trace.EventOption)

AddEvent adds an event with the provided name and options.

func (*Span) End added in v0.15.0

func (s *Span) End(options ...trace.SpanEndOption)

End completes the Span. The Span is considered complete and ready to be delivered through the rest of the telemetry pipeline after this method is called. Therefore, updates to the Span are not allowed after this method has been called.

func (*Span) Finish

func (s *Span) Finish()

Finish is alias of End function.

func (*Span) IsRecording added in v0.15.0

func (s *Span) IsRecording() bool

IsRecording returns the recording state of the Span. It will return true if the Span is active and events can be recorded.

func (*Span) RecordError added in v0.15.0

func (s *Span) RecordError(err error, options ...trace.EventOption)

RecordError will record err as an exception span event for this span. An additional call to SetStatus is required if the Status of the Span should be set to Error, as this method does not change the Span status. If this span is not being recorded or err is nil then this method does nothing.

func (*Span) SetAttributes added in v0.15.0

func (s *Span) SetAttributes(kv ...attribute.KeyValue)

SetAttributes sets kv as attributes of the Span. If a key from kv already exists for an attribute of the Span it will be overwritten with the value contained in kv.

func (*Span) SetName added in v0.15.0

func (s *Span) SetName(name string)

SetName sets the Span name.

func (*Span) SetStatus added in v0.15.0

func (s *Span) SetStatus(code codes.Code, description string)

SetStatus sets the status of the Span in the form of a code and a description, overriding previous values set. The description is only included in a status when the code is for an error.

func (*Span) SetTag

func (s *Span) SetTag(key string, value interface{}) *Span

func (*Span) SpanContext added in v0.15.0

func (s *Span) SpanContext() trace.SpanContext

SpanContext returns the SpanContext of the Span. The returned SpanContext is usable even after the End method has been called for the Span.

func (*Span) TracerProvider added in v0.15.0

func (s *Span) TracerProvider() trace.TracerProvider

TracerProvider returns a TracerProvider that can be used to generate additional Spans on the same telemetry pipeline as the current Span.

type SpanBuilder

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

func (SpanBuilder) ExtractHeaders

func (b SpanBuilder) ExtractHeaders(carrier http.Header) SpanBuilder

func (SpanBuilder) ExtractMap

func (b SpanBuilder) ExtractMap(carrier map[string]string) SpanBuilder

func (SpanBuilder) Start added in v0.15.0

func (b SpanBuilder) Start(ctx context.Context) *Span

func (SpanBuilder) StartWithContext added in v0.15.0

func (b SpanBuilder) StartWithContext(ctx context.Context) (context.Context, *Span)

func (SpanBuilder) WithName

func (b SpanBuilder) WithName(name string) SpanBuilder

type Tracer

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

func NewTracer

func NewTracer(configuration *Configuration) (*Tracer, error)

func (*Tracer) Close

func (c *Tracer) Close() error

func (*Tracer) NewSpan

func (c *Tracer) NewSpan() SpanBuilder

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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