telemetry

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: Apache-2.0 Imports: 39 Imported by: 0

README

This package was copied from Lightstep's OpenTelemetry Go Launcher. It was modified as follows:

  • Use of go-kit/log logging API for consistency with this code base
  • Remove the use of environment variables, as this code base prefers configuration files
  • Remove Lightstep-specific functionality
  • Standard log package and gRPC logging integration.

Documentation

Index

Constants

View Source
const (
	// Note: These are duplicated from ../config, to avoid package cycles.
	DefaultExportTimeout   = time.Second * 60
	DefaultReportingPeriod = time.Second * 30
)

Variables

This section is empty.

Functions

func ContextWithSIGTERM

func ContextWithSIGTERM(logger log.Logger) (context.Context, context.CancelFunc)

ContextWithSIGTERM returns a context that will be cancelled on SIGTERM.

func DefaultLogger

func DefaultLogger(opts ...level.Option) log.Logger

func SetVerboseLevel

func SetVerboseLevel(level int)

func StaticLogger

func StaticLogger() log.Logger

func StaticSetup

func StaticSetup(logger log.Logger)

func VerboseLevel

func VerboseLevel() int

Types

type Config

type Config struct {
	SpanExporterEndpoint            string
	SpanExporterEndpointInsecure    bool
	MetricsExporterEndpoint         string
	MetricsExporterEndpointInsecure bool

	Propagators           []string
	MetricReportingPeriod time.Duration
	ResourceAttributes    map[string]string
	Headers               map[string]string
	ExportTimeout         time.Duration

	Compressor string
	// contains filtered or unexported fields
}

type Counter

type Counter metric.Int64Counter

func NewCounter

func NewCounter(name, desc string) Counter

func (Counter) Add

func (c Counter) Add(ctx context.Context, cnt int64, err *error, kvs ...attribute.KeyValue)

type Option

type Option func(*Config)

func WithCompressor

func WithCompressor(compressor string) Option

func WithExportTimeout

func WithExportTimeout(t time.Duration) Option

WithExportTimeout configures the timeout used for Export().

func WithHeaders

func WithHeaders(headers map[string]string) Option

func WithLogger

func WithLogger(logger log.Logger) Option

func WithMetricReportingPeriod

func WithMetricReportingPeriod(p time.Duration) Option

WithMetricReportingPeriod configures the metric reporting period, how often the controller collects and exports metric data.

func WithMetricsExporterEndpoint

func WithMetricsExporterEndpoint(url string) Option

WithMetricsExporterEndpoint configures the endpoint for sending metricss via OTLP

func WithMetricsExporterInsecure

func WithMetricsExporterInsecure(insecure bool) Option

WithMetricsExporterInsecure permits connecting to the trace endpoint without a certificate

func WithPropagators

func WithPropagators(propagators ...string) Option

WithPropagators configures propagators

func WithResourceAttributes

func WithResourceAttributes(attributes map[string]string) Option

WithResourceAttributes configures attributes on the resource

func WithSpanExporterEndpoint

func WithSpanExporterEndpoint(url string) Option

WithSpanExporterEndpoint configures the endpoint for sending spans via OTLP

func WithSpanExporterInsecure

func WithSpanExporterInsecure(insecure bool) Option

WithSpanExporterInsecure permits connecting to the trace endpoint without a certificate

type Telemetry

type Telemetry struct {
	*controller.Controller
	// contains filtered or unexported fields
}

func ConfigureOpentelemetry

func ConfigureOpentelemetry(opts ...Option) *Telemetry

func InternalOnly

func InternalOnly() *Telemetry

func (*Telemetry) Shutdown

func (tel *Telemetry) Shutdown(ctx context.Context)

type Timer

Timer is a simple instrument for measuring a section of code, a kind of light-weight span that outputs a ValueRecorder of its duration.

func NewTimer

func NewTimer(name, desc string) Timer

func (Timer) Start

func (t Timer) Start(ctx context.Context) Timing

type Timing

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

func (Timing) Stop

func (t Timing) Stop(err *error, kvs ...attribute.KeyValue)

Directories

Path Synopsis
cmd
package doevery provides primitives for per-call-site rate-limiting.
package doevery provides primitives for per-call-site rate-limiting.

Jump to

Keyboard shortcuts

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