Merge pull request #98627 from jialaijun/migrate_to_structured_logs_5

Migrate pkg/kubelet/metrics logs to structured logging.
This commit is contained in:
Kubernetes Prow Robot 2021-03-02 15:49:31 -08:00 committed by GitHub
commit 62bb595cbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -63,7 +63,7 @@ func (c *logMetricsCollector) DescribeWithStability(ch chan<- *metrics.Desc) {
func (c *logMetricsCollector) CollectWithStability(ch chan<- metrics.Metric) {
podStats, err := c.podStats()
if err != nil {
klog.Errorf("failed to get pod stats: %v", err)
klog.ErrorS(err, "Failed to get pod stats")
return
}

View File

@ -115,7 +115,7 @@ func (rc *resourceMetricsCollector) CollectWithStability(ch chan<- metrics.Metri
statsSummary, err := rc.provider.GetCPUAndMemoryStats()
if err != nil {
errorCount = 1
klog.Warningf("Error getting summary for resourceMetric prometheus endpoint: %v", err)
klog.ErrorS(err, "Error getting summary for resourceMetric prometheus endpoint")
return
}

View File

@ -467,7 +467,7 @@ func SetAssignedConfig(source *corev1.NodeConfigSource) error {
}
// clean up the old timeseries (WithLabelValues creates a new one for each distinct label set)
if !AssignedConfig.Delete(assignedConfigLabels) {
klog.Warningf("Failed to delete metric for labels %v. This may result in ambiguity from multiple metrics concurrently indicating different assigned configs.", assignedConfigLabels)
klog.InfoS("Failed to delete metric for labels. This may result in ambiguity from multiple metrics concurrently indicating different assigned configs.", "labels", assignedConfigLabels)
}
// record the new timeseries
assignedConfigLabels = labels
@ -489,7 +489,7 @@ func SetActiveConfig(source *corev1.NodeConfigSource) error {
}
// clean up the old timeseries (WithLabelValues creates a new one for each distinct label set)
if !ActiveConfig.Delete(activeConfigLabels) {
klog.Warningf("Failed to delete metric for labels %v. This may result in ambiguity from multiple metrics concurrently indicating different active configs.", activeConfigLabels)
klog.InfoS("Failed to delete metric for labels. This may result in ambiguity from multiple metrics concurrently indicating different active configs.", "labels", activeConfigLabels)
}
// record the new timeseries
activeConfigLabels = labels
@ -511,7 +511,7 @@ func SetLastKnownGoodConfig(source *corev1.NodeConfigSource) error {
}
// clean up the old timeseries (WithLabelValues creates a new one for each distinct label set)
if !LastKnownGoodConfig.Delete(lastKnownGoodConfigLabels) {
klog.Warningf("Failed to delete metric for labels %v. This may result in ambiguity from multiple metrics concurrently indicating different last known good configs.", lastKnownGoodConfigLabels)
klog.InfoS("Failed to delete metric for labels. This may result in ambiguity from multiple metrics concurrently indicating different last known good configs.", "labels", lastKnownGoodConfigLabels)
}
// record the new timeseries
lastKnownGoodConfigLabels = labels