prometheus/config
bwplotka 894c201d62 config: Remove validation GetScrapeConfigs to avoid race and wrties.
We should never modify (or even shallow copy) Config after config.Load;
added comments and modified GetScrapeConfigs to do so. For GetScrapeConfigs
the validation (even repeated) was likely doing writes (because global fields was 0). We GetScrapeConfigs concurrently
in tests and ApplyConfig causing test races. In prod there were races but likelyt only to replace 0 with 0, so not too severe.

I remove validation since I don't see anyone using our config.Config without Load or UnmarshalYAML.

We can add another validation method if there are use cases for this.

Fixes #15538

Alternatives:
* Add config mutex for GetScrapeConfigs (more complex and slow)
* Copy Config (Config struct is huge and required complex deep copy)
* Second validate is noop
  * e.g. by checking if global is 0 (prone to errors in future)
  * e.g. once.Sync validation - this introduces state and mutex, let's avoid it until we know it's needed (multiple ways of loading config)


Signed-off-by: bwplotka <bwplotka@gmail.com>
2024-12-11 11:07:16 +00:00
..
testdata Rename to keep_identifying_resource_attributes 2024-11-29 15:19:14 +01:00
config.go config: Remove validation GetScrapeConfigs to avoid race and wrties. 2024-12-11 11:07:16 +00:00
config_default_test.go Add configuration option for GOGC 2024-06-05 15:23:16 +02:00
config_test.go Lint fix 2024-11-29 15:19:45 +01:00
config_windows_test.go Add configuration option for GOGC 2024-06-05 15:23:16 +02:00
reload.go autoreload: do not ignore errors 2024-09-03 11:37:14 +02:00
reload_test.go Use t.Tempdir 2024-09-03 11:37:29 +02:00