mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53:33 -06:00
* remove not used code: - remove offset in ticket because it is not used - remove unused ticker and scheduler methods * use duration for interval * add metrics grafana_alerting_ticker_last_consumed_tick_timestamp_seconds, grafana_alerting_ticker_next_tick_timestamp_seconds, grafana_alerting_ticker_interval_seconds
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package metrics
|
|
|
|
import (
|
|
"github.com/prometheus/client_golang/prometheus"
|
|
"github.com/prometheus/client_golang/prometheus/promauto"
|
|
)
|
|
|
|
type Ticker struct {
|
|
LastTickTime prometheus.Gauge
|
|
NextTickTime prometheus.Gauge
|
|
IntervalSeconds prometheus.Gauge
|
|
}
|
|
|
|
func NewTickerMetrics(reg prometheus.Registerer) *Ticker {
|
|
return &Ticker{
|
|
LastTickTime: promauto.With(reg).NewGauge(prometheus.GaugeOpts{
|
|
Namespace: "grafana",
|
|
Subsystem: "alerting",
|
|
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: "alerting",
|
|
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: "alerting",
|
|
Name: "ticker_interval_seconds",
|
|
Help: "Interval at which the ticker is meant to tick.",
|
|
}),
|
|
}
|
|
}
|