mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Remove unused features from ticker + metric + tests (#47828)
* 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
This commit is contained in:
35
pkg/services/alerting/metrics/metrics.go
Normal file
35
pkg/services/alerting/metrics/metrics.go
Normal file
@@ -0,0 +1,35 @@
|
||||
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.",
|
||||
}),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user