Merge pull request #17404 from sylr/template-urlQueryEscape

Add urlQueryEscape to template functions
This commit is contained in:
Julien 2025-10-27 13:41:23 +01:00 committed by GitHub
commit de23c5a856
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 0 deletions

View file

@ -2,6 +2,8 @@
## main / unreleased
* [FEATURE] Templates: Add urlQueryEscape to template functions. #17403
## 3.7.2 / 2025-10-22
* [BUGFIX] AWS SD: Fix AWS SDK v2 credentials handling for EC2 and Lightsail discovery. #17355

View file

@ -78,6 +78,7 @@ versions.
| tableLink | expr | string | Returns path to tabular ("Table") view in the [expression browser](https://prometheus.io/docs/visualization/browser/) for the expression. |
| parseDuration | string | float | Parses a duration string such as "1h" into the number of seconds it represents. |
| stripDomain | string | string | Removes the domain part of a FQDN. Leaves port untouched. |
| urlQueryEscape | string | string | [url.QueryEscape](https://pkg.go.dev/net/url#QueryEscape) Escapes the string so it can be safely placed inside a URL query. |
### Others

View file

@ -288,6 +288,7 @@ func NewTemplateExpander(
}
return float64(time.Duration(v)) / float64(time.Second), nil
},
"urlQueryEscape": url.QueryEscape,
},
options: options,
}