Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
qorus
prometheus
Commits
fd3ef6ba
Commit
fd3ef6ba
authored
Jan 13, 2019
by
Vishnunarayan K I
Committed by
Brian Brazil
Jan 13, 2019
Browse files
Add metric rule_group_rules_loaded to get the number of rules loaded (#5090)
Signed-off-by:
Vishnunarayan K I
<
appukuttancr@gmail.com
>
parent
71834443
Changes
1
Hide whitespace changes
Inline
Side-by-side
rules/manager.go
View file @
fd3ef6ba
...
...
@@ -71,6 +71,7 @@ type Metrics struct {
iterationsScheduled
prometheus
.
Counter
groupLastEvalTime
*
prometheus
.
GaugeVec
groupLastDuration
*
prometheus
.
GaugeVec
groupRules
*
prometheus
.
GaugeVec
}
// NewGroupMetrics makes a new Metrics and registers them with then provided registerer,
...
...
@@ -127,6 +128,14 @@ func NewGroupMetrics(reg prometheus.Registerer) *Metrics {
},
[]
string
{
"rule_group"
},
),
groupRules
:
prometheus
.
NewGaugeVec
(
prometheus
.
GaugeOpts
{
Namespace
:
namespace
,
Name
:
"rule_group_rules"
,
Help
:
"The number of rules."
,
},
[]
string
{
"rule_group"
},
),
}
if
reg
!=
nil
{
...
...
@@ -139,6 +148,7 @@ func NewGroupMetrics(reg prometheus.Registerer) *Metrics {
m
.
iterationsScheduled
,
m
.
groupLastEvalTime
,
m
.
groupLastDuration
,
m
.
groupRules
,
)
}
...
...
@@ -235,6 +245,7 @@ func NewGroup(name, file string, interval time.Duration, rules []Rule, shouldRes
metrics
.
groupLastEvalTime
.
WithLabelValues
(
groupKey
(
file
,
name
))
metrics
.
groupLastDuration
.
WithLabelValues
(
groupKey
(
file
,
name
))
metrics
.
groupRules
.
WithLabelValues
(
groupKey
(
file
,
name
))
.
Set
(
float64
(
len
(
rules
)))
return
&
Group
{
name
:
name
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment