feature request: add sprig library or other library for templating support
Opened this issue · 1 comments
Why is this needed:
The Grafana templates are low in features, with not fully oddly documented template functions. They are not documented https://grafana.com/docs/grafana/latest/alerting/fundamentals/notifications/templates/ not at https://grafana.com/docs/grafana/latest/alerting/configure-notifications/template-notifications/reference/ , but at https://grafana.com/docs/grafana/latest/alerting/alerting-rules/templating-labels-annotations/ .
There are not enough functions for good templating.
In particular I am writing grafana alerts where different people have to be tagged on Microsoft Teams depending on if the input label matches a specific regex. It is not possible to if match a label with a regex, it is not possible to split a string.
What would you like to be added:
There is sprig library https://masterminds.github.io/sprig/ . Please add it in all templating contexts to be available.
Who is this feature for?
For any programmers that write grafana alerts.
For example hashicorp/nomad added all sprig library with sprig_ prefix for templating not to break backward compatibility: https://github.com/hashicorp/nomad/blob/0f6561bdfe93d2a5d387c5b0ebbbc946130ed436/command/data_format.go#L108
Thanks!