telemetry

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHandlerWrapper

func GetHandlerWrapper(m Metrics, log log.Logger) server.HandlerWrapper

GetHandlerWrapper wraps a HTTP server with the given Metrics instance. to collect telemetry for every request/response.

Types

type Config

type Config struct {
	HealthReportInterval time.Duration

	Datadog    datadog.Config
	Prometheus prometheus.Config
}

Config serves as a global telemetry configuration. Provide the required config for the desired telemetry backend(s).

type Metrics

type Metrics interface {
	Gauge(name string, value float64, tags []string, rate float64)

	Incr(name string, tags []string) // should be used if the metric can go up or down
	Decr(name string, tags []string) // should be used if the metric can go up or down

	Count(name string, value int64, tags []string)

	IncMonotonic(name string, tags []string) // should be used if the metric can go up only

	Error(errName string)

	Histogram(name string, value float64, tags []string, rate float64)

	Time(name string, value time.Duration, tags []string)
	Latency(jobName string, start time.Time, tags ...string)

	Close() error
}

Metrics are used to record telemetry data. The primary types of telemetry data supported are Gauges, Counters, and Histograms; the rest are convenience wrappers around these.

func NewMetrics

func NewMetrics(cfg *Config) (Metrics, error)

NewMetrics returns a new Metrics instance based on the given configuration. Enables only the telemetry backend(s) which is/are specified as enabled.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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