Don't update the notAfter Gauge with zeros (#6924)
I think ideally we'd only ever call exportMetrics with a valid time, but that's a bit bigger of a refactor of this code. This was the fix we lightly decided on in the discussion of #6635 Fixes #6635
This commit is contained in:
parent
e72a8f9cac
commit
68e1c6bde7
|
|
@ -98,7 +98,9 @@ func (p TLSProbe) checkRoot(rootOrg, rootCN string) error {
|
|||
|
||||
// Export expiration timestamp and reason to Prometheus.
|
||||
func (p TLSProbe) exportMetrics(notAfter time.Time, reason reason) {
|
||||
p.notAfter.WithLabelValues(p.hostname).Set(float64(notAfter.Unix()))
|
||||
if !notAfter.IsZero() {
|
||||
p.notAfter.WithLabelValues(p.hostname).Set(float64(notAfter.Unix()))
|
||||
}
|
||||
p.reason.WithLabelValues(p.hostname, reasonToString[reason]).Inc()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue