From a902efe715d940d41d607e884073d628dafc23a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constan=C3=A7a=20Manteigas?= <113898685+constanca-m@users.noreply.github.com> Date: Thu, 8 Feb 2024 11:13:00 +0100 Subject: [PATCH] Update metricbeat/module/kubernetes/util/kubernetes.go Co-authored-by: Michael Katsoulis --- metricbeat/module/kubernetes/util/kubernetes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/metricbeat/module/kubernetes/util/kubernetes.go b/metricbeat/module/kubernetes/util/kubernetes.go index 37e40072461..755d31db10c 100644 --- a/metricbeat/module/kubernetes/util/kubernetes.go +++ b/metricbeat/module/kubernetes/util/kubernetes.go @@ -842,7 +842,11 @@ func buildMetadataEnricher( if watcher != nil { watcher.enrichers[metricsetName] = enricher - // Check if there are past events for this resource and update metadata if there are + // Check if this shared watcher has already detected resources from a previous enricher. + // In that case, for each resource, call the updateFunc of the current enricher to + // update its metadata. This is needed in cases where the watcher has already been + // notified for new/updated resources while the enricher for current metricset has not + // built yet(example is pod, state_pod metricsets). for key, _ := range watcher.metadataObjects { obj, exists, err := watcher.watcher.Store().GetByKey(key) if err != nil {