metrics

package
v0.5.2-0...-d95c312 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package metrics handles metrics.

This is a wrapper around Code Hale's Metrics library. It also setups the supported exporters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(config PromPushGWConfiguration) (*http.Client, error)

NewHTTPClient creates an HTTP client for a given config.

Types

type CollectdConfiguration

type CollectdConfiguration struct {
	Connect  config.Addr
	Interval config.Duration
	Exclude  []string
}

CollectdConfiguration represents the configuration for exporting metrics to collectd

func (*CollectdConfiguration) UnmarshalYAML

func (c *CollectdConfiguration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML parses a configuration for collectd from YAML.

type Configuration

type Configuration []ExporterConfiguration

Configuration is a list list of exporter configurations. However, we have several kind of exporters.

func (*Configuration) UnmarshalYAML

func (c *Configuration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML parses configuration for the metrics subsystem from YAML.

type ExporterConfiguration

type ExporterConfiguration interface {
	UnmarshalYAML(f func(interface{}) error) error
	// contains filtered or unexported methods
}

ExporterConfiguration is an interface for the configuration for an exporter.

type ExpvarConfiguration

type ExpvarConfiguration struct {
	Listen config.Addr
}

ExpvarConfiguration is the configuration for exporting metrics to expvar.

func (*ExpvarConfiguration) UnmarshalYAML

func (c *ExpvarConfiguration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML parses a configuration from YAML.

type FileConfiguration

type FileConfiguration struct {
	Path     config.FilePath
	Interval config.Duration
}

FileConfiguration is the configuration for exporting metrics to files.

func (*FileConfiguration) UnmarshalYAML

func (c *FileConfiguration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML parses the configuration from YAML.

type Metrics

type Metrics struct {
	Registry metrics.Registry
	// contains filtered or unexported fields
}

Metrics represents the internal state of the metric subsystem.

func New

func New(configuration Configuration, prefix string) (*Metrics, error)

New creates a new metric registry and setup the appropriate exporters. The provided prefix is used for system-wide metrics.

func (*Metrics) MustStart

func (m *Metrics) MustStart()

MustStart starts the metric collection and panic if there is an error.

func (*Metrics) Push

func (m *Metrics) Push() error

Push pushes registered metrics to a Prometheus push gateway.

func (*Metrics) Start

func (m *Metrics) Start() error

Start starts the metric collection and the exporters.

func (*Metrics) Stop

func (m *Metrics) Stop() error

Stop stops all exporters and wait for them to terminate.

type PromPushGWConfiguration

type PromPushGWConfiguration struct {
	URL        string
	Job        string
	CertFile   config.FilePath
	KeyFile    config.FilePath
	CacertFile config.FilePath
	// contains filtered or unexported fields
}

func (*PromPushGWConfiguration) UnmarshalYAML

func (c *PromPushGWConfiguration) UnmarshalYAML(unmarshal func(interface{}) error) error

type PrometheusConfiguration

type PrometheusConfiguration struct {
	Listen     config.Addr
	Interval   config.Duration
	Namespace  string
	Subsystem  string
	CertFile   config.FilePath
	KeyFile    config.FilePath
	CacertFile config.FilePath
}

PrometheusConfiguration is the configuration for exporting metrics to files.

func (*PrometheusConfiguration) UnmarshalYAML

func (c *PrometheusConfiguration) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML parses the configuration from YAML.

Jump to

Keyboard shortcuts

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