telemetry

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MPL-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const CQTeamID = "12345678-0000-0000-0000-c1a0dbeef000"

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 HashAttribute added in v0.17.4

func HashAttribute(value string) string

HashAttribute creates a one-way hash from an attribute

func IsCI added in v0.17.4

func IsCI() bool

IsCI determines if we're running under a CI env by checking CI-specific env vars

func IsFaaS added in v0.17.4

func IsFaaS() bool

IsFaaS determines if we're running under a Lambda env by checking Lambda-specific env vars

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 trace.Span, err error, opts ...trace.EventOption) bool

RecordError should be called on a span to mark it as errored. Returns true if err was recorded.

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) Enabled added in v0.19.2

func (c *Client) Enabled() bool

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) RandomId added in v0.18.0

func (c *Client) RandomId() string

RandomId returns the generated ID

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) bool

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