telemetry

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithTracer added in v0.17.0

func ContextWithTracer(parent context.Context, tracer Tracer) context.Context

ContextWithTracer returns a copy of given context with tracer set as the current Tracer.

func MapToAttributes added in v0.17.0

func MapToAttributes(m map[string]int64) []attribute.KeyValue

func RecordError added in v0.17.0

func RecordError(span otrace.Span, err error, opts ...otrace.EventOption)

RecordError should be called on a span to mark it as errored. By default error values are not recorded, unless the debug flag is set.

Types

type Client

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

Client is the telemetry client.

func New

func New(ctx context.Context, options ...Option) *Client

func (*Client) HasError

func (c *Client) HasError() error

func (*Client) NewRandomId

func (c *Client) NewRandomId() bool

NewRandomId returns true if we created a new random id in this session

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context)

func (*Client) Tracer

func (c *Client) Tracer(ctx context.Context) (context.Context, Tracer)

type Option

type Option func(*Client)

func WithDebug

func WithDebug() Option

func WithDisabled

func WithDisabled() Option

func WithEndpoint

func WithEndpoint(endpoint string, insecure bool) Option

func WithExporter

func WithExporter(w io.WriteCloser) Option

func WithFS

func WithFS(fs afero.Fs) Option

func WithLogger

func WithLogger(logger hclog.Logger) Option

func WithResource

func WithResource(res *resource.Resource) Option

func WithVersionInfo

func WithVersionInfo(version, commit, buildDate string) Option

type SpanCloser added in v0.17.0

type SpanCloser func(error, ...otrace.SpanEndOption)

SpanCloser gets an error and options and ends the span its attached to

func StartSpanFromContext added in v0.17.0

func StartSpanFromContext(ctx context.Context, spanName string, opts ...otrace.SpanStartOption) (context.Context, SpanCloser)

StartSpanFromContext starts the span from a given context with the given options, and returns a new context with span attached, as well as a closer fn. Returned SpanCloser should be called when done with span. To catch panics, it should be used under a defer.

type Tracer added in v0.17.0

type Tracer interface {
	otrace.Tracer
}

func TracerFromContext added in v0.17.0

func TracerFromContext(ctx context.Context) Tracer

TracerFromContext returns the current Tracer from ctx.

If no Tracer is currently set in ctx, a noopTracer is returned.

Jump to

Keyboard shortcuts

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