weaveworks / grafanalib

Python library for building Grafana dashboards
Apache License 2.0
1.86k stars 309 forks source link

'total' literal not correct for Gauge Calculation #540

Open ssmcgrat opened 1 year ago

ssmcgrat commented 1 year ago

https://github.com/weaveworks/grafanalib/blob/ff156bb13dc3fa6b5df2abc8b5e62bde4ab8935e/grafanalib/core.py#L278

Howdy, I believe GAUGE_CALC_TOTAL = 'total' needs to be changed to GAUGE_CALC_TOTAL = 'sum'. The literal 'total' fails to define the Calculation value for a bar gauge, 'sum' literal has worked for me (using grafanalib 0.7.0)

davaffy commented 1 year ago

I can confirm this:

image

This can also be seen here where total is set to sum.

https://github.com/grafana/grafana/blob/71b841fa9bfbc02f40f23a98d0490577603aba02/packages/grafana-data/src/transformations/fieldReducer.ts#L172

I've used this case to create my first pull request (because it was an easy one)