Reuse NewResourceMetadataEnricher
to reduce memory utilisation
#35591
Labels
Team:Cloudnative-Monitoring
Label for the Cloud Native Monitoring team
In the
kubernetes
module for every metricset enabled we are creating a differentMetadataEnricher
by calling theNewResourceMetadataEnricher
method:beats/metricbeat/module/kubernetes/util/kubernetes.go
Line 130 in 0405168
This means that many k8s resources like Nodes, Namespaces are being retrieved multiple times through Watchers.
Same for Pods that are being retrieved from
pod
,container
,state_pod
andstate_container
metricsets.This has apparently impact on the memory utilization of Metricbeat and can lead in Metricbeat Pod requiring a lot of memory resources to avoid being OOMKilled. We can improve this by establishing a common "pool" of Enrichers by type for the whole module and then each metricset can re-use the proper Enricher accordingly.
This also affects Elastic Agent since it runs Metricbeat under the hood.
cc: @gizas @tommyers-elastic @bturquet
The text was updated successfully, but these errors were encountered: