From d24c66cf96f4c5fd85233ee03ac3b302992b2d14 Mon Sep 17 00:00:00 2001 From: TwiN Date: Mon, 20 Oct 2025 13:50:02 -0400 Subject: [PATCH] fix(key): Revert support for ( and ) as name/group, as they already worked before (#1356) Relevant: #1340 --- README.md | 34 +++++++++++++++++----------------- config/key/key.go | 2 -- config/key/key_test.go | 4 ++-- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 6faa6b31..f3338bf8 100644 --- a/README.md +++ b/README.md @@ -366,7 +366,7 @@ or send an HTTP request: POST /api/v1/endpoints/{key}/external?success={success}&error={error}&duration={duration} ``` Where: -- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`. +- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`. - Using the example configuration above, the key would be `core_ext-ep-test`. - `{success}` is a boolean (`true` or `false`) value indicating whether the health check was successful or not. - `{error}` (optional): a string describing the reason for a failed health check. If {success} is false, this should contain the error message; if the check is successful. @@ -2298,14 +2298,14 @@ endpoints: > ⚠️ **WARNING**: This alerting provider has not been tested yet. If you've tested it and confirmed that it works, please remove this warning and create a pull request, or comment on [#1223](https://github.com/TwiN/gatus/discussions/1223) with whether the provider works as intended. Thank you for your cooperation. -| Parameter | Description | Default | -|:-------------------------------|:-------------------------------------------------------------------------------------------|:--------------| -| `alerting.webex` | Configuration for alerts of type `webex` | `{}` | -| `alerting.webex.webhook-url` | Webex Teams webhook URL | Required `""` | -| `alerting.webex.default-alert` | Default alert configuration.
See [Setting a default alert](#setting-a-default-alert) | N/A | -| `alerting.webex.overrides` | List of overrides that may be prioritized over the default configuration | `[]` | -| `alerting.webex.overrides[].group` | Endpoint group for which the configuration will be overridden by this configuration | `""` | -| `alerting.webex.overrides[].*` | See `alerting.webex.*` parameters | `{}` | +| Parameter | Description | Default | +|:-----------------------------------|:-------------------------------------------------------------------------------------------|:--------------| +| `alerting.webex` | Configuration for alerts of type `webex` | `{}` | +| `alerting.webex.webhook-url` | Webex Teams webhook URL | Required `""` | +| `alerting.webex.default-alert` | Default alert configuration.
See [Setting a default alert](#setting-a-default-alert) | N/A | +| `alerting.webex.overrides` | List of overrides that may be prioritized over the default configuration | `[]` | +| `alerting.webex.overrides[].group` | Endpoint group for which the configuration will be overridden by this configuration | `""` | +| `alerting.webex.overrides[].*` | See `alerting.webex.*` parameters | `{}` | ```yaml alerting: @@ -2357,7 +2357,7 @@ endpoints: #### Configuring Zulip alerts | Parameter | Description | Default | |:-----------------------------------|:------------------------------------------------------------------------------------|:--------------| -| `alerting.zulip` | Configuration for alerts of type `zulip` | `{}` | +| `alerting.zulip` | Configuration for alerts of type `zulip` | `{}` | | `alerting.zulip.bot-email` | Bot Email | Required `""` | | `alerting.zulip.bot-api-key` | Bot API key | Required `""` | | `alerting.zulip.domain` | Full organization domain (e.g.: yourZulipDomain.zulipchat.com) | Required `""` | @@ -3297,7 +3297,7 @@ The path to generate a badge is the following: ``` Where: - `{duration}` is `30d`, `7d`, `24h` or `1h` -- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`. +- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`. For instance, if you want the uptime during the last 24 hours from the endpoint `frontend` in the group `core`, the URL would look like this: @@ -3323,7 +3323,7 @@ The path to generate a badge is the following: /api/v1/endpoints/{key}/health/badge.svg ``` Where: -- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`. +- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`. For instance, if you want the current status of the endpoint `frontend` in the group `core`, the URL would look like this: @@ -3340,7 +3340,7 @@ The path to generate a badge is the following: /api/v1/endpoints/{key}/health/badge.shields ``` Where: -- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`. +- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`. For instance, if you want the current status of the endpoint `frontend` in the group `core`, the URL would look like this: @@ -3363,7 +3363,7 @@ The endpoint to generate a badge is the following: ``` Where: - `{duration}` is `30d`, `7d`, `24h` or `1h` -- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`. +- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`. #### Response time (chart) ![Response time 24h](https://status.twin.sh/api/v1/endpoints/core_blog-external/response-times/24h/chart.svg) @@ -3376,7 +3376,7 @@ The endpoint to generate a response time chart is the following: ``` Where: - `{duration}` is `30d`, `7d`, or `24h` -- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`. +- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`. ##### How to change the color thresholds of the response time badge To change the response time badges' threshold, a corresponding configuration can be added to an endpoint. @@ -3434,7 +3434,7 @@ The path to get raw uptime data for an endpoint is: ``` Where: - `{duration}` is `30d`, `7d`, `24h` or `1h` -- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`. +- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`. For instance, if you want the raw uptime data for the last 24 hours from the endpoint `frontend` in the group `core`, the URL would look like this: ``` @@ -3448,7 +3448,7 @@ The path to get raw response time data for an endpoint is: ``` Where: - `{duration}` is `30d`, `7d`, `24h` or `1h` -- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `(`, `)`, `+` and `&` replaced by `-`. +- `{key}` has the pattern `_` in which both variables have ` `, `/`, `_`, `,`, `.`, `#`, `+` and `&` replaced by `-`. For instance, if you want the raw response time data for the last 24 hours from the endpoint `frontend` in the group `core`, the URL would look like this: ``` diff --git a/config/key/key.go b/config/key/key.go index f06aa1fb..4e07283f 100644 --- a/config/key/key.go +++ b/config/key/key.go @@ -15,8 +15,6 @@ func sanitize(s string) string { s = strings.ReplaceAll(s, ",", "-") s = strings.ReplaceAll(s, " ", "-") s = strings.ReplaceAll(s, "#", "-") - s = strings.ReplaceAll(s, "(", "-") - s = strings.ReplaceAll(s, ")", "-") s = strings.ReplaceAll(s, "+", "-") s = strings.ReplaceAll(s, "&", "-") return s diff --git a/config/key/key_test.go b/config/key/key_test.go index 3c082c3f..54d60b31 100644 --- a/config/key/key_test.go +++ b/config/key/key_test.go @@ -32,12 +32,12 @@ func TestConvertGroupAndNameToKey(t *testing.T) { { GroupName: "API (v1)", Name: "endpoint", - ExpectedOutput: "api--v1-_endpoint", + ExpectedOutput: "api-(v1)_endpoint", }, { GroupName: "website (admin)", Name: "test", - ExpectedOutput: "website--admin-_test", + ExpectedOutput: "website-(admin)_test", }, { GroupName: "search",