mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 01:23:32 -06:00
* Move ticker files to dedicated package with no changes * Fix package naming and resolve naming conflicts * Fix up all existing references to moved objects * Remove all alerting-specific references from shared util * Rename TickerMetrics to simply Metrics * Rename base ticker type to T and rename NewTicker to simply New
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package ticker
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
)
|
|
|
|
type Metrics struct {
|
|
LastTickTime prometheus.Gauge
|
|
NextTickTime prometheus.Gauge
|
|
IntervalSeconds prometheus.Gauge
|
|
}
|
|
|
|
func NewMetrics(reg prometheus.Registerer, subsystem string) *Metrics {
|
|
return &Metrics{
|
|
LastTickTime: promauto.With(reg).NewGauge(prometheus.GaugeOpts{
|
|
Namespace: "grafana",
|
|
Subsystem: subsystem,
|
|
Name: "ticker_last_consumed_tick_timestamp_seconds",
|
|
Help: "Timestamp of the last consumed tick in seconds.",
|
|
}),
|
|
NextTickTime: promauto.With(reg).NewGauge(prometheus.GaugeOpts{
|
|
Namespace: "grafana",
|
|
Subsystem: subsystem,
|
|
Name: "ticker_next_tick_timestamp_seconds",
|
|
Help: "Timestamp of the next tick in seconds before it is consumed.",
|
|
}),
|
|
IntervalSeconds: promauto.With(reg).NewGauge(prometheus.GaugeOpts{
|
|
Namespace: "grafana",
|
|
Subsystem: subsystem,
|
|
Name: "ticker_interval_seconds",
|
|
Help: "Interval at which the ticker is meant to tick.",
|
|
}),
|
|
}
|
|
}
|