VictoriaMetrics/lib/promscrape/discovery
Zakhar Bessarab 669ad1ca55
lib/promscrape/discovery/kubernetes: fix leaking api watcher (#4861)
* lib/promscrape/discovery/kubernetes: fix leaking api watcher

goroutine which was polling k8s API had no execution control. This leaded to leaking goroutines during config reload.

See: https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4850
Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* lib/promscrape/discovery/kubernetes: use reference counting for urlWatcher cleanup

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* lib/promscrape/discovery/kubernetes: remove waitgroup sync for goroutines polling API server

This is unnecessary since context will is cancelled and new requests will not be sent. Also, using waitgroup will increase time required to perform reload which might result in missed scrapes.

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* lib/promscrape/discovery/kubernetes: clarify comment

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

* Apply suggestions from code review

* lib/promscrape/discovery/kubernetes: address review feedback

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>

---------

Signed-off-by: Zakhar Bessarab <z.bessarab@victoriametrics.com>
Co-authored-by: Nikolay <nik@victoriametrics.com>
2023-09-18 17:14:15 +02:00
..
azure lib/promscrape/discovery: close unused HTTP connections to service discovery servers 2023-07-27 14:47:55 -07:00
consul lib/promscrape/discovery: close unused HTTP connections to service discovery servers 2023-07-27 14:47:55 -07:00
consulagent lib/promscrape/discovery: close unused HTTP connections to service discovery servers 2023-07-27 14:47:55 -07:00
digitalocean lib/promscrape/discovery: close unused HTTP connections to service discovery servers 2023-07-27 14:47:55 -07:00
dns Makefile: update golangci-lint from v1.51.2 to v1.54.2 2023-09-01 11:15:51 +02:00
docker lib/promscrape/discovery: close unused HTTP connections to service discovery servers 2023-07-27 14:47:55 -07:00
dockerswarm lib/promscrape/discovery: close unused HTTP connections to service discovery servers 2023-07-27 14:47:55 -07:00
ec2 Makefile: update golangci-lint from v1.51.2 to v1.54.2 2023-09-01 11:15:51 +02:00
eureka lib/promscrape/discovery: close unused HTTP connections to service discovery servers 2023-07-27 14:47:55 -07:00
gce Makefile: update golangci-lint from v1.51.2 to v1.54.2 2023-09-01 11:15:51 +02:00
http lib/promscrape/discovery: close unused HTTP connections to service discovery servers 2023-07-27 14:47:55 -07:00
kubernetes lib/promscrape/discovery/kubernetes: fix leaking api watcher (#4861) 2023-09-18 17:14:15 +02:00
kuma lib/promscrape/discovery: close unused HTTP connections to service discovery servers 2023-07-27 14:47:55 -07:00
nomad lib/promscrape: disable support for service discovery and metrics scrape via http2 2023-07-06 16:04:31 -07:00
openstack lib/promscrape/discovery: close unused HTTP connections to service discovery servers 2023-07-27 14:47:55 -07:00
yandexcloud chore: Use http constants to replace numbers (#3846) 2023-02-22 18:59:32 -08:00