Documentation
¶
Index ¶
- Constants
- type Collector
- type Config
- type Metric
- type Service
- func (s *Service) Collector(name string) prometheus.Collector
- func (s *Service) Enabled() bool
- func (s *Service) Init(cfg *Config, r *rpc.Service) (bool, error)
- func (s *Service) MustRegister(c prometheus.Collector)
- func (s *Service) Register(c prometheus.Collector) error
- func (s *Service) Serve() error
- func (s *Service) Stop()
Constants ¶
View Source
const ID = "metrics"
ID declares public service name.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct { // Namespace of the metric. Namespace string // Subsystem of the metric. Subsystem string // Collector type (histogram, gauge, counter, summary). Type string // Help of collector. Help string // Labels for vectorized metrics. Labels []string // Buckets for histogram metric. Buckets []float64 }
Collector describes single application specific metric.
type Config ¶
type Config struct { // Address to listen Address string // Collect define application specific metrics. Collect map[string]Collector }
Config configures metrics service.
type Metric ¶
type Metric struct { // Collector name. Name string // Collector value. Value float64 // Labels associated with metric. Only for vector metrics. Must be provided in a form of label values. Labels []string }
Metric represent single metric produced by the application.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service to manage application metrics using Prometheus.
func (*Service) Collector ¶
func (s *Service) Collector(name string) prometheus.Collector
Collector returns application specific collector by name or nil if collector not found.
func (*Service) MustRegister ¶
func (s *Service) MustRegister(c prometheus.Collector)
MustRegister registers new collector or fails with panic.
Click to show internal directories.
Click to hide internal directories.