elasticsearch_exporter icon indicating copy to clipboard operation
elasticsearch_exporter copied to clipboard

Refactor ClusterInfo package

Open sysadmind opened this issue 2 years ago • 0 comments

The clusterinfo package pkg/clusterinfo is designed to relay updates to collectors periodically. The way it is written seems complicated. Collectors are registered with the clusterinfo package and are sent information over a channel periodically. The cluserinfo collector has already been refactored to use the collector.Collector interface in collector/cluster_info.go.

One problem with the current implementation is that the collectors need to have a channel to receive updates, however neither the collector nor the clusterinfo package handle closing those channels. This could potentially leak resources.

We should design a more friendly API for collectors that need this information. Additionally, we should decide if this functionality needs to exist at all.

References: PR adding collector that needs to register with clusterinfo #639 Original Implementation #176

sysadmind avatar Oct 15 '23 20:10 sysadmind