mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Instrumentation: Add failed notifications metric (#18089)
This commit is contained in:
parent
9ccf32bef0
commit
a4b0ccc138
@ -80,6 +80,9 @@ var (
|
|||||||
// MAlertingNotificationSent is a metric counter for how many alert notifications been sent
|
// MAlertingNotificationSent is a metric counter for how many alert notifications been sent
|
||||||
MAlertingNotificationSent *prometheus.CounterVec
|
MAlertingNotificationSent *prometheus.CounterVec
|
||||||
|
|
||||||
|
// MAlertingNotificationSent is a metric counter for how many alert notifications that failed
|
||||||
|
MAlertingNotificationFailed *prometheus.CounterVec
|
||||||
|
|
||||||
// MAwsCloudWatchGetMetricStatistics is a metric counter for getting metric statistics from aws
|
// MAwsCloudWatchGetMetricStatistics is a metric counter for getting metric statistics from aws
|
||||||
MAwsCloudWatchGetMetricStatistics prometheus.Counter
|
MAwsCloudWatchGetMetricStatistics prometheus.Counter
|
||||||
|
|
||||||
@ -290,7 +293,13 @@ func init() {
|
|||||||
|
|
||||||
MAlertingNotificationSent = prometheus.NewCounterVec(prometheus.CounterOpts{
|
MAlertingNotificationSent = prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||||
Name: "alerting_notification_sent_total",
|
Name: "alerting_notification_sent_total",
|
||||||
Help: "counter for how many alert notifications been sent",
|
Help: "counter for how many alert notifications have been sent",
|
||||||
|
Namespace: exporterName,
|
||||||
|
}, []string{"type"})
|
||||||
|
|
||||||
|
MAlertingNotificationFailed = prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||||
|
Name: "alerting_notification_failed_total",
|
||||||
|
Help: "counter for how many alert notifications have failed",
|
||||||
Namespace: exporterName,
|
Namespace: exporterName,
|
||||||
}, []string{"type"})
|
}, []string{"type"})
|
||||||
|
|
||||||
@ -452,6 +461,7 @@ func initMetricVars() {
|
|||||||
MApiDashboardInsert,
|
MApiDashboardInsert,
|
||||||
MAlertingResultState,
|
MAlertingResultState,
|
||||||
MAlertingNotificationSent,
|
MAlertingNotificationSent,
|
||||||
|
MAlertingNotificationFailed,
|
||||||
MAwsCloudWatchGetMetricStatistics,
|
MAwsCloudWatchGetMetricStatistics,
|
||||||
MAwsCloudWatchListMetrics,
|
MAwsCloudWatchListMetrics,
|
||||||
MAwsCloudWatchGetMetricData,
|
MAwsCloudWatchGetMetricData,
|
||||||
|
@ -63,6 +63,7 @@ func (n *notificationService) sendAndMarkAsComplete(evalContext *EvalContext, no
|
|||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
n.log.Error("failed to send notification", "uid", notifier.GetNotifierUID(), "error", err)
|
n.log.Error("failed to send notification", "uid", notifier.GetNotifierUID(), "error", err)
|
||||||
|
metrics.MAlertingNotificationFailed.WithLabelValues(notifier.GetType()).Inc()
|
||||||
}
|
}
|
||||||
|
|
||||||
if evalContext.IsTestRun {
|
if evalContext.IsTestRun {
|
||||||
|
Loading…
Reference in New Issue
Block a user