Documentation
¶
Overview ¶
Package telemetry provides a Prometheus client and the configuration for metrics collectors
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Port int `mapstructure:"port"`
Interfaces []interface{} `mapstructure:"interfaces"` // optional override
Tags []string `mapstructure:"tags"`
Metrics []interface{} `mapstructure:"metrics"`
// derived in Validate
MetricConfigs []*MetricConfig
JobConfig *jobs.Config
// contains filtered or unexported fields
}
Config represents the service to advertise for finding the metrics endpoint, and the collection of Metrics.
type Metric ¶
type Metric struct {
Name string
Type MetricType
events.Subscriber
// contains filtered or unexported fields
}
Metric manages state of periodic metrics.
func NewMetric ¶
func NewMetric(cfg *MetricConfig) *Metric
NewMetric creates a Metric from a validated MetricConfig
type MetricConfig ¶
type MetricConfig struct {
Namespace string `mapstructure:"namespace"`
Subsystem string `mapstructure:"subsystem"`
Name string `mapstructure:"name"`
Help string `mapstructure:"help"` // help string returned by API
Type string `mapstructure:"type"`
// contains filtered or unexported fields
}
A MetricConfig is a single measurement of the application.
func NewMetricConfigs ¶
func NewMetricConfigs(raw []interface{}) ([]*MetricConfig, error)
NewMetricConfigs creates new metrics from a raw config
func (*MetricConfig) Validate ¶
func (cfg *MetricConfig) Validate() error
Validate ensures Metric meets all requirements
type MetricType ¶
type MetricType int
MetricType is an enum for Prometheus metric types
const ( Counter MetricType = iota Gauge Histogram Summary )
MetricType enum
type Status ¶
type Status struct {
Version string
Jobs []*jobStatusResponse
Services []*serviceStatusResponse
Watches []string
// contains filtered or unexported fields
}
Status persists all the data the telemetry server needs to serve the '/status' endpoint
type StatusHandler ¶
type StatusHandler struct {
// contains filtered or unexported fields
}
StatusHandler implements http.Handler
func NewStatusHandler ¶
func NewStatusHandler(t *Telemetry) StatusHandler
NewStatusHandler constructs a StatusHandler with a pointer to the Telemetry server
func (StatusHandler) ServeHTTP ¶
func (sh StatusHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler for StatusHandler
type Telemetry ¶
type Telemetry struct {
Metrics []*Metric // supports '/metrics' endpoint fields
Status *Status // supports '/status' endpoint fields
http.Server
// contains filtered or unexported fields
}
Telemetry represents the service to advertise for finding the metrics endpoint, and the collection of Metrics.
func NewTelemetry ¶
NewTelemetry configures a new prometheus Telemetry server
func (*Telemetry) MonitorJobs ¶
MonitorJobs adds a list of Jobs for the /status handler to monitor
func (*Telemetry) MonitorWatches ¶
MonitorWatches adds a list of Watches for the /status handler to monitor