Migrate to structured logging (klog)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-09-27 17:32:40 -03:00
parent 93ac8d5a21
commit 108637bb1c
31 changed files with 161 additions and 171 deletions

View file

@ -253,7 +253,7 @@ func (cm *Controller) RemoveAllSSLExpireMetrics(registry prometheus.Gatherer) {
func (cm *Controller) removeSSLExpireMetrics(onlyDefinedHosts bool, hosts []string, registry prometheus.Gatherer) {
mfs, err := registry.Gather()
if err != nil {
klog.Errorf("Error gathering metrics: %v", err)
klog.ErrorS(err, "Error gathering metrics")
return
}
@ -283,10 +283,10 @@ func (cm *Controller) removeSSLExpireMetrics(onlyDefinedHosts bool, hosts []stri
continue
}
klog.V(2).Infof("Removing prometheus metric from gauge %v for host %v", metricName, host)
klog.V(2).InfoS("Removing prometheus metric", "gauge", metricName, "host", host)
removed := cm.sslExpireTime.Delete(labels)
if !removed {
klog.V(2).Infof("metric %v for host %v with labels not removed: %v", metricName, host, labels)
klog.V(2).InfoS("metric removed", "metric", metricName, "host", host, "labels", labels)
}
}
}