2022-09-26 12:35:33 -05:00
|
|
|
package ticker
|
2022-04-22 14:09:47 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
|
|
)
|
|
|
|
|
2022-09-26 12:35:33 -05:00
|
|
|
type Metrics struct {
|
2022-04-22 14:09:47 -05:00
|
|
|
LastTickTime prometheus.Gauge
|
|
|
|
NextTickTime prometheus.Gauge
|
|
|
|
IntervalSeconds prometheus.Gauge
|
|
|
|
}
|
|
|
|
|
2022-09-26 12:35:33 -05:00
|
|
|
func NewMetrics(reg prometheus.Registerer, subsystem string) *Metrics {
|
|
|
|
return &Metrics{
|
2022-04-22 14:09:47 -05:00
|
|
|
LastTickTime: promauto.With(reg).NewGauge(prometheus.GaugeOpts{
|
|
|
|
Namespace: "grafana",
|
2022-09-26 12:35:33 -05:00
|
|
|
Subsystem: subsystem,
|
2022-04-22 14:09:47 -05:00
|
|
|
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",
|
2022-09-26 12:35:33 -05:00
|
|
|
Subsystem: subsystem,
|
2022-04-22 14:09:47 -05:00
|
|
|
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",
|
2022-09-26 12:35:33 -05:00
|
|
|
Subsystem: subsystem,
|
2022-04-22 14:09:47 -05:00
|
|
|
Name: "ticker_interval_seconds",
|
|
|
|
Help: "Interval at which the ticker is meant to tick.",
|
|
|
|
}),
|
|
|
|
}
|
|
|
|
}
|