From 2c10f81102b6d386706977efd54737c0add8a8cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20GLON?= <sebastien.glon@akeneo.com>
Date: Mon, 26 Mar 2018 18:11:40 +0200
Subject: [PATCH] Add new alert for samples rejected due ti duplicate timestamp
 (#1148)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Sébastien GLON <sebastien.glon@akeneo.com>
---
 assets/prometheus/rules/prometheus.rules.yaml  | 9 +++++++++
 manifests/prometheus/prometheus-k8s-rules.yaml | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/assets/prometheus/rules/prometheus.rules.yaml b/assets/prometheus/rules/prometheus.rules.yaml
index 43f2808c..da699c32 100644
--- a/assets/prometheus/rules/prometheus.rules.yaml
+++ b/assets/prometheus/rules/prometheus.rules.yaml
@@ -90,3 +90,12 @@ groups:
     annotations:
       description: "Prometheus {{ $labels.namespace }}/{{ $labels.pod}} isn't ingesting samples."
       summary: "Prometheus isn't ingesting samples"
+
+  - alert: PrometheusTargetScapesDuplicate
+    expr: increase(prometheus_target_scrapes_sample_duplicate_timestamp_total[5m]) > 0
+    for: 10m
+    labels:
+      severity: warning
+    annotations:
+      description: "{{$labels.namespace}}/{{$labels.pod}} has many samples rejected due to duplicate timestamps but different values"
+      summary: Prometheus has many samples rejected
diff --git a/manifests/prometheus/prometheus-k8s-rules.yaml b/manifests/prometheus/prometheus-k8s-rules.yaml
index 470d27c9..403e4383 100644
--- a/manifests/prometheus/prometheus-k8s-rules.yaml
+++ b/manifests/prometheus/prometheus-k8s-rules.yaml
@@ -634,3 +634,12 @@ data:
         annotations:
           description: "Prometheus {{ $labels.namespace }}/{{ $labels.pod}} isn't ingesting samples."
           summary: "Prometheus isn't ingesting samples"
+    
+      - alert: PrometheusTargetScapesDuplicate
+        expr: increase(prometheus_target_scrapes_sample_duplicate_timestamp_total[5m]) > 0
+        for: 10m
+        labels:
+          severity: warning
+        annotations:
+          description: "{{$labels.namespace}}/{{$labels.pod}} has many samples rejected due to duplicate timestamps but different values"
+          summary: Prometheus has many samples rejected
-- 
GitLab