Alerting: Add matchers metrics to Alertmanager (#69855)

This commit is contained in:
George Robinson
2023-06-15 09:18:01 +01:00
committed by GitHub
parent f649619e20
commit f085e99d3c
3 changed files with 114 additions and 2 deletions

View File

@@ -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")
}