12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package metrics
- import (
- "leafstalk/conf"
- )
- // Summary defines a summary metric
- type Summary struct {
- Subsystem string
- Name string
- Help string
- Objectives map[float64]float64
- Labels []string
- }
- // Gauge defines a gauge metric
- type Gauge struct {
- Subsystem string
- Name string
- Help string
- Labels []string
- }
- // Counter defines a counter metric
- type Counter struct {
- Subsystem string
- Name string
- Help string
- Labels []string
- }
- // CustomMetricsSpec has all metrics specs
- type CustomMetricsSpec struct {
- Summaries []*Summary
- Gauges []*Gauge
- Counters []*Counter
- }
- //NewCustomMetricsSpec returns a *CustomMetricsSpec by reading config key
- func NewCustomMetricsSpec(config *conf.Config) (*CustomMetricsSpec, error) {
- var spec CustomMetricsSpec
- err := config.UnmarshalKey("grave.metrics.custom", &spec)
- if err != nil {
- return nil, err
- }
- return &spec, nil
- }
|