mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #98627 from jialaijun/migrate_to_structured_logs_5
Migrate pkg/kubelet/metrics logs to structured logging.
This commit is contained in:
commit
62bb595cbe
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user