Documentation ¶
Index ¶
- Constants
- type Collector
- type CollectorType
- type Config
- type Metric
- type NamedCollector
- type Service
- func (s *Service) Collector(name string) prometheus.Collector
- func (s *Service) Enabled() bool
- func (s *Service) Init(cfg *Config, r *rpc.Service, log *logrus.Logger) (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 declares public service name.
ID = "metrics"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collector ¶
type Collector struct { // Namespace of the metric. Namespace string `json:"namespace"` // Subsystem of the metric. Subsystem string `json:"subsystem"` // Collector type (histogram, gauge, counter, summary). Type CollectorType `json:"type"` // Help of collector. Help string `json:"help"` // Labels for vectorized metrics. Labels []string `json:"labels"` // Buckets for histogram metric. Buckets []float64 `json:"buckets"` }
Collector describes single application specific metric.
type CollectorType ¶
type CollectorType string
CollectorType represents prometheus collector types
const ( // Histogram type Histogram CollectorType = "histogram" // Gauge type Gauge CollectorType = "gauge" // Counter type Counter CollectorType = "counter" // Summary type Summary CollectorType = "summary" )
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 NamedCollector ¶
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.