VictoriaMetrics/app/vmalert/utils
Zakhar Bessarab 9ca74d1fff
app/vmalert: properly unregister exposed metrics for alerting rules
Previously if rule group parameters were changed, alerting rules related metrics could be deleted due to bug at `utils/metrics` package. 

 This commit introduces `metrics.Set` per rule group. It holds group and alerting rules metrics. It properly unregister alerting rules metrics and addresses issue.
In addition:
- expose group metrics only once group is started - this helps to avoid
exposing metrics for groups which are created during YAML unmarshaling
and only used to update existing group.
- properly close rules which are discarded after updating existing rules
so that metrics are also correctly closed.
- detect file renames and properly recreate groups "moved" between files.

Related issue:
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/8229
2025-02-21 10:36:29 +01:00
..
auth.go app/{vmagent,vmalert}: add the ability to set OAuth2 endpoint params via the corresponding *.oauth2.endpointParams command-line flags 2023-12-20 21:35:28 +02:00
err_group.go Vmalert notifiers (#2744) 2022-06-18 09:11:37 +02:00
err_group_test.go app/vmalert: switch from table-driven tests to f-tests 2024-07-12 22:41:11 +02:00
links.go vmalert: properly form assets address if httpPrefix set (#4351) 2023-05-29 07:38:13 +02:00
metrics.go app/vmalert: properly unregister exposed metrics for alerting rules 2025-02-21 10:36:29 +01:00