Alerting on Numeric Data not in humanized format

Hi all, I’m trying to format my alert into more readable format but I’m unsuccessful as none of the following options are working:

  • {{ printf “%.0f” $values.B.Value }}%
  • {{humanizePercentage $values.E.value}}
  • {{humanize $values.D.value}}
  • {{ printf “%.0f” $values.B}}%
  • {{humanizePercentage $values.E}}
  • {{humanize $values.D}}

Actual Alert
Summary : This Week 8.177169330551363 seconds
Last Week 6.443039930620775 seconds
Description : Percentage last week by 26.914770335181025 %

Alert Preview: “[ var=‘E’ labels={metricId=1} value=-0.9789369886657984 ], [ var=‘C’ labels={metricId=1} value=24.807347163922728 ], [ var=‘B’ labels={metricId=1} value=24.56685315147176 ], [ var=‘D’ labels={metricId=1} value=0 ]”

Hi @arush361,
Something tells me that you are using Classic condition as an expression. :slight_smile: If that’s true try this:

Raw percentage: {{ $values.B0.Value }}
Human percentage : {{ humanizePercentage $values.B0.Value }}
Prometheus alert with Classic Condition expression

… or you can change from Classic condition to Reduce expression and then you would be able to use:

{{ printf "%.0f" $values.B.Value }}%


{{ humanizePercentage $values.B.Value }}

Best regards,

Hi! If it helps the documentation for this can be found here Templating labels and annotations | Grafana documentation, including for Classic Conditions