Skip to content
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

feature request: add sprig library or other library for templating support #253

Open
Kamilcuk opened this issue Oct 16, 2024 · 1 comment

Comments

@Kamilcuk
Copy link

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!

@Kamilcuk
Copy link
Author

Related #166 would be possible with sprig_fromJson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant