mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Add metric for inhibition rules (#81119)
This commit adds a metric for the number of inhibition rules. It matches the metric added upstream in #3681.
This commit is contained in:
@@ -73,10 +73,11 @@ type AlertmanagerAggregatedMetrics struct {
|
||||
registries *metrics.TenantRegistries
|
||||
|
||||
// metrics gather from the in-house "Alertmanager" directly.
|
||||
numReceivedAlerts *prometheus.Desc
|
||||
numInvalidAlerts *prometheus.Desc
|
||||
configuredReceivers *prometheus.Desc
|
||||
configuredIntegrations *prometheus.Desc
|
||||
numReceivedAlerts *prometheus.Desc
|
||||
numInvalidAlerts *prometheus.Desc
|
||||
configuredReceivers *prometheus.Desc
|
||||
configuredIntegrations *prometheus.Desc
|
||||
configuredInhibitionRules *prometheus.Desc
|
||||
|
||||
// exported metrics, gathered from Alertmanager PipelineBuilder
|
||||
numNotifications *prometheus.Desc
|
||||
@@ -141,6 +142,10 @@ func NewAlertmanagerAggregatedMetrics(registries *metrics.TenantRegistries) *Ale
|
||||
fmt.Sprintf("%s_%s_alertmanager_integrations", Namespace, Subsystem),
|
||||
"Number of configured receivers.",
|
||||
[]string{"org", "type"}, nil),
|
||||
configuredInhibitionRules: prometheus.NewDesc(
|
||||
fmt.Sprintf("%s_%s_alertmanager_inhibition_rules", Namespace, Subsystem),
|
||||
"Number of configured inhibition rules.",
|
||||
[]string{"org"}, nil),
|
||||
|
||||
numNotifications: prometheus.NewDesc(
|
||||
fmt.Sprintf("%s_%s_notifications_total", Namespace, Subsystem),
|
||||
@@ -270,6 +275,7 @@ func (a *AlertmanagerAggregatedMetrics) Describe(out chan<- *prometheus.Desc) {
|
||||
out <- a.numInvalidAlerts
|
||||
out <- a.configuredReceivers
|
||||
out <- a.configuredIntegrations
|
||||
out <- a.configuredInhibitionRules
|
||||
|
||||
out <- a.numNotifications
|
||||
out <- a.numFailedNotifications
|
||||
@@ -314,6 +320,7 @@ func (a *AlertmanagerAggregatedMetrics) Collect(out chan<- prometheus.Metric) {
|
||||
data.SendSumOfCountersPerTenant(out, a.numInvalidAlerts, "alertmanager_alerts_invalid_total")
|
||||
data.SendSumOfGaugesPerTenantWithLabels(out, a.configuredReceivers, "grafana_alerting_alertmanager_receivers", "state")
|
||||
data.SendSumOfGaugesPerTenantWithLabels(out, a.configuredIntegrations, "grafana_alerting_alertmanager_integrations", "type")
|
||||
data.SendSumOfGaugesPerTenant(out, a.configuredInhibitionRules, "grafana_alerting_alertmanager_inhibition_rules")
|
||||
|
||||
data.SendSumOfCountersPerTenant(out, a.numNotifications, "alertmanager_notifications_total", metrics.WithLabels("integration"), metrics.WithSkipZeroValueMetrics)
|
||||
data.SendSumOfCountersPerTenant(out, a.numFailedNotifications, "alertmanager_notifications_failed_total", metrics.WithLabels("integration"), metrics.WithSkipZeroValueMetrics)
|
||||
|
||||
Reference in New Issue
Block a user