calert icon indicating copy to clipboard operation
calert copied to clipboard

Alert template error

Open NYARAS opened this issue 8 months ago • 0 comments

Alert templating *({{.Labels.severity | toUpper }}) fails when you don't have severity in alert rules into a string.

Example:

        - alert: High Node CPU Usage
          annotations:
            summary: Example summary
          expr: |
            <Example Expr>
          for: 5m
          labels:
            team: devops
            severity: "critical"

This will pass but

        - alert: High Node CPU Usage
          annotations:
            summary: Example summary
          expr: |
            <Example Expr>
          for: 5m
          labels:
            team: devops
            severity: critical # without quotes

This fails with msg="Error parsing values in template" error="template: message.tmpl:1:23: executing \"message.tmpl\" at <toUpper>: invalid value; expected string"

NYARAS avatar May 30 '24 18:05 NYARAS