telemetry

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNilConfig = errors.New("config is nil")

ErrNilConfig is returned if Init is called on a nil Config

Functions

This section is empty.

Types

type InmemSink

type InmemSink struct {
	Interval int
	Retain   int
}

InmemSink represents inmem sink configuration

func (*InmemSink) Finalize

func (i *InmemSink) Finalize() error

Just returns nil

func (*InmemSink) Init

func (i *InmemSink) Init() (metrics.MetricSink, error)

Creates a new inmem sink from config and registers DefaultInmemSignal signal (SIGUSR1)

type PrometheusSink

type PrometheusSink struct {
	Addr       string
	Expiration int
	// contains filtered or unexported fields
}

PrometheusSink represents prometheus sink and prometheus stats endpoint configuration

func (*PrometheusSink) Finalize

func (p *PrometheusSink) Finalize() error

Unregisters prometheus sink and stops prometheus stats endpoint

func (*PrometheusSink) Init

func (p *PrometheusSink) Init() (metrics.MetricSink, error)

Creates a new prometheus sink from config and starts a goroutine with prometheus stats endpoint

type Sink

type Sink interface {
	Init() (metrics.MetricSink, error)
	Finalize() error
}

Every sink should implement this interface

type Sinks

type Sinks struct {
	Inmem      *InmemSink
	Statsd     *StatsdSink
	Statsite   *StatsiteSink
	Prometheus *PrometheusSink
}

Sinks represent sinks configuration

func (*Sinks) GetSinks

func (c *Sinks) GetSinks() []Sink

GetSinks returns a slice with all Sinks for easy iteration.

type StatsdSink

type StatsdSink struct {
	Addr string
}

StatsdSink represents statsd sink configuration

func (*StatsdSink) Finalize

func (s *StatsdSink) Finalize() error

Just returns nil

func (*StatsdSink) Init

func (s *StatsdSink) Init() (metrics.MetricSink, error)

Creates a new statsd sink from config

type StatsiteSink

type StatsiteSink struct {
	Addr string
}

StatsiteSink represents statsite sink configuration

func (*StatsiteSink) Finalize

func (s *StatsiteSink) Finalize() error

Just returns nil

func (*StatsiteSink) Init

func (s *StatsiteSink) Init() (metrics.MetricSink, error)

Creates a new statsite sink from config

type Telemetry

type Telemetry struct {
	Enabled              bool
	ServiceName          string `toml:"service_name"`
	HostName             string
	EnableHostname       bool `toml:"enable_hostname"`
	EnableHostnameLabel  bool `toml:"enable_hostname_label"`
	EnableRuntimeMetrics bool `toml:"enable_runtime_metrics"`
	Sinks                Sinks
}

Telemetry represents telemetry configuration

func (Telemetry) Init

func (t Telemetry) Init() (*metrics.Metrics, error)

Configures metrics and adds FanoutSink with all configured sinks

func (Telemetry) Stop

func (t Telemetry) Stop() error

Finalizes all configured sinks

Jump to

Keyboard shortcuts

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