-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove metrics from compat package #3714
Merged
gotjosh
merged 1 commit into
prometheus:main
from
grobinson-grafana:grobinson/remove-compat-metrics
Feb 8, 2024
Merged
Remove metrics from compat package #3714
gotjosh
merged 1 commit into
prometheus:main
from
grobinson-grafana:grobinson/remove-compat-metrics
Feb 8, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grobinson-grafana
force-pushed
the
grobinson/remove-compat-metrics
branch
3 times, most recently
from
February 8, 2024 00:55
27337ad
to
cdfb679
Compare
gotjosh
reviewed
Feb 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please look at my comment.
This commit removes the metrics from the compat package in favour of the existing logging and the additional tools at hand, such as amtool, to validate Alertmanager configurations. Due to the global nature of the compat package, a consequence of config.Load, these metrics have proven to be less useful in practice than expected, both in Alertmanager and other projects such as Mimir. There are a number of reasons for this: 1. Because the compat package is global, these metrics cannot be reset each time config.Load is called, as in multi-tenant projects like Mimir loading a config for one tenant would reset the metrics for all tenants. This is also the reason the metrics are counters and not gauges. 2. Since the metrics are counters, it is difficult to create meaningful dashboards for Alertmanager as, unlike in Mimir, configurations are not reloaded at fixed intervals, and as such, operators cannot use rate to track configuration changes over time. In Alertmanager, there are much better tools available to validate that an Alertmanager configuration is compatible with the UTF-8 parser, including both the existing logging from Alertmanager server and amtool check-config. In other projects like Mimir, we can track configurations for individual tenants using log aggregation and storage systems such as Loki. This gives operators far more information than what is possible with the metrics, including the timestamp, input and ID of tenant configurations that are incompatible or have disagreement. Signed-off-by: George Robinson <george.robinson@grafana.com>
grobinson-grafana
force-pushed
the
grobinson/remove-compat-metrics
branch
from
February 8, 2024 09:39
cdfb679
to
e2e574a
Compare
th0th
pushed a commit
to th0th/alertmanager
that referenced
this pull request
Mar 23, 2024
This commit removes the metrics from the compat package in favour of the existing logging and the additional tools at hand, such as amtool, to validate Alertmanager configurations. Due to the global nature of the compat package, a consequence of config.Load, these metrics have proven to be less useful in practice than expected, both in Alertmanager and other projects such as Mimir. There are a number of reasons for this: 1. Because the compat package is global, these metrics cannot be reset each time config.Load is called, as in multi-tenant projects like Mimir loading a config for one tenant would reset the metrics for all tenants. This is also the reason the metrics are counters and not gauges. 2. Since the metrics are counters, it is difficult to create meaningful dashboards for Alertmanager as, unlike in Mimir, configurations are not reloaded at fixed intervals, and as such, operators cannot use rate to track configuration changes over time. In Alertmanager, there are much better tools available to validate that an Alertmanager configuration is compatible with the UTF-8 parser, including both the existing logging from Alertmanager server and amtool check-config. In other projects like Mimir, we can track configurations for individual tenants using log aggregation and storage systems such as Loki. This gives operators far more information than what is possible with the metrics, including the timestamp, input and ID of tenant configurations that are incompatible or have disagreement. Signed-off-by: George Robinson <george.robinson@grafana.com> Signed-off-by: Gokhan Sari <gokhan@sari.me>
th0th
pushed a commit
to th0th/alertmanager
that referenced
this pull request
Mar 25, 2024
This commit removes the metrics from the compat package in favour of the existing logging and the additional tools at hand, such as amtool, to validate Alertmanager configurations. Due to the global nature of the compat package, a consequence of config.Load, these metrics have proven to be less useful in practice than expected, both in Alertmanager and other projects such as Mimir. There are a number of reasons for this: 1. Because the compat package is global, these metrics cannot be reset each time config.Load is called, as in multi-tenant projects like Mimir loading a config for one tenant would reset the metrics for all tenants. This is also the reason the metrics are counters and not gauges. 2. Since the metrics are counters, it is difficult to create meaningful dashboards for Alertmanager as, unlike in Mimir, configurations are not reloaded at fixed intervals, and as such, operators cannot use rate to track configuration changes over time. In Alertmanager, there are much better tools available to validate that an Alertmanager configuration is compatible with the UTF-8 parser, including both the existing logging from Alertmanager server and amtool check-config. In other projects like Mimir, we can track configurations for individual tenants using log aggregation and storage systems such as Loki. This gives operators far more information than what is possible with the metrics, including the timestamp, input and ID of tenant configurations that are incompatible or have disagreement. Signed-off-by: George Robinson <george.robinson@grafana.com> Signed-off-by: Gokhan Sari <gokhan@sari.me>
th0th
added a commit
to th0th/alertmanager
that referenced
this pull request
Apr 17, 2024
Fix the typo Signed-off-by: Gokhan Sari <gokhan@sari.me> Update tests Signed-off-by: Gokhan Sari <gokhan@sari.me> Update documentation Signed-off-by: Gokhan Sari <gokhan@sari.me> Update notifiers_test.go Signed-off-by: Gokhan Sari <gokhan@sari.me> Update notifiers_test.go Signed-off-by: Gokhan Sari <gokhan@sari.me> Use int32 instead of int64 for MessageThreadID Signed-off-by: Gokhan Sari <gokhan@sari.me> Bump github.com/go-openapi/swag from 0.22.4 to 0.22.7 (prometheus#3655) Bumps [github.com/go-openapi/swag](https://github.com/go-openapi/swag) from 0.22.4 to 0.22.7. - [Commits](go-openapi/swag@v0.22.4...v0.22.7) --- updated-dependencies: - dependency-name: github.com/go-openapi/swag dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Support UTF-8 label matchers: Add metrics to matchers compat package (prometheus#3658) * Add metrics to matchers compat package This commit adds the following metrics to the compat package: alertmanager_matchers_parse alertmanager_matchers_disagree alertmanager_matchers_incompatible alertmanager_matchers_invalid With a label called origin to differentiate the different sources of inputs: the configuration file, the API, and amtool. The disagree_total metric is incremented when an input is invalid in both parsers, but results in different parsed representations, then there is disagreement. This should not happen, and suggests their is either a bug in one of the parsers or a mistake in the backwards compatible guarantees of the matchers/parse parser. The incompatible_total metric is incremented when an input is valid in pkg/labels, but not the UTF-8 parser in matchers/parse. In such case, the matcher should be updated to be compatible. This often means adding double quotes around the right hand side of the matcher. For example, foo="bar". The invalid_total metric is incremented when an input is invalid in both parsers. This was never a valid input. The tests have been updated to check the metrics are incremented as expected. Signed-off-by: George Robinson <george.robinson@grafana.com> --------- Signed-off-by: George Robinson <george.robinson@grafana.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Change compat metrics to counters (prometheus#3686) This commit changes the metrics in the compat package from gauges to counters. The reason for this is that in some cases the gauge should behave like a gauge (i.e. loading configurations) but in other cases should behave like a counter (i.e. HTTP requests). Second, because the compat package is a global package (due to how config.Load works), in tenanted systems like Cortex and Mimir it was non-trivial to reset the gauges per tenant each time their configuration was reloaded. Instead, it's easier to compute the rate of increase as 0 instead of check that the gauge is 0 to know if UTF-8 strict mode can be enabled. Signed-off-by: George Robinson <george.robinson@grafana.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Bump github.com/go-openapi/errors from 0.20.4 to 0.21.0 Bumps [github.com/go-openapi/errors](https://github.com/go-openapi/errors) from 0.20.4 to 0.21.0. - [Commits](go-openapi/errors@v0.20.4...v0.21.0) --- updated-dependencies: - dependency-name: github.com/go-openapi/errors dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Bump github.com/go-openapi/swag from 0.22.7 to 0.22.9 Bumps [github.com/go-openapi/swag](https://github.com/go-openapi/swag) from 0.22.7 to 0.22.9. - [Commits](go-openapi/swag@v0.22.7...v0.22.9) --- updated-dependencies: - dependency-name: github.com/go-openapi/swag dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Bump eslint from 8.35.0 to 8.56.0 in /ui/react-app (prometheus#3692) Bumps [eslint](https://github.com/eslint/eslint) from 8.35.0 to 8.56.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](eslint/eslint@v8.35.0...v8.56.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Do not register compat metrics in amtool (prometheus#3713) There is no need to register these metrics in amtool, so use compat.NewMetrics(nil) instead of compat.RegisteredMetrics. Signed-off-by: George Robinson <george.robinson@grafana.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Remove metrics from compat package (prometheus#3714) This commit removes the metrics from the compat package in favour of the existing logging and the additional tools at hand, such as amtool, to validate Alertmanager configurations. Due to the global nature of the compat package, a consequence of config.Load, these metrics have proven to be less useful in practice than expected, both in Alertmanager and other projects such as Mimir. There are a number of reasons for this: 1. Because the compat package is global, these metrics cannot be reset each time config.Load is called, as in multi-tenant projects like Mimir loading a config for one tenant would reset the metrics for all tenants. This is also the reason the metrics are counters and not gauges. 2. Since the metrics are counters, it is difficult to create meaningful dashboards for Alertmanager as, unlike in Mimir, configurations are not reloaded at fixed intervals, and as such, operators cannot use rate to track configuration changes over time. In Alertmanager, there are much better tools available to validate that an Alertmanager configuration is compatible with the UTF-8 parser, including both the existing logging from Alertmanager server and amtool check-config. In other projects like Mimir, we can track configurations for individual tenants using log aggregation and storage systems such as Loki. This gives operators far more information than what is possible with the metrics, including the timestamp, input and ID of tenant configurations that are incompatible or have disagreement. Signed-off-by: George Robinson <george.robinson@grafana.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Fix the typo
th0th
added a commit
to th0th/alertmanager
that referenced
this pull request
Apr 18, 2024
Fix the typo Signed-off-by: Gokhan Sari <gokhan@sari.me> Update tests Signed-off-by: Gokhan Sari <gokhan@sari.me> Update documentation Signed-off-by: Gokhan Sari <gokhan@sari.me> Update notifiers_test.go Signed-off-by: Gokhan Sari <gokhan@sari.me> Update notifiers_test.go Signed-off-by: Gokhan Sari <gokhan@sari.me> Use int32 instead of int64 for MessageThreadID Signed-off-by: Gokhan Sari <gokhan@sari.me> Bump github.com/go-openapi/swag from 0.22.4 to 0.22.7 (prometheus#3655) Bumps [github.com/go-openapi/swag](https://github.com/go-openapi/swag) from 0.22.4 to 0.22.7. - [Commits](go-openapi/swag@v0.22.4...v0.22.7) --- updated-dependencies: - dependency-name: github.com/go-openapi/swag dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Support UTF-8 label matchers: Add metrics to matchers compat package (prometheus#3658) * Add metrics to matchers compat package This commit adds the following metrics to the compat package: alertmanager_matchers_parse alertmanager_matchers_disagree alertmanager_matchers_incompatible alertmanager_matchers_invalid With a label called origin to differentiate the different sources of inputs: the configuration file, the API, and amtool. The disagree_total metric is incremented when an input is invalid in both parsers, but results in different parsed representations, then there is disagreement. This should not happen, and suggests their is either a bug in one of the parsers or a mistake in the backwards compatible guarantees of the matchers/parse parser. The incompatible_total metric is incremented when an input is valid in pkg/labels, but not the UTF-8 parser in matchers/parse. In such case, the matcher should be updated to be compatible. This often means adding double quotes around the right hand side of the matcher. For example, foo="bar". The invalid_total metric is incremented when an input is invalid in both parsers. This was never a valid input. The tests have been updated to check the metrics are incremented as expected. Signed-off-by: George Robinson <george.robinson@grafana.com> --------- Signed-off-by: George Robinson <george.robinson@grafana.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Change compat metrics to counters (prometheus#3686) This commit changes the metrics in the compat package from gauges to counters. The reason for this is that in some cases the gauge should behave like a gauge (i.e. loading configurations) but in other cases should behave like a counter (i.e. HTTP requests). Second, because the compat package is a global package (due to how config.Load works), in tenanted systems like Cortex and Mimir it was non-trivial to reset the gauges per tenant each time their configuration was reloaded. Instead, it's easier to compute the rate of increase as 0 instead of check that the gauge is 0 to know if UTF-8 strict mode can be enabled. Signed-off-by: George Robinson <george.robinson@grafana.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Bump github.com/go-openapi/errors from 0.20.4 to 0.21.0 Bumps [github.com/go-openapi/errors](https://github.com/go-openapi/errors) from 0.20.4 to 0.21.0. - [Commits](go-openapi/errors@v0.20.4...v0.21.0) --- updated-dependencies: - dependency-name: github.com/go-openapi/errors dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Bump github.com/go-openapi/swag from 0.22.7 to 0.22.9 Bumps [github.com/go-openapi/swag](https://github.com/go-openapi/swag) from 0.22.7 to 0.22.9. - [Commits](go-openapi/swag@v0.22.7...v0.22.9) --- updated-dependencies: - dependency-name: github.com/go-openapi/swag dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Bump eslint from 8.35.0 to 8.56.0 in /ui/react-app (prometheus#3692) Bumps [eslint](https://github.com/eslint/eslint) from 8.35.0 to 8.56.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](eslint/eslint@v8.35.0...v8.56.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Do not register compat metrics in amtool (prometheus#3713) There is no need to register these metrics in amtool, so use compat.NewMetrics(nil) instead of compat.RegisteredMetrics. Signed-off-by: George Robinson <george.robinson@grafana.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Remove metrics from compat package (prometheus#3714) This commit removes the metrics from the compat package in favour of the existing logging and the additional tools at hand, such as amtool, to validate Alertmanager configurations. Due to the global nature of the compat package, a consequence of config.Load, these metrics have proven to be less useful in practice than expected, both in Alertmanager and other projects such as Mimir. There are a number of reasons for this: 1. Because the compat package is global, these metrics cannot be reset each time config.Load is called, as in multi-tenant projects like Mimir loading a config for one tenant would reset the metrics for all tenants. This is also the reason the metrics are counters and not gauges. 2. Since the metrics are counters, it is difficult to create meaningful dashboards for Alertmanager as, unlike in Mimir, configurations are not reloaded at fixed intervals, and as such, operators cannot use rate to track configuration changes over time. In Alertmanager, there are much better tools available to validate that an Alertmanager configuration is compatible with the UTF-8 parser, including both the existing logging from Alertmanager server and amtool check-config. In other projects like Mimir, we can track configurations for individual tenants using log aggregation and storage systems such as Loki. This gives operators far more information than what is possible with the metrics, including the timestamp, input and ID of tenant configurations that are incompatible or have disagreement. Signed-off-by: George Robinson <george.robinson@grafana.com> Signed-off-by: Gokhan Sari <gokhan@sari.me> Fix the typo Revert changes in unintended files
SuperQ
added a commit
that referenced
this pull request
Oct 16, 2024
* [CHANGE] Deprecate and remove api/v1/ #2970 * [CHANGE] Remove unused feature flags #3676 * [CHANGE] Newlines in smtp password file are now ignored #3681 * [CHANGE] Change compat metrics to counters #3686 * [CHANGE] Do not register compat metrics in amtool #3713 * [CHANGE] Remove metrics from compat package #3714 * [CHANGE] Mark muted alerts #3793 * [FEATURE] Add metric for inhibit rules #3681 * [FEATURE] Support UTF-8 label matchers #3453, #3507, #3523, #3483, #3567, #3568, #3569, #3571, #3595, #3604, #3619, #3658, #3659, #3662, #3668, 3572 * [FEATURE] Add counter to track alerts dropped outside of time_intervals #3565 * [FEATURE] Add date and tz functions to templates #3812 * [FEATURE] Add limits for silences #3852 * [FEATURE] Add time helpers for templates #3863 * [FEATURE] Add auto GOMAXPROCS #3837 * [FEATURE] Add auto GOMEMLIMIT #3895 * [FEATURE] Add Jira receiver integration #3590 * [ENHANCEMENT] Add the receiver name to notification metrics #3045 * [ENHANCEMENT] Add the route ID to uuid #3372 * [ENHANCEMENT] Add duration to the notify success message #3559 * [ENHANCEMENT] Implement webhook_url_file for discord and msteams #3555 * [ENHANCEMENT] Add debug logs for muted alerts #3558 * [ENHANCEMENT] API: Allow the Silences API to use their own 400 response #3610 * [ENHANCEMENT] Add summary to msteams notification #3616 * [ENHANCEMENT] Add context reasons to notifications failed counter #3631 * [ENHANCEMENT] Add optional native histogram support to latency metrics #3737 * [ENHANCEMENT] Enable setting ThreadId for Telegram notifications #3638 * [ENHANCEMENT] Allow webex roomID from template #3801 * [BUGFIX] Add missing integrations to notify metrics #3480 * [BUGFIX] Add missing ttl in pushhover #3474 * [BUGFIX] Fix scheme required for webhook url in amtool #3409 * [BUGFIX] Remove duplicate integration from metrics #3516 * [BUGFIX] Reflect Discord's max length message limits #3597 * [BUGFIX] Fix nil error in warn logs about incompatible matchers #3683 * [BUGFIX] Fix a small number of inconsistencies in compat package logging #3718 * [BUGFIX] Fix log line in featurecontrol #3719 * [BUGFIX] Fix panic in acceptance tests #3592 * [BUGFIX] Fix flaky test TestClusterJoinAndReconnect/TestTLSConnection #3722 * [BUGFIX] Fix crash on errors when url_file is used #3800 * [BUGFIX] Fix race condition in dispatch.go #3826 * [BUGFIX] Fix race conditions in the memory alerts store #3648 * [BUGFIX] Hide config.SecretURL when the URL is incorrect. #3887 * [BUGFIX] Fix invalid silence causes incomplete updates #3898 * [BUGFIX] Fix leaking of Silences matcherCache entries #3930 * [BUGFIX] Close SMTP submission correctly to handle errors #4006 Signed-off-by: SuperQ <superq@gmail.com>
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit removes the metrics from the compat package in favour of the existing logging and the additional tools at hand, such as amtool, to validate Alertmanager configurations.
Due to the global nature of the compat package, a consequence of
config.Load
, these metrics have proven to be less useful in practice than expected, both in Alertmanager and other projects such as Mimir.There are a number of reasons for this:
Because the compat package is global, these metrics cannot be reset each time
config.Load
is called, as in multi-tenant projects like Mimir loading a config for one tenant would reset the metrics for all tenants. This is also the reason the metrics are counters and not gauges.Since the metrics are counters, it is difficult to create meaningful dashboards for Alertmanager as, unlike in Mimir, configurations are not reloaded at fixed intervals, and as such, operators cannot use rate to track configuration changes over time.
In Alertmanager, there are much better tools available to validate that an Alertmanager configuration is compatible with the UTF-8 parser, including both the existing logging from Alertmanager server and
amtool check-config
.In other projects like Mimir, we can track configurations for individual tenants using log aggregation and storage systems such as Loki. This gives operators far more information than what is possible with the metrics, including the timestamp, input and ID of tenant configurations that are incompatible or have disagreement.