How to change field name for the generated field of `sum()`

I am trying to change the field name(is this label?) generated by sum(), but somehow it doesn’t work for both label_format or label_replace, and I am even getting a syntax error for label_format. What have I missed there?



If you are just trying to change the label for better display on dashboard, try using Grafana’s transform functionality:

  1. Click on Transform, and select Rename by regex.
  2. Use a regex match and replace. For example, let’s say your label is “unwanted=wanted”, you can use regex matcher {(?:.*)="(.*)"} and $1 as the replacement.