Adds QueueUsage to prometheus metrics (same as /api/stat/app) (#401)
Exposes gorush_queue_usage metric to be used in prometheus so monitor internal queues Useful to make sure we are coping well with traffic
This commit is contained in:
parent
758d4d60bb
commit
ae6c01bd67
|
@ -14,6 +14,7 @@ type Metrics struct {
|
|||
IosError *prometheus.Desc
|
||||
AndroidSuccess *prometheus.Desc
|
||||
AndroidError *prometheus.Desc
|
||||
QueueUsage *prometheus.Desc
|
||||
}
|
||||
|
||||
// NewMetrics returns a new Metrics with all prometheus.Desc initialized
|
||||
|
@ -45,6 +46,11 @@ func NewMetrics() Metrics {
|
|||
"Number of android fail count",
|
||||
nil, nil,
|
||||
),
|
||||
QueueUsage: prometheus.NewDesc(
|
||||
namespace+"queue_usage",
|
||||
"Length of internal queue",
|
||||
nil, nil,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,6 +61,7 @@ func (c Metrics) Describe(ch chan<- *prometheus.Desc) {
|
|||
ch <- c.IosError
|
||||
ch <- c.AndroidSuccess
|
||||
ch <- c.AndroidError
|
||||
ch <- c.QueueUsage
|
||||
}
|
||||
|
||||
// Collect returns the metrics with values
|
||||
|
@ -84,4 +91,9 @@ func (c Metrics) Collect(ch chan<- prometheus.Metric) {
|
|||
prometheus.GaugeValue,
|
||||
float64(StatStorage.GetAndroidError()),
|
||||
)
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
c.QueueUsage,
|
||||
prometheus.GaugeValue,
|
||||
float64(len(QueueNotification)),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue