otel

package
v1.0.12531-788f040 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package otel contains an o11y.Provider that emits open telemetry gRPC. N.B. This has not been tried against a production collector, so we need to try it out on a safe / non production traffic service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(conf Config) (o11y.Provider, error)

Types

type Annotator

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

Annotator is a SpanProcessor that adds attributes to all started spans.

func (Annotator) ForceFlush

func (a Annotator) ForceFlush(context.Context) error

func (Annotator) OnEnd

func (a Annotator) OnEnd(s sdktrace.ReadOnlySpan)

func (Annotator) OnStart

func (Annotator) Shutdown

func (a Annotator) Shutdown(context.Context) error

type Config

type Config struct {
	Dataset         string
	GrpcHostAndPort string

	// HTTPTracesURL configures a host for exporting traces to http[s]://host[:port][/path]
	HTTPTracesURL string

	// HTTPAuthorization is the authorization token to send with http requests
	HTTPAuthorization secret.String

	ResourceAttributes []attribute.KeyValue

	SampleTraces  bool
	SampleKeyFunc func(map[string]any) string
	SampleRates   map[string]uint

	// DisableText prevents output to stdout for noisy services. Ignored if no other no hosts are supplied
	DisableText bool

	Test bool

	Writer  io.Writer
	Metrics o11y.ClosableMetricsProvider
}

type Provider

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

func (Provider) AddField

func (o Provider) AddField(ctx context.Context, key string, val any)

func (Provider) AddFieldToTrace

func (o Provider) AddFieldToTrace(ctx context.Context, key string, val any)

func (Provider) AddGlobalField

func (o Provider) AddGlobalField(key string, val any)

func (Provider) Close

func (o Provider) Close(ctx context.Context)

func (Provider) EndGoldenTrace

func (o Provider) EndGoldenTrace(ctx context.Context)

func (Provider) GetSpan

func (o Provider) GetSpan(ctx context.Context) o11y.Span

GetSpan returns the active span in the given context. It will return nil if there is no span available.

func (Provider) Helpers

func (o Provider) Helpers(disableW3c ...bool) o11y.Helpers

func (Provider) Log

func (o Provider) Log(ctx context.Context, name string, fields ...o11y.Pair)

func (Provider) MakeSpanGolden

func (o Provider) MakeSpanGolden(ctx context.Context)

func (Provider) MetricsProvider

func (o Provider) MetricsProvider() o11y.MetricsProvider

func (*Provider) RawProvider

func (o *Provider) RawProvider() *Provider

RawProvider satisfies an interface the helpers need

func (Provider) StartGoldenSpan

func (o Provider) StartGoldenSpan(ctx context.Context, name string, opts ...o11y.SpanOpt) (context.Context, o11y.Span)

func (Provider) StartGoldenTrace

func (o Provider) StartGoldenTrace(ctx context.Context, name string) context.Context

func (Provider) StartSpan

func (o Provider) StartSpan(ctx context.Context, name string, opts ...o11y.SpanOpt) (context.Context, o11y.Span)

Directories

Path Synopsis
Package texttrace is a span exporter for otel that outputs to the ex text console format
Package texttrace is a span exporter for otel that outputs to the ex text console format

Jump to

Keyboard shortcuts

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