K-Phoen / grabana

User-friendly Go library for building Grafana dashboards
MIT License
680 stars 69 forks source link

Allow configuring Stat reduceOptions #263

Open aaguilartablada opened 3 months ago

aaguilartablada commented 3 months ago

Allow configuring ReduceOptions.Fields and ReduceOptions.Values in order to be able to select what to show in Stat panel.

For example, having this Prometheus metric:

process_runtime_dotnet_info{runtime_version="6.0.11", version="1.0.0", .......} 1

To show version label value (1.0.0) it is necessary to configure reduceOptions like this:

"reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^version$/",
          "values": false
},