mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-14 01:24:04 -08:00
chore(storage/remote): collect maxTimestamp when value is 0 as well.
This change enables the PrometheusRemoteWriteBehind alert’s expression to be evaluated even when the remote endpoint has never been reached. As a result, PrometheusRemoteWriteBehind will fire to easily detect configuration mistakes (such as incorrect endpoint URLs) or unrecoverable connectivity issues. See https://github.com/prometheus/prometheus/issues/14350 for details. Signed-off-by: machine424 <ayoubmrini424@gmail.com>
This commit is contained in:
parent
58963f7b2e
commit
caa71fb3c7
|
@ -39,9 +39,3 @@ func (m *maxTimestamp) Get() float64 {
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
return m.value
|
return m.value
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *maxTimestamp) Collect(c chan<- prometheus.Metric) {
|
|
||||||
if m.Get() > 0 {
|
|
||||||
m.Gauge.Collect(c)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ func newQueueManagerMetrics(r prometheus.Registerer, rn, e string) *queueManager
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Subsystem: subsystem,
|
Subsystem: subsystem,
|
||||||
Name: "queue_highest_sent_timestamp_seconds",
|
Name: "queue_highest_sent_timestamp_seconds",
|
||||||
Help: "Timestamp from a WAL sample, the highest timestamp successfully sent by this queue, in seconds since epoch.",
|
Help: "Timestamp from a WAL sample, the highest timestamp successfully sent by this queue, in seconds since epoch. Initialized to 0 when no data has been sent yet.",
|
||||||
ConstLabels: constLabels,
|
ConstLabels: constLabels,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ func newHighestTimestampMetric() *maxTimestamp {
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Subsystem: subsystem,
|
Subsystem: subsystem,
|
||||||
Name: "highest_timestamp_in_seconds",
|
Name: "highest_timestamp_in_seconds",
|
||||||
Help: "Highest timestamp that has come into the remote storage via the Appender interface, in seconds since epoch.",
|
Help: "Highest timestamp that has come into the remote storage via the Appender interface, in seconds since epoch. Initialized to 0 when no data has been received yet",
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ func NewWriteStorage(logger log.Logger, reg prometheus.Registerer, dir string, f
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Subsystem: subsystem,
|
Subsystem: subsystem,
|
||||||
Name: "highest_timestamp_in_seconds",
|
Name: "highest_timestamp_in_seconds",
|
||||||
Help: "Highest timestamp that has come into the remote storage via the Appender interface, in seconds since epoch.",
|
Help: "Highest timestamp that has come into the remote storage via the Appender interface, in seconds since epoch. Initialized to 0 when no data has been received yet.",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue