mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Add matchers metrics to Alertmanager (#69855)
This commit is contained in:
@@ -107,6 +107,13 @@ type AlertmanagerAggregatedMetrics struct {
|
||||
// exported metrics, gathered from Alertmanager Dispatcher
|
||||
dispatchAggrGroups *prometheus.Desc
|
||||
dispatchProcessingDuration *prometheus.Desc
|
||||
|
||||
// added to measure usage of matchers, match_re, match and
|
||||
// object_matchers
|
||||
matchers *prometheus.Desc
|
||||
matchRE *prometheus.Desc
|
||||
match *prometheus.Desc
|
||||
objectMatchers *prometheus.Desc
|
||||
}
|
||||
|
||||
func NewAlertmanagerAggregatedMetrics(registries *metrics.TenantRegistries) *AlertmanagerAggregatedMetrics {
|
||||
@@ -221,6 +228,23 @@ func NewAlertmanagerAggregatedMetrics(registries *metrics.TenantRegistries) *Ale
|
||||
fmt.Sprintf("%s_%s_dispatcher_alert_processing_duration_seconds", Namespace, Subsystem),
|
||||
"Summary of latencies for the processing of alerts.",
|
||||
nil, nil),
|
||||
|
||||
matchers: prometheus.NewDesc(
|
||||
fmt.Sprintf("%s_%s_alertmanager_config_matchers", Namespace, Subsystem),
|
||||
"The total number of matchers",
|
||||
nil, nil),
|
||||
matchRE: prometheus.NewDesc(
|
||||
fmt.Sprintf("%s_%s_alertmanager_config_match_re", Namespace, Subsystem),
|
||||
"The total number of matchRE",
|
||||
nil, nil),
|
||||
match: prometheus.NewDesc(
|
||||
fmt.Sprintf("%s_%s_alertmanager_config_match", Namespace, Subsystem),
|
||||
"The total number of match",
|
||||
nil, nil),
|
||||
objectMatchers: prometheus.NewDesc(
|
||||
fmt.Sprintf("%s_%s_alertmanager_config_object_matchers", Namespace, Subsystem),
|
||||
"The total number of object_matchers",
|
||||
nil, nil),
|
||||
}
|
||||
|
||||
return aggregatedMetrics
|
||||
@@ -257,6 +281,11 @@ func (a *AlertmanagerAggregatedMetrics) Describe(out chan<- *prometheus.Desc) {
|
||||
|
||||
out <- a.dispatchAggrGroups
|
||||
out <- a.dispatchProcessingDuration
|
||||
|
||||
out <- a.matchers
|
||||
out <- a.matchRE
|
||||
out <- a.match
|
||||
out <- a.objectMatchers
|
||||
}
|
||||
|
||||
func (a *AlertmanagerAggregatedMetrics) Collect(out chan<- prometheus.Metric) {
|
||||
@@ -292,4 +321,9 @@ func (a *AlertmanagerAggregatedMetrics) Collect(out chan<- prometheus.Metric) {
|
||||
|
||||
data.SendSumOfGauges(out, a.dispatchAggrGroups, "alertmanager_dispatcher_aggregation_groups")
|
||||
data.SendSumOfSummaries(out, a.dispatchProcessingDuration, "alertmanager_dispatcher_alert_processing_duration_seconds")
|
||||
|
||||
data.SendSumOfGauges(out, a.matchers, "alertmanager_config_matchers")
|
||||
data.SendSumOfGauges(out, a.matchRE, "alertmanager_config_match_re")
|
||||
data.SendSumOfGauges(out, a.match, "alertmanager_config_match")
|
||||
data.SendSumOfGauges(out, a.objectMatchers, "alertmanager_config_object_matchers")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user