mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-10 15:44:05 -08:00
e2b3626e0c
Also, remove unused `providers` field in targetSet. If the config file changes, we recreate all providers (by calling `providersFromConfig`) and retrieve all targets anew from the newly created providers. From that perspective, it cannot harm to clean up the target group map in the targetSet. Not doing so (as it was the case so far) keeps stale targets around. This mattered if an existing key in the target group map was not overwritten in the initial fetch of all targets from the providers. Examples where that mattered: ``` scrape_configs: - job_name: "foo" static_configs: - targets: ["foo:9090"] - targets: ["bar:9090"] ``` updated to: ``` scrape_configs: - job_name: "foo" static_configs: - targets: ["foo:9090"] ``` `bar:9090` would still be monitored. (The static provider just enumerates the target groups. If the number of target groups decreases, the old ones stay around. ``` scrape_configs: - job_name: "foo" dns_sd_configs: - names: - "srv.name.one.example.org" ``` updated to: ``` scrape_configs: - job_name: "foo" dns_sd_configs: - names: - "srv.name.two.example.org" ``` Now both SRV records are still monitored. The SRV name is part of the key in the target group map, thus the new one is just added and the old ane stays around. Obviously, this should have tests, and should have tests before, not only for this case. This is the quick fix. I have created https://github.com/prometheus/prometheus/issues/1906 to track test creation. Fixes https://github.com/prometheus/prometheus/issues/1610 . |
||
---|---|---|
.. | ||
discovery | ||
testdata | ||
helpers_test.go | ||
relabel.go | ||
relabel_test.go | ||
scrape.go | ||
scrape_test.go | ||
target.go | ||
target_test.go | ||
targetmanager.go | ||
targetmanager_test.go |