Fix UTF-8 not allowed in Equal field for inhibition rules#4177
Merged
SuperQ merged 1 commit intoprometheus:mainfrom Jan 13, 2025
Merged
Conversation
83e8f18 to
ed0e832
Compare
This commit fixes a bug where UTF-8 characters are not allowed in the Equal field for inhibition rules, even when UTF-8 strict mode is enabled. This bug occurred because we forgot to override the validation in model.LabelName. I have copied the same logic used for GroupBy with GroupByStr, adding EqualStr. We would like to upgrade prometheus/common in future and use the validation there instead, but it presents challenges with downstream projects like Mimir and Cortex where, at present, UTF-8 can be enabled and disabled in separate components at the same time, which is not supported in prometheus/common. Signed-off-by: George Robinson <george.robinson@grafana.com>
ed0e832 to
ee55078
Compare
Collaborator
Author
|
I did a full test of this, including the inhibiting behavior, and can confirm that it works. The first test was without an emoji in inhibit_rules:
- equal:
- baz
source_matchers:
- "foo\U0001F642=bar"
target_matchers:
- "bar\U0001F642=baz"and we can see that the alert was inhibited: [
{
"annotations": {},
"endsAt": "2024-12-21T02:23:33.061Z",
"fingerprint": "3381011f87e9020c",
"receivers": [
{
"name": "default"
}
],
"startsAt": "2024-12-21T02:18:33.061Z",
"status": {
"inhibitedBy": [
"c72bcc07a25e8ca7"
],
"mutedBy": null,
"silencedBy": [],
"state": "suppressed"
},
"updatedAt": "2024-12-21T02:18:33.061Z",
"labels": {
"bar🙂": "baz",
"baz": "corge"
}
},
{
"annotations": {},
"endsAt": "2024-12-21T02:23:27.690Z",
"fingerprint": "c72bcc07a25e8ca7",
"receivers": [
{
"name": "default"
}
],
"startsAt": "2024-12-21T02:18:27.690Z",
"status": {
"inhibitedBy": [],
"mutedBy": null,
"silencedBy": [],
"state": "active"
},
"updatedAt": "2024-12-21T02:18:27.690Z",
"labels": {
"baz": "corge",
"foo🙂": "bar"
}
}
]The second test used the same matchers, but inhibit_rules:
- equal:
- "baz\U0001F642"
source_matchers:
- "foo\U0001F642=bar"
target_matchers:
- "bar\U0001F642=baz"[
{
"annotations": {},
"endsAt": "2024-12-21T02:25:27.553Z",
"fingerprint": "50e470c7e420595a",
"receivers": [
{
"name": "default"
}
],
"startsAt": "2024-12-21T02:20:27.553Z",
"status": {
"inhibitedBy": [
"81366be48b8b7751"
],
"mutedBy": null,
"silencedBy": [],
"state": "suppressed"
},
"updatedAt": "2024-12-21T02:20:27.553Z",
"labels": {
"bar🙂": "baz",
"baz🙂": "corge"
}
},
{
"annotations": {},
"endsAt": "2024-12-21T02:25:21.385Z",
"fingerprint": "81366be48b8b7751",
"receivers": [
{
"name": "default"
}
],
"startsAt": "2024-12-21T02:20:21.385Z",
"status": {
"inhibitedBy": [],
"mutedBy": null,
"silencedBy": [],
"state": "active"
},
"updatedAt": "2024-12-21T02:20:21.385Z",
"labels": {
"baz🙂": "corge",
"foo🙂": "bar"
}
}
] |
Collaborator
Author
|
I also tested with two alerts that matched the target matchers, however, with the expectation that just one of those alerts is inhibited as it has a matching inhibit_rules:
- equal:
- baz
source_matchers:
- "foo\U0001F642=bar"
target_matchers:
- "bar\U0001F642=baz"[
{
"annotations": {},
"endsAt": "2024-12-21T02:32:55.511Z",
"fingerprint": "3381011f87e9020c",
"receivers": [
{
"name": "default"
}
],
"startsAt": "2024-12-21T02:27:55.511Z",
"status": {
"inhibitedBy": [
"c72bcc07a25e8ca7"
],
"mutedBy": null,
"silencedBy": [],
"state": "suppressed"
},
"updatedAt": "2024-12-21T02:27:55.511Z",
"labels": {
"bar🙂": "baz",
"baz": "corge"
}
},
{
"annotations": {},
"endsAt": "2024-12-21T02:33:00.138Z",
"fingerprint": "ae726b055d42000d",
"receivers": [
{
"name": "default"
}
],
"startsAt": "2024-12-21T02:28:00.138Z",
"status": {
"inhibitedBy": [],
"mutedBy": null,
"silencedBy": [],
"state": "active"
},
"updatedAt": "2024-12-21T02:28:00.138Z",
"labels": {
"bar🙂": "baz",
"baz": "jorge"
}
},
{
"annotations": {},
"endsAt": "2024-12-21T02:32:50.699Z",
"fingerprint": "c72bcc07a25e8ca7",
"receivers": [
{
"name": "default"
}
],
"startsAt": "2024-12-21T02:27:50.699Z",
"status": {
"inhibitedBy": [],
"mutedBy": null,
"silencedBy": [],
"state": "active"
},
"updatedAt": "2024-12-21T02:27:50.699Z",
"labels": {
"baz": "corge",
"foo🙂": "bar"
}
}
]The second test uses the same matchers, but the inhibit_rules:
- equal:
- "baz\U0001F642"
source_matchers:
- "foo\U0001F642=bar"
target_matchers:
- "bar\U0001F642=baz"[
{
"annotations": {},
"endsAt": "2024-12-21T02:35:58.223Z",
"fingerprint": "50e470c7e420595a",
"receivers": [
{
"name": "default"
}
],
"startsAt": "2024-12-21T02:30:58.223Z",
"status": {
"inhibitedBy": [
"81366be48b8b7751"
],
"mutedBy": null,
"silencedBy": [],
"state": "suppressed"
},
"updatedAt": "2024-12-21T02:30:58.223Z",
"labels": {
"bar🙂": "baz",
"baz🙂": "corge"
}
},
{
"annotations": {},
"endsAt": "2024-12-21T02:36:01.436Z",
"fingerprint": "5e88f11e42a70d0b",
"receivers": [
{
"name": "default"
}
],
"startsAt": "2024-12-21T02:31:01.436Z",
"status": {
"inhibitedBy": [],
"mutedBy": null,
"silencedBy": [],
"state": "active"
},
"updatedAt": "2024-12-21T02:31:01.436Z",
"labels": {
"bar🙂": "baz",
"baz🙂": "jorge"
}
},
{
"annotations": {},
"endsAt": "2024-12-21T02:35:54.303Z",
"fingerprint": "81366be48b8b7751",
"receivers": [
{
"name": "default"
}
],
"startsAt": "2024-12-21T02:30:54.303Z",
"status": {
"inhibitedBy": [],
"mutedBy": null,
"silencedBy": [],
"state": "active"
},
"updatedAt": "2024-12-21T02:30:54.303Z",
"labels": {
"baz🙂": "corge",
"foo🙂": "bar"
}
}
] |
Merged
SuperQ
added a commit
that referenced
this pull request
Jan 15, 2025
* [CHANGE] Templating errors in the SNS integration now return an error. #3531 #3879 * [CHANGE] Adopt log/slog, drop go-kit/log #4089 * [FEATURE] Add a new Microsoft Teams integration based on Flows #4024 * [FEATURE] Add a new Rocket.Chat integration #3600 * [FEATURE] Add a new Jira integration #3590 #3931 * [FEATURE] Add support for `GOMEMLIMIT`, enable it via the feature flag `--enable-feature=auto-gomemlimit`. #3895 * [FEATURE] Add support for `GOMAXPROCS`, enable it via the feature flag `--enable-feature=auto-gomaxprocs`. #3837 * [FEATURE] Add support for limits of silences including the maximum number of active and pending silences, and the maximum size per silence (in bytes). You can use the flags `--silences.max-silences` and `--silences.max-silence-size-bytes` to set them accordingly #3852 #3862 #3866 #3885 #3886 #3877 * [FEATURE] Muted alerts now show whether they are suppressed or not in both the `/api/v2/alerts` endpoint and the Alertmanager UI. #3793 #3797 #3792 * [ENHANCEMENT] Add support for `content`, `username` and `avatar_url` in the Discord integration. `content` and `username` also support templating. #4007 * [ENHANCEMENT] Only invalidate the silences cache if a new silence is created or an existing silence replaced - should improve latency on both `GET api/v2/alerts` and `POST api/v2/alerts` API endpoint. #3961 * [ENHANCEMENT] Add image source label to Dockerfile. To get changelogs shown when using Renovate #4062 * [ENHANCEMENT] Build using go 1.23 #4071 * [ENHANCEMENT] Support setting a global SMTP TLS configuration. #3732 * [ENHANCEMENT] The setting `room_id` in the WebEx integration can now be templated to allow for dynamic room IDs. #3801 * [ENHANCEMENT] Enable setting `message_thread_id` for the Telegram integration. #3638 * [ENHANCEMENT] Support the `since` and `humanizeDuration` functions to templates. This means users can now format time to more human-readable text. #3863 * [ENHANCEMENT] Support the `date` and `tz` functions to templates. This means users can now format time in a specified format and also change the timezone to their specific locale. #3812 * [ENHANCEMENT] Latency metrics now support native histograms. #3737 * [ENHANCEMENT] Add full width to adaptive card for msteamsv2 #4135 * [ENHANCEMENT] Add timeout option for webhook notifier. #4137 * [ENHANCEMENT] Update config to allow showing secret values when marshaled #4158 * [ENHANCEMENT] Enable templating for Jira project and issue_type #4159 * [BUGFIX] Fix the SMTP integration not correctly closing an SMTP submission, which may lead to unsuccessful dispatches being marked as successful. #4006 * [BUGFIX] The `ParseMode` option is now set explicitly in the Telegram integration. If we don't HTML tags had not been parsed by default. #4027 * [BUGFIX] Fix a memory leak that was caused by updates silences continuously. #3930 * [BUGFIX] Fix hiding secret URLs when the URL is incorrect. #3887 * [BUGFIX] Fix a race condition in the alerts - it was more of a hypothetical race condition that could have occurred in the alert reception pipeline. #3648 * [BUGFIX] Fix a race condition in the alert delivery pipeline that would cause a firing alert that was delivered earlier to be deleted from the aggregation group when instead it should have been delivered again. #3826 * [BUGFIX] Fix version in APIv1 deprecation notice. #3815 * [BUGFIX] Fix crash errors when using `url_file` in the Webhook integration. #3800 * [BUGFIX] fix `Route.ID()` returns conflicting IDs. #3803 * [BUGFIX] Fix deadlock on the alerts memory store. #3715 * [BUGFIX] Fix `amtool template render` when using the default values. #3725 * [BUGFIX] Fix `webhook_url_file` for both the Discord and Microsoft Teams integrations. #3728 #3745 * [BUGFIX] Fix wechat api link #4084 * [BUGFIX] Fix build info metric #4166 * [BUGFIX] Fix UTF-8 not allowed in Equal field for inhibition rules #4177 Signed-off-by: SuperQ <superq@gmail.com>
SuperQ
added a commit
that referenced
this pull request
Jan 15, 2025
* [CHANGE] Templating errors in the SNS integration now return an error. #3531 #3879 * [CHANGE] Adopt log/slog, drop go-kit/log #4089 * [FEATURE] Add a new Microsoft Teams integration based on Flows #4024 * [FEATURE] Add a new Rocket.Chat integration #3600 * [FEATURE] Add a new Jira integration #3590 #3931 * [FEATURE] Add support for `GOMEMLIMIT`, enable it via the feature flag `--enable-feature=auto-gomemlimit`. #3895 * [FEATURE] Add support for `GOMAXPROCS`, enable it via the feature flag `--enable-feature=auto-gomaxprocs`. #3837 * [FEATURE] Add support for limits of silences including the maximum number of active and pending silences, and the maximum size per silence (in bytes). You can use the flags `--silences.max-silences` and `--silences.max-silence-size-bytes` to set them accordingly #3852 #3862 #3866 #3885 #3886 #3877 * [FEATURE] Muted alerts now show whether they are suppressed or not in both the `/api/v2/alerts` endpoint and the Alertmanager UI. #3793 #3797 #3792 * [ENHANCEMENT] Add support for `content`, `username` and `avatar_url` in the Discord integration. `content` and `username` also support templating. #4007 * [ENHANCEMENT] Only invalidate the silences cache if a new silence is created or an existing silence replaced - should improve latency on both `GET api/v2/alerts` and `POST api/v2/alerts` API endpoint. #3961 * [ENHANCEMENT] Add image source label to Dockerfile. To get changelogs shown when using Renovate #4062 * [ENHANCEMENT] Build using go 1.23 #4071 * [ENHANCEMENT] Support setting a global SMTP TLS configuration. #3732 * [ENHANCEMENT] The setting `room_id` in the WebEx integration can now be templated to allow for dynamic room IDs. #3801 * [ENHANCEMENT] Enable setting `message_thread_id` for the Telegram integration. #3638 * [ENHANCEMENT] Support the `since` and `humanizeDuration` functions to templates. This means users can now format time to more human-readable text. #3863 * [ENHANCEMENT] Support the `date` and `tz` functions to templates. This means users can now format time in a specified format and also change the timezone to their specific locale. #3812 * [ENHANCEMENT] Latency metrics now support native histograms. #3737 * [ENHANCEMENT] Add full width to adaptive card for msteamsv2 #4135 * [ENHANCEMENT] Add timeout option for webhook notifier. #4137 * [ENHANCEMENT] Update config to allow showing secret values when marshaled #4158 * [ENHANCEMENT] Enable templating for Jira project and issue_type #4159 * [BUGFIX] Fix the SMTP integration not correctly closing an SMTP submission, which may lead to unsuccessful dispatches being marked as successful. #4006 * [BUGFIX] The `ParseMode` option is now set explicitly in the Telegram integration. If we don't HTML tags had not been parsed by default. #4027 * [BUGFIX] Fix a memory leak that was caused by updates silences continuously. #3930 * [BUGFIX] Fix hiding secret URLs when the URL is incorrect. #3887 * [BUGFIX] Fix a race condition in the alerts - it was more of a hypothetical race condition that could have occurred in the alert reception pipeline. #3648 * [BUGFIX] Fix a race condition in the alert delivery pipeline that would cause a firing alert that was delivered earlier to be deleted from the aggregation group when instead it should have been delivered again. #3826 * [BUGFIX] Fix version in APIv1 deprecation notice. #3815 * [BUGFIX] Fix crash errors when using `url_file` in the Webhook integration. #3800 * [BUGFIX] fix `Route.ID()` returns conflicting IDs. #3803 * [BUGFIX] Fix deadlock on the alerts memory store. #3715 * [BUGFIX] Fix `amtool template render` when using the default values. #3725 * [BUGFIX] Fix `webhook_url_file` for both the Discord and Microsoft Teams integrations. #3728 #3745 * [BUGFIX] Fix wechat api link #4084 * [BUGFIX] Fix build info metric #4166 * [BUGFIX] Fix UTF-8 not allowed in Equal field for inhibition rules #4177 Signed-off-by: SuperQ <superq@gmail.com>
SuperQ
added a commit
that referenced
this pull request
Jan 15, 2025
* [CHANGE] Templating errors in the SNS integration now return an error. #3531 #3879 * [CHANGE] Adopt log/slog, drop go-kit/log #4089 * [FEATURE] Add a new Microsoft Teams integration based on Flows #4024 * [FEATURE] Add a new Rocket.Chat integration #3600 * [FEATURE] Add a new Jira integration #3590 #3931 * [FEATURE] Add support for `GOMEMLIMIT`, enable it via the feature flag `--enable-feature=auto-gomemlimit`. #3895 * [FEATURE] Add support for `GOMAXPROCS`, enable it via the feature flag `--enable-feature=auto-gomaxprocs`. #3837 * [FEATURE] Add support for limits of silences including the maximum number of active and pending silences, and the maximum size per silence (in bytes). You can use the flags `--silences.max-silences` and `--silences.max-silence-size-bytes` to set them accordingly #3852 #3862 #3866 #3885 #3886 #3877 * [FEATURE] Muted alerts now show whether they are suppressed or not in both the `/api/v2/alerts` endpoint and the Alertmanager UI. #3793 #3797 #3792 * [ENHANCEMENT] Add support for `content`, `username` and `avatar_url` in the Discord integration. `content` and `username` also support templating. #4007 * [ENHANCEMENT] Only invalidate the silences cache if a new silence is created or an existing silence replaced - should improve latency on both `GET api/v2/alerts` and `POST api/v2/alerts` API endpoint. #3961 * [ENHANCEMENT] Add image source label to Dockerfile. To get changelogs shown when using Renovate #4062 * [ENHANCEMENT] Build using go 1.23 #4071 * [ENHANCEMENT] Support setting a global SMTP TLS configuration. #3732 * [ENHANCEMENT] The setting `room_id` in the WebEx integration can now be templated to allow for dynamic room IDs. #3801 * [ENHANCEMENT] Enable setting `message_thread_id` for the Telegram integration. #3638 * [ENHANCEMENT] Support the `since` and `humanizeDuration` functions to templates. This means users can now format time to more human-readable text. #3863 * [ENHANCEMENT] Support the `date` and `tz` functions to templates. This means users can now format time in a specified format and also change the timezone to their specific locale. #3812 * [ENHANCEMENT] Latency metrics now support native histograms. #3737 * [ENHANCEMENT] Add full width to adaptive card for msteamsv2 #4135 * [ENHANCEMENT] Add timeout option for webhook notifier. #4137 * [ENHANCEMENT] Update config to allow showing secret values when marshaled #4158 * [ENHANCEMENT] Enable templating for Jira project and issue_type #4159 * [BUGFIX] Fix the SMTP integration not correctly closing an SMTP submission, which may lead to unsuccessful dispatches being marked as successful. #4006 * [BUGFIX] The `ParseMode` option is now set explicitly in the Telegram integration. If we don't HTML tags had not been parsed by default. #4027 * [BUGFIX] Fix a memory leak that was caused by updates silences continuously. #3930 * [BUGFIX] Fix hiding secret URLs when the URL is incorrect. #3887 * [BUGFIX] Fix a race condition in the alerts - it was more of a hypothetical race condition that could have occurred in the alert reception pipeline. #3648 * [BUGFIX] Fix a race condition in the alert delivery pipeline that would cause a firing alert that was delivered earlier to be deleted from the aggregation group when instead it should have been delivered again. #3826 * [BUGFIX] Fix version in APIv1 deprecation notice. #3815 * [BUGFIX] Fix crash errors when using `url_file` in the Webhook integration. #3800 * [BUGFIX] fix `Route.ID()` returns conflicting IDs. #3803 * [BUGFIX] Fix deadlock on the alerts memory store. #3715 * [BUGFIX] Fix `amtool template render` when using the default values. #3725 * [BUGFIX] Fix `webhook_url_file` for both the Discord and Microsoft Teams integrations. #3728 #3745 * [BUGFIX] Fix wechat api link #4084 * [BUGFIX] Fix build info metric #4166 * [BUGFIX] Fix UTF-8 not allowed in Equal field for inhibition rules #4177 Signed-off-by: SuperQ <superq@gmail.com>
SuperQ
added a commit
that referenced
this pull request
Jan 15, 2025
* [CHANGE] Templating errors in the SNS integration now return an error. #3531 #3879 * [CHANGE] Adopt log/slog, drop go-kit/log #4089 * [FEATURE] Add a new Microsoft Teams integration based on Flows #4024 * [FEATURE] Add a new Rocket.Chat integration #3600 * [FEATURE] Add a new Jira integration #3590 #3931 * [FEATURE] Add support for `GOMEMLIMIT`, enable it via the feature flag `--enable-feature=auto-gomemlimit`. #3895 * [FEATURE] Add support for `GOMAXPROCS`, enable it via the feature flag `--enable-feature=auto-gomaxprocs`. #3837 * [FEATURE] Add support for limits of silences including the maximum number of active and pending silences, and the maximum size per silence (in bytes). You can use the flags `--silences.max-silences` and `--silences.max-silence-size-bytes` to set them accordingly #3852 #3862 #3866 #3885 #3886 #3877 * [FEATURE] Muted alerts now show whether they are suppressed or not in both the `/api/v2/alerts` endpoint and the Alertmanager UI. #3793 #3797 #3792 * [ENHANCEMENT] Add support for `content`, `username` and `avatar_url` in the Discord integration. `content` and `username` also support templating. #4007 * [ENHANCEMENT] Only invalidate the silences cache if a new silence is created or an existing silence replaced - should improve latency on both `GET api/v2/alerts` and `POST api/v2/alerts` API endpoint. #3961 * [ENHANCEMENT] Add image source label to Dockerfile. To get changelogs shown when using Renovate #4062 * [ENHANCEMENT] Build using go 1.23 #4071 * [ENHANCEMENT] Support setting a global SMTP TLS configuration. #3732 * [ENHANCEMENT] The setting `room_id` in the WebEx integration can now be templated to allow for dynamic room IDs. #3801 * [ENHANCEMENT] Enable setting `message_thread_id` for the Telegram integration. #3638 * [ENHANCEMENT] Support the `since` and `humanizeDuration` functions to templates. This means users can now format time to more human-readable text. #3863 * [ENHANCEMENT] Support the `date` and `tz` functions to templates. This means users can now format time in a specified format and also change the timezone to their specific locale. #3812 * [ENHANCEMENT] Latency metrics now support native histograms. #3737 * [ENHANCEMENT] Add full width to adaptive card for msteamsv2 #4135 * [ENHANCEMENT] Add timeout option for webhook notifier. #4137 * [ENHANCEMENT] Update config to allow showing secret values when marshaled #4158 * [ENHANCEMENT] Enable templating for Jira project and issue_type #4159 * [BUGFIX] Fix the SMTP integration not correctly closing an SMTP submission, which may lead to unsuccessful dispatches being marked as successful. #4006 * [BUGFIX] The `ParseMode` option is now set explicitly in the Telegram integration. If we don't HTML tags had not been parsed by default. #4027 * [BUGFIX] Fix a memory leak that was caused by updates silences continuously. #3930 * [BUGFIX] Fix hiding secret URLs when the URL is incorrect. #3887 * [BUGFIX] Fix a race condition in the alerts - it was more of a hypothetical race condition that could have occurred in the alert reception pipeline. #3648 * [BUGFIX] Fix a race condition in the alert delivery pipeline that would cause a firing alert that was delivered earlier to be deleted from the aggregation group when instead it should have been delivered again. #3826 * [BUGFIX] Fix version in APIv1 deprecation notice. #3815 * [BUGFIX] Fix crash errors when using `url_file` in the Webhook integration. #3800 * [BUGFIX] fix `Route.ID()` returns conflicting IDs. #3803 * [BUGFIX] Fix deadlock on the alerts memory store. #3715 * [BUGFIX] Fix `amtool template render` when using the default values. #3725 * [BUGFIX] Fix `webhook_url_file` for both the Discord and Microsoft Teams integrations. #3728 #3745 * [BUGFIX] Fix wechat api link #4084 * [BUGFIX] Fix build info metric #4166 * [BUGFIX] Fix UTF-8 not allowed in Equal field for inhibition rules #4177 Signed-off-by: SuperQ <superq@gmail.com>
heartwilltell
pushed a commit
to heartwilltell/alertmanager
that referenced
this pull request
Jan 28, 2025
* [CHANGE] Templating errors in the SNS integration now return an error. prometheus#3531 prometheus#3879 * [CHANGE] Adopt log/slog, drop go-kit/log prometheus#4089 * [FEATURE] Add a new Microsoft Teams integration based on Flows prometheus#4024 * [FEATURE] Add a new Rocket.Chat integration prometheus#3600 * [FEATURE] Add a new Jira integration prometheus#3590 prometheus#3931 * [FEATURE] Add support for `GOMEMLIMIT`, enable it via the feature flag `--enable-feature=auto-gomemlimit`. prometheus#3895 * [FEATURE] Add support for `GOMAXPROCS`, enable it via the feature flag `--enable-feature=auto-gomaxprocs`. prometheus#3837 * [FEATURE] Add support for limits of silences including the maximum number of active and pending silences, and the maximum size per silence (in bytes). You can use the flags `--silences.max-silences` and `--silences.max-silence-size-bytes` to set them accordingly prometheus#3852 prometheus#3862 prometheus#3866 prometheus#3885 prometheus#3886 prometheus#3877 * [FEATURE] Muted alerts now show whether they are suppressed or not in both the `/api/v2/alerts` endpoint and the Alertmanager UI. prometheus#3793 prometheus#3797 prometheus#3792 * [ENHANCEMENT] Add support for `content`, `username` and `avatar_url` in the Discord integration. `content` and `username` also support templating. prometheus#4007 * [ENHANCEMENT] Only invalidate the silences cache if a new silence is created or an existing silence replaced - should improve latency on both `GET api/v2/alerts` and `POST api/v2/alerts` API endpoint. prometheus#3961 * [ENHANCEMENT] Add image source label to Dockerfile. To get changelogs shown when using Renovate prometheus#4062 * [ENHANCEMENT] Build using go 1.23 prometheus#4071 * [ENHANCEMENT] Support setting a global SMTP TLS configuration. prometheus#3732 * [ENHANCEMENT] The setting `room_id` in the WebEx integration can now be templated to allow for dynamic room IDs. prometheus#3801 * [ENHANCEMENT] Enable setting `message_thread_id` for the Telegram integration. prometheus#3638 * [ENHANCEMENT] Support the `since` and `humanizeDuration` functions to templates. This means users can now format time to more human-readable text. prometheus#3863 * [ENHANCEMENT] Support the `date` and `tz` functions to templates. This means users can now format time in a specified format and also change the timezone to their specific locale. prometheus#3812 * [ENHANCEMENT] Latency metrics now support native histograms. prometheus#3737 * [ENHANCEMENT] Add full width to adaptive card for msteamsv2 prometheus#4135 * [ENHANCEMENT] Add timeout option for webhook notifier. prometheus#4137 * [ENHANCEMENT] Update config to allow showing secret values when marshaled prometheus#4158 * [ENHANCEMENT] Enable templating for Jira project and issue_type prometheus#4159 * [BUGFIX] Fix the SMTP integration not correctly closing an SMTP submission, which may lead to unsuccessful dispatches being marked as successful. prometheus#4006 * [BUGFIX] The `ParseMode` option is now set explicitly in the Telegram integration. If we don't HTML tags had not been parsed by default. prometheus#4027 * [BUGFIX] Fix a memory leak that was caused by updates silences continuously. prometheus#3930 * [BUGFIX] Fix hiding secret URLs when the URL is incorrect. prometheus#3887 * [BUGFIX] Fix a race condition in the alerts - it was more of a hypothetical race condition that could have occurred in the alert reception pipeline. prometheus#3648 * [BUGFIX] Fix a race condition in the alert delivery pipeline that would cause a firing alert that was delivered earlier to be deleted from the aggregation group when instead it should have been delivered again. prometheus#3826 * [BUGFIX] Fix version in APIv1 deprecation notice. prometheus#3815 * [BUGFIX] Fix crash errors when using `url_file` in the Webhook integration. prometheus#3800 * [BUGFIX] fix `Route.ID()` returns conflicting IDs. prometheus#3803 * [BUGFIX] Fix deadlock on the alerts memory store. prometheus#3715 * [BUGFIX] Fix `amtool template render` when using the default values. prometheus#3725 * [BUGFIX] Fix `webhook_url_file` for both the Discord and Microsoft Teams integrations. prometheus#3728 prometheus#3745 * [BUGFIX] Fix wechat api link prometheus#4084 * [BUGFIX] Fix build info metric prometheus#4166 * [BUGFIX] Fix UTF-8 not allowed in Equal field for inhibition rules prometheus#4177 Signed-off-by: SuperQ <superq@gmail.com> Signed-off-by: heartwilltell <heartwilltell@gmail.com>
heartwilltell
pushed a commit
to heartwilltell/alertmanager
that referenced
this pull request
Jan 28, 2025
* [CHANGE] Templating errors in the SNS integration now return an error. prometheus#3531 prometheus#3879 * [CHANGE] Adopt log/slog, drop go-kit/log prometheus#4089 * [FEATURE] Add a new Microsoft Teams integration based on Flows prometheus#4024 * [FEATURE] Add a new Rocket.Chat integration prometheus#3600 * [FEATURE] Add a new Jira integration prometheus#3590 prometheus#3931 * [FEATURE] Add support for `GOMEMLIMIT`, enable it via the feature flag `--enable-feature=auto-gomemlimit`. prometheus#3895 * [FEATURE] Add support for `GOMAXPROCS`, enable it via the feature flag `--enable-feature=auto-gomaxprocs`. prometheus#3837 * [FEATURE] Add support for limits of silences including the maximum number of active and pending silences, and the maximum size per silence (in bytes). You can use the flags `--silences.max-silences` and `--silences.max-silence-size-bytes` to set them accordingly prometheus#3852 prometheus#3862 prometheus#3866 prometheus#3885 prometheus#3886 prometheus#3877 * [FEATURE] Muted alerts now show whether they are suppressed or not in both the `/api/v2/alerts` endpoint and the Alertmanager UI. prometheus#3793 prometheus#3797 prometheus#3792 * [ENHANCEMENT] Add support for `content`, `username` and `avatar_url` in the Discord integration. `content` and `username` also support templating. prometheus#4007 * [ENHANCEMENT] Only invalidate the silences cache if a new silence is created or an existing silence replaced - should improve latency on both `GET api/v2/alerts` and `POST api/v2/alerts` API endpoint. prometheus#3961 * [ENHANCEMENT] Add image source label to Dockerfile. To get changelogs shown when using Renovate prometheus#4062 * [ENHANCEMENT] Build using go 1.23 prometheus#4071 * [ENHANCEMENT] Support setting a global SMTP TLS configuration. prometheus#3732 * [ENHANCEMENT] The setting `room_id` in the WebEx integration can now be templated to allow for dynamic room IDs. prometheus#3801 * [ENHANCEMENT] Enable setting `message_thread_id` for the Telegram integration. prometheus#3638 * [ENHANCEMENT] Support the `since` and `humanizeDuration` functions to templates. This means users can now format time to more human-readable text. prometheus#3863 * [ENHANCEMENT] Support the `date` and `tz` functions to templates. This means users can now format time in a specified format and also change the timezone to their specific locale. prometheus#3812 * [ENHANCEMENT] Latency metrics now support native histograms. prometheus#3737 * [ENHANCEMENT] Add full width to adaptive card for msteamsv2 prometheus#4135 * [ENHANCEMENT] Add timeout option for webhook notifier. prometheus#4137 * [ENHANCEMENT] Update config to allow showing secret values when marshaled prometheus#4158 * [ENHANCEMENT] Enable templating for Jira project and issue_type prometheus#4159 * [BUGFIX] Fix the SMTP integration not correctly closing an SMTP submission, which may lead to unsuccessful dispatches being marked as successful. prometheus#4006 * [BUGFIX] The `ParseMode` option is now set explicitly in the Telegram integration. If we don't HTML tags had not been parsed by default. prometheus#4027 * [BUGFIX] Fix a memory leak that was caused by updates silences continuously. prometheus#3930 * [BUGFIX] Fix hiding secret URLs when the URL is incorrect. prometheus#3887 * [BUGFIX] Fix a race condition in the alerts - it was more of a hypothetical race condition that could have occurred in the alert reception pipeline. prometheus#3648 * [BUGFIX] Fix a race condition in the alert delivery pipeline that would cause a firing alert that was delivered earlier to be deleted from the aggregation group when instead it should have been delivered again. prometheus#3826 * [BUGFIX] Fix version in APIv1 deprecation notice. prometheus#3815 * [BUGFIX] Fix crash errors when using `url_file` in the Webhook integration. prometheus#3800 * [BUGFIX] fix `Route.ID()` returns conflicting IDs. prometheus#3803 * [BUGFIX] Fix deadlock on the alerts memory store. prometheus#3715 * [BUGFIX] Fix `amtool template render` when using the default values. prometheus#3725 * [BUGFIX] Fix `webhook_url_file` for both the Discord and Microsoft Teams integrations. prometheus#3728 prometheus#3745 * [BUGFIX] Fix wechat api link prometheus#4084 * [BUGFIX] Fix build info metric prometheus#4166 * [BUGFIX] Fix UTF-8 not allowed in Equal field for inhibition rules prometheus#4177 Signed-off-by: SuperQ <superq@gmail.com> Signed-off-by: heartwilltell <heartwilltell@gmail.com>
4 tasks
santihernandezc
pushed a commit
to grafana/alerting
that referenced
this pull request
Mar 3, 2025
Add tests for inhibit rules Equals and EqualsStr This commit adds tests for decoding inhibition rules as JSON and YAML, to make sure that the new EqualsStr field is decoded into Equals. See prometheus/alertmanager#4177.
grobinson-grafana
added a commit
to grobinson-grafana/alertmanager
that referenced
this pull request
Mar 5, 2025
This commit fixes a subtle bug introduced in prometheus#4177 where external code that imports config.InhibitRule for the purpose of JSON/YAML encoding can encode an inhibition rule with missing equals labels. This bug will happen if someone updates their Go modules, writes labels to the Equal field, and does not also write the same labels to the EqualStr field. To fix this, I propose removing EqualStr and changing Equal from model.LabelNames to []string. This will cause an intentional breaking change, and require the maintainer of downstream code to use []string instead of model.LabelNames. I consider this a better option to the subtle bug explained earlier. This still keeps the fix for prometheus#4177, but does so with an explicit breaking change to downstream users.
grobinson-grafana
added a commit
to grobinson-grafana/alertmanager
that referenced
this pull request
Mar 5, 2025
This commit fixes a subtle bug introduced in prometheus#4177 where external code that imports config.InhibitRule for the purpose of JSON/YAML encoding can encode an inhibition rule with missing equals labels. This bug will happen if someone updates their Go modules, writes labels to the Equal field, and does not also write the same labels to the EqualStr field. To fix this, I propose removing EqualStr and changing Equal from model.LabelNames to []string. This will cause an intentional breaking change, and require the maintainer of downstream code to use []string instead of model.LabelNames. I consider this a better option to the subtle bug explained earlier. This still keeps the fix for prometheus#4177, but does so with an explicit breaking change to downstream users. Signed-off-by: George Robinson <george.robinson@grafana.com>
grobinson-grafana
added a commit
to grobinson-grafana/alertmanager
that referenced
this pull request
Mar 5, 2025
This commit fixes a subtle bug introduced in prometheus#4177 where external code that imports config.InhibitRule for the purpose of JSON/YAML encoding can encode an inhibition rule with missing equals labels. This bug will happen if someone updates their Go modules, writes labels to the Equal field, and does not also write the same labels to the EqualStr field. To fix this, I propose removing EqualStr and changing Equal from model.LabelNames to []string. This will cause an intentional breaking change, and require the maintainer of downstream code to use []string instead of model.LabelNames. I consider this a better option to the subtle bug explained earlier. This still keeps the fix for prometheus#4177, but does so with an explicit breaking change to downstream users. Signed-off-by: George Robinson <george.robinson@grafana.com>
grobinson-grafana
added a commit
to grobinson-grafana/alertmanager
that referenced
this pull request
Mar 5, 2025
This commit fixes a subtle bug introduced in prometheus#4177 where external code that imports config.InhibitRule for the purpose of JSON/YAML encoding can encode an inhibition rule with missing equals labels. This bug will happen if someone updates their Go modules, writes labels to the Equal field, and does not also write the same labels to the EqualStr field. To fix this, I propose removing EqualStr and changing Equal from model.LabelNames to []string. This will cause an intentional breaking change, and require the maintainer of downstream code to use []string instead of model.LabelNames. I consider this a better option to the subtle bug explained earlier. This still keeps the fix for prometheus#4177, but does so with an explicit breaking change to downstream users. Signed-off-by: George Robinson <george.robinson@grafana.com>
grobinson-grafana
added a commit
to grobinson-grafana/alertmanager
that referenced
this pull request
Apr 11, 2025
This commit fixes a subtle bug introduced in prometheus#4177 where external code that imports config.InhibitRule for the purpose of JSON/YAML encoding can encode an inhibition rule with missing equals labels. This bug will happen if someone updates their Go modules, writes labels to the Equal field, and does not also write the same labels to the EqualStr field. To fix this, I propose removing EqualStr and changing Equal from model.LabelNames to []string. This will cause an intentional breaking change, and require the maintainer of downstream code to use []string instead of model.LabelNames. I consider this a better option to the subtle bug explained earlier. This still keeps the fix for prometheus#4177, but does so with an explicit breaking change to downstream users. Signed-off-by: George Robinson <george.robinson@grafana.com>
grobinson-grafana
added a commit
to grobinson-grafana/alertmanager
that referenced
this pull request
Apr 11, 2025
This commit fixes a subtle bug introduced in prometheus#4177 where external code that imports config.InhibitRule for the purpose of JSON/YAML encoding can encode an inhibition rule with missing equals labels. This bug will happen if someone updates their Go modules, writes labels to the Equal field, and does not also write the same labels to the EqualStr field. To fix this, I propose removing EqualStr and changing Equal from model.LabelNames to []string. This will cause an intentional breaking change, and require the maintainer of downstream code to use []string instead of model.LabelNames. I consider this a better option to the subtle bug explained earlier. This still keeps the fix for prometheus#4177, but does so with an explicit breaking change to downstream users. Signed-off-by: George Robinson <george.robinson@grafana.com>
grobinson-grafana
added a commit
to grobinson-grafana/alertmanager
that referenced
this pull request
Apr 11, 2025
This commit fixes a subtle bug introduced in prometheus#4177 where external code that imports config.InhibitRule for the purpose of JSON/YAML encoding can encode an inhibition rule with missing equals labels. This bug will happen if someone updates their Go modules, writes labels to the Equal field, and does not also write the same labels to the EqualStr field. To fix this, I propose removing EqualStr and changing Equal from model.LabelNames to []string. This will cause an intentional breaking change, and require the maintainer of downstream code to use []string instead of model.LabelNames. I consider this a better option to the subtle bug explained earlier. This still keeps the fix for prometheus#4177, but does so with an explicit breaking change to downstream users. Signed-off-by: George Robinson <george.robinson@grafana.com>
grobinson-grafana
added a commit
to grobinson-grafana/alertmanager
that referenced
this pull request
Apr 11, 2025
This commit fixes a subtle bug introduced in prometheus#4177 where external code that imports config.InhibitRule for the purpose of JSON/YAML encoding can encode an inhibition rule with missing equals labels. This bug will happen if someone updates their Go modules, writes labels to the Equal field, and does not also write the same labels to the EqualStr field. To fix this, I propose removing EqualStr and changing Equal from model.LabelNames to []string. This will cause an intentional breaking change, and require the maintainer of downstream code to use []string instead of model.LabelNames. I consider this a better option to the subtle bug explained earlier. This still keeps the fix for prometheus#4177, but does so with an explicit breaking change to downstream users. Signed-off-by: George Robinson <george.robinson@grafana.com>
titolins
pushed a commit
to grafana/prometheus-alertmanager
that referenced
this pull request
May 19, 2025
This commit fixes a subtle bug introduced in prometheus#4177 where external code that imports config.InhibitRule for the purpose of JSON/YAML encoding can encode an inhibition rule with missing equals labels. This bug will happen if someone updates their Go modules, writes labels to the Equal field, and does not also write the same labels to the EqualStr field. To fix this, I propose removing EqualStr and changing Equal from model.LabelNames to []string. This will cause an intentional breaking change, and require the maintainer of downstream code to use []string instead of model.LabelNames. I consider this a better option to the subtle bug explained earlier. This still keeps the fix for prometheus#4177, but does so with an explicit breaking change to downstream users. Signed-off-by: George Robinson <george.robinson@grafana.com>
titolins
pushed a commit
to grafana/prometheus-alertmanager
that referenced
this pull request
May 21, 2025
This commit fixes a subtle bug introduced in prometheus#4177 where external code that imports config.InhibitRule for the purpose of JSON/YAML encoding can encode an inhibition rule with missing equals labels. This bug will happen if someone updates their Go modules, writes labels to the Equal field, and does not also write the same labels to the EqualStr field. To fix this, I propose removing EqualStr and changing Equal from model.LabelNames to []string. This will cause an intentional breaking change, and require the maintainer of downstream code to use []string instead of model.LabelNames. I consider this a better option to the subtle bug explained earlier. This still keeps the fix for prometheus#4177, but does so with an explicit breaking change to downstream users. Signed-off-by: George Robinson <george.robinson@grafana.com>
rwwiv
pushed a commit
to grafana/alerting
that referenced
this pull request
Jul 29, 2025
Add tests for inhibit rules Equals and EqualsStr This commit adds tests for decoding inhibition rules as JSON and YAML, to make sure that the new EqualsStr field is decoded into Equals. See prometheus/alertmanager#4177.
rwwiv
added a commit
to grafana/alerting
that referenced
this pull request
Jul 29, 2025
* Alerting: Adding color option for slack receiver (#270) Adding color option for slack receiver Closes #251 Related to grafana/grafana#99615 * Update victorops to support loading url from secrets (#272) * Add experimental stage that will catch race conditions between nflog and pipeline (#268) * Alerting: Refactor extendAlert function (#267) * Alerting: Refactor extendAlert function Clean it up to require less mutation of a single url.URL struct. Now uses a baseURL + shallow copying in distinct generator functions. * Reorder field calculations to prevent early returns from unrelated parse errors * Debug -> Warn * Move orgID setQueryParam to baseURL * Add EmbeddedContents and use in email notifier (#275) * Add EmbeddedContents to email sender and use in email notifier * Revert "Validate retry and expire in Pushover receiver (#233)" (#244) This reverts commit 70248a7. * Add more context to log in PipelineAndStateTimestampCoordinationStage (#277) * add more context to warning log * add integration and receiver names * Update notify/stages/coordination_stage.go Co-authored-by: Tito Lins <tito.linsesilva@grafana.com> --------- Co-authored-by: Tito Lins <tito.linsesilva@grafana.com> * Update Alertmanager fork to latest commit (#279) Ad upstream jira integration * Copy http client from Grafana (#281) * copy from Grafana * make client implement interface * move comment * make user agent configurable to be able to use in mimir * copy tests from mimir * refactor BuildReceiverIntegrations to accept config instead of factory * remove useless tests * lint * Alerting: Fix token-based Slack image upload to work with channel names (#284) * Alerting: Fix slack image upload to work with channel names Previous change broken slack integrations defined with recipient as channel name. This is because files_upload_v2 doesn't support channel names anymore and requires channel ID. Now we obtain the channel ID from the chat.postMessage response for bot token image uploads. * Fix flaky test caused by non-deterministic InitialComment * Replace drone with GH actions (#282) * [SKIP CI] Replace drone with GH actions * delete drone * Alerting: Sanitize Slack image upload comment labels (#286) * Add failing regression test * Construct Slack image upload initial comment using sanitized labels * Remove redundant alert name label in comment * New image Provider abstraction to allow for remote AM screenshots (#276) * Add annotation to hold image url * Simplify image Provider interface Previous abstraction change introduced GetImageURL and GetRawImage. These methods were meant to replace GetImage, however only Discord was using it. Switching to these methods would require significant rewrites in integrations to not use WithStoredImages. So, instead I changed the abstraction to one that is more compatible with WithStoredImages. This new abstraction satisfies the same requirements as the previous in that it hides Path and File information as implementation details so that Providers can control access to raw data. * Implement simple URLProvider that retrieves url from annotation Provider for remote/external AMs, does not allow retrieving raw data and requires no datastore access. * Implement TokenProvider that uses token from annotation to query TokenStore Provider for local AMs, TokenStore results should be considered trusted and allow retrieving RawData. * Convert discord to new abstraction - Goes back to using WithStoredImages. - Flattens conditionals. - Less reliance on errors for control flow. * Convert email to new abstraction * Convert telegram to new abstraction - Fairly simple drop-in replacement of os.Open with image.RawData - Attached form filename is now image Name (basename) instead of full path * Convert pushover to new abstraction - Fairly simple drop-in replacement of os.Open with image.RawData - Attached form filename is now image Name (basename) instead of full path * Convert slack to new abstraction - Fairly simple drop-in replacement of os.Open with image.RawData - Attached form filename is now image Name (basename) instead of full path - Previous implementation used os.Stat to get file size for creating the upload URL before reading the data for upload. Now, since we don't know the size before reading, I first read the raw data and then create the upload URL once we know the size. * Fix tests and reimplement FakeProvider Previous FakeProvider relied on Path and actually creating files on disk for some tests since integrations had access to and used these values directly. New abstraction hides this, so the FakeProvider is much simpler. Testing disk reads should be left to the Grafana-side provider implementation. * Remove unused errors * Address review comments * Fix over-specific test assert * Use correct image size in slack multipart upload * Add Jira integration (#280) Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com> * Use correct template function in sns receiver (#289) * Support HMAC SHA256 request signing in the http client (#285) Adds optional HMAC SHA256 signing to the HTTP client. A new HMACRoundTripper (in http/hmac.go) computes and adds a signature for outgoing webhooks. The signature is computed from the request body. Optionally, a timestamp header name can be specified, and if it's set, the signature is computed from {timestamp}:{body}, and the timestamp is added to the headers for the client to verify. * Try additional scopes when testing templates with root scope fails (#290) Expand template testing to try additional scopes if the root scope fails. This mitigates errors for definitions like pagerduty.default.instances, which require the .Alerts scope. Added support for .Alerts and .Alert scopes. * Fix UTF-8 not allowed in Equal field for inhibition rules (#271) Add tests for inhibit rules Equals and EqualsStr This commit adds tests for decoding inhibition rules as JSON and YAML, to make sure that the new EqualsStr field is decoded into Equals. See prometheus/alertmanager#4177. * WaitStage for Grafana Alertmanager (#278) * Revert "Fix UTF-8 not allowed in Equal field for inhibition rules" (#298) Revert "Fix UTF-8 not allowed in Equal field for inhibition rules (#271)" This reverts commit 6fd0c49. * Include time range in template dashboard and panel urls (#296) Add from=&to= to dashboard and panel url annotations on ExtendedAlert Improve context of linked dashboards and panels to more specifically target the range of firing alert. Firing: from=StartsAt-1hr&to=Current time Resolved: from=StartsAt-1hr&to=EndsAt * Disable keepalives in NewTLSClient (#359) This client is only used in short lived contexts so we don't want to keep the connections it opens alive since they can't be reused. * Update moved NewTLSClient with changes from #359 --------- Co-authored-by: Garret Wyman <garret_wyman@hotmail.com> Co-authored-by: Yuri Tseretyan <yuriy.tseretyan@grafana.com> Co-authored-by: Matthew Jacobson <matthew.jacobson@grafana.com> Co-authored-by: Alexander Akhmetov <me@alx.cx> Co-authored-by: Tito Lins <tito.linsesilva@grafana.com> Co-authored-by: Santiago <santiagohernandez.1997@gmail.com> Co-authored-by: George Robinson <george.robinson@grafana.com>
This file contains hidden or 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
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 fixes a bug where UTF-8 characters are not allowed in the
Equalfield for inhibition rules, even when UTF-8 strict mode is enabled.This bug occurred because we forgot to override the validation in
model.LabelName. I have copied the same logic used forGroupBywithGroupByStr, addingEqualStr.We would like to upgrade prometheus/common in future and use the validation there instead, but it presents challenges with downstream projects like Mimir and Cortex where, at present, UTF-8 can be enabled and disabled in separate components at the same time, which is not supported in prometheus/common.