Documentation
¶
Index ¶
- func ConvertNumeric(val interface{}) float64
- func PrefixMetricName(prefix string, name string) string
- type HoneycombMetrics
- func (h *HoneycombMetrics) Count(name string, n interface{})
- func (h *HoneycombMetrics) Down(name string)
- func (h *HoneycombMetrics) Gauge(name string, val interface{})
- func (h *HoneycombMetrics) Get(name string) (float64, bool)
- func (h *HoneycombMetrics) Histogram(name string, obs interface{})
- func (h *HoneycombMetrics) Increment(name string)
- func (h *HoneycombMetrics) Register(name string, metricType string)
- func (h *HoneycombMetrics) Start() error
- func (h *HoneycombMetrics) Store(name string, val float64)
- func (h *HoneycombMetrics) Up(name string)
- type Metrics
- type MetricsPrefixer
- func (p *MetricsPrefixer) Count(name string, val interface{})
- func (p *MetricsPrefixer) Down(name string)
- func (p *MetricsPrefixer) Gauge(name string, val interface{})
- func (p *MetricsPrefixer) Get(name string) (float64, bool)
- func (p *MetricsPrefixer) Histogram(name string, obs interface{})
- func (p *MetricsPrefixer) Increment(name string)
- func (p *MetricsPrefixer) Register(name string, metricType string)
- func (p *MetricsPrefixer) Start() error
- func (p *MetricsPrefixer) Store(name string, val float64)
- func (p *MetricsPrefixer) Up(name string)
- type MockMetrics
- func (m *MockMetrics) Count(name string, val interface{})
- func (m *MockMetrics) Down(name string)
- func (m *MockMetrics) Gauge(name string, val interface{})
- func (m *MockMetrics) Get(name string) (float64, bool)
- func (m *MockMetrics) Histogram(name string, val interface{})
- func (m *MockMetrics) Increment(name string)
- func (m *MockMetrics) Register(name string, metricType string)
- func (m *MockMetrics) Start()
- func (m *MockMetrics) Store(name string, val float64)
- func (m *MockMetrics) Up(name string)
- type NullMetrics
- func (n *NullMetrics) Count(name string, val interface{})
- func (n *NullMetrics) Down(name string)
- func (n *NullMetrics) Gauge(name string, val interface{})
- func (n *NullMetrics) Get(name string) (float64, bool)
- func (n *NullMetrics) Histogram(name string, obs interface{})
- func (n *NullMetrics) Increment(name string)
- func (n *NullMetrics) Register(name string, metricType string)
- func (n *NullMetrics) Start()
- func (n *NullMetrics) Store(name string, value float64)
- func (n *NullMetrics) Up(name string)
- type PromMetrics
- func (p *PromMetrics) Count(name string, n interface{})
- func (p *PromMetrics) Down(name string)
- func (p *PromMetrics) Gauge(name string, val interface{})
- func (p *PromMetrics) Get(name string) (float64, bool)
- func (p *PromMetrics) Histogram(name string, obs interface{})
- func (p *PromMetrics) Increment(name string)
- func (p *PromMetrics) Register(name string, metricType string)
- func (p *PromMetrics) Start() error
- func (p *PromMetrics) Store(name string, val float64)
- func (p *PromMetrics) Up(name string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertNumeric ¶ added in v1.1.0
func ConvertNumeric(val interface{}) float64
func PrefixMetricName ¶ added in v1.1.0
Types ¶
type HoneycombMetrics ¶
type HoneycombMetrics struct { Config config.Config `inject:""` Logger logger.Logger `inject:""` UpstreamTransport *http.Transport `inject:"upstreamTransport"` Version string `inject:"version"` // contains filtered or unexported fields }
func (*HoneycombMetrics) Count ¶ added in v1.1.0
func (h *HoneycombMetrics) Count(name string, n interface{})
func (*HoneycombMetrics) Down ¶ added in v1.20.0
func (h *HoneycombMetrics) Down(name string)
func (*HoneycombMetrics) Gauge ¶
func (h *HoneycombMetrics) Gauge(name string, val interface{})
func (*HoneycombMetrics) Get ¶ added in v1.20.0
func (h *HoneycombMetrics) Get(name string) (float64, bool)
Retrieves the current value of a gauge, constant, counter, or updown as a float64 (even if it's an integer value). Returns 0 if the name isn't found.
func (*HoneycombMetrics) Histogram ¶
func (h *HoneycombMetrics) Histogram(name string, obs interface{})
func (*HoneycombMetrics) Increment ¶ added in v1.1.0
func (h *HoneycombMetrics) Increment(name string)
func (*HoneycombMetrics) Register ¶
func (h *HoneycombMetrics) Register(name string, metricType string)
func (*HoneycombMetrics) Start ¶
func (h *HoneycombMetrics) Start() error
func (*HoneycombMetrics) Store ¶ added in v1.20.0
func (h *HoneycombMetrics) Store(name string, val float64)
func (*HoneycombMetrics) Up ¶ added in v1.20.0
func (h *HoneycombMetrics) Up(name string)
type Metrics ¶
type Metrics interface { // Register declares a metric; metricType should be one of counter, gauge, histogram, updown Register(name string, metricType string) Increment(name string) // for counters Gauge(name string, val interface{}) // for gauges Count(name string, n interface{}) // for counters Histogram(name string, obs interface{}) // for histogram Up(name string) // for updown Down(name string) // for updown Get(name string) (float64, bool) // for reading back a counter or a gauge Store(name string, val float64) // for storing a rarely-changing value not sent as a metric }
The Metrics object supports "constants", which are just float values that can be attached to the metrics system. They do not need to be (and should not) be registered in advance; they are just a bucket of key-float pairs that can be used in combination with other metrics.
type MetricsPrefixer ¶ added in v1.20.0
type MetricsPrefixer struct { Metrics Metrics `inject:"metrics"` // contains filtered or unexported fields }
func NewMetricsPrefixer ¶ added in v1.20.0
func NewMetricsPrefixer(prefix string) *MetricsPrefixer
func (*MetricsPrefixer) Count ¶ added in v1.20.0
func (p *MetricsPrefixer) Count(name string, val interface{})
func (*MetricsPrefixer) Down ¶ added in v1.20.0
func (p *MetricsPrefixer) Down(name string)
func (*MetricsPrefixer) Gauge ¶ added in v1.20.0
func (p *MetricsPrefixer) Gauge(name string, val interface{})
func (*MetricsPrefixer) Get ¶ added in v1.20.0
func (p *MetricsPrefixer) Get(name string) (float64, bool)
func (*MetricsPrefixer) Histogram ¶ added in v1.20.0
func (p *MetricsPrefixer) Histogram(name string, obs interface{})
func (*MetricsPrefixer) Increment ¶ added in v1.20.0
func (p *MetricsPrefixer) Increment(name string)
func (*MetricsPrefixer) Register ¶ added in v1.20.0
func (p *MetricsPrefixer) Register(name string, metricType string)
func (*MetricsPrefixer) Start ¶ added in v1.20.0
func (p *MetricsPrefixer) Start() error
func (*MetricsPrefixer) Store ¶ added in v1.20.0
func (p *MetricsPrefixer) Store(name string, val float64)
func (*MetricsPrefixer) Up ¶ added in v1.20.0
func (p *MetricsPrefixer) Up(name string)
type MockMetrics ¶
type MockMetrics struct { Registrations map[string]string CounterIncrements map[string]int GaugeRecords map[string]float64 Histograms map[string][]float64 UpdownIncrements map[string]int Constants map[string]float64 // contains filtered or unexported fields }
MockMetrics collects metrics that were registered and changed to allow tests to verify expected behavior
func (*MockMetrics) Count ¶ added in v1.1.0
func (m *MockMetrics) Count(name string, val interface{})
func (*MockMetrics) Down ¶ added in v1.20.0
func (m *MockMetrics) Down(name string)
func (*MockMetrics) Gauge ¶
func (m *MockMetrics) Gauge(name string, val interface{})
func (*MockMetrics) Histogram ¶
func (m *MockMetrics) Histogram(name string, val interface{})
func (*MockMetrics) Increment ¶ added in v1.1.0
func (m *MockMetrics) Increment(name string)
func (*MockMetrics) Register ¶
func (m *MockMetrics) Register(name string, metricType string)
func (*MockMetrics) Start ¶
func (m *MockMetrics) Start()
Start initializes all metrics or resets all metrics to zero
func (*MockMetrics) Store ¶ added in v1.20.0
func (m *MockMetrics) Store(name string, val float64)
func (*MockMetrics) Up ¶ added in v1.20.0
func (m *MockMetrics) Up(name string)
type NullMetrics ¶
type NullMetrics struct{}
NullMetrics discards all metrics
func (*NullMetrics) Count ¶ added in v1.1.0
func (n *NullMetrics) Count(name string, val interface{})
func (*NullMetrics) Down ¶ added in v1.20.0
func (n *NullMetrics) Down(name string)
func (*NullMetrics) Gauge ¶
func (n *NullMetrics) Gauge(name string, val interface{})
func (*NullMetrics) Histogram ¶
func (n *NullMetrics) Histogram(name string, obs interface{})
func (*NullMetrics) Increment ¶ added in v1.1.0
func (n *NullMetrics) Increment(name string)
func (*NullMetrics) Register ¶
func (n *NullMetrics) Register(name string, metricType string)
func (*NullMetrics) Start ¶
func (n *NullMetrics) Start()
Start initializes all metrics or resets all metrics to zero
func (*NullMetrics) Store ¶ added in v1.20.0
func (n *NullMetrics) Store(name string, value float64)
func (*NullMetrics) Up ¶ added in v1.20.0
func (n *NullMetrics) Up(name string)
type PromMetrics ¶
type PromMetrics struct { Config config.Config `inject:""` Logger logger.Logger `inject:""` // contains filtered or unexported fields }
func (*PromMetrics) Count ¶ added in v1.1.0
func (p *PromMetrics) Count(name string, n interface{})
func (*PromMetrics) Down ¶ added in v1.20.0
func (p *PromMetrics) Down(name string)
func (*PromMetrics) Gauge ¶
func (p *PromMetrics) Gauge(name string, val interface{})
func (*PromMetrics) Histogram ¶
func (p *PromMetrics) Histogram(name string, obs interface{})
func (*PromMetrics) Increment ¶ added in v1.1.0
func (p *PromMetrics) Increment(name string)
func (*PromMetrics) Register ¶
func (p *PromMetrics) Register(name string, metricType string)
Register takes a name and a metric type. The type should be one of "counter", "gauge", or "histogram"
func (*PromMetrics) Start ¶
func (p *PromMetrics) Start() error
func (*PromMetrics) Store ¶ added in v1.20.0
func (p *PromMetrics) Store(name string, val float64)
func (*PromMetrics) Up ¶ added in v1.20.0
func (p *PromMetrics) Up(name string)