grafana / grafonnet

Jsonnet library for generating Grafana dashboards.
https://grafana.github.io/grafonnet/
Apache License 2.0
352 stars 19 forks source link

Support panels queries reuse (`-- Dashboard --` datasource) #176

Closed v-zhuravlev closed 6 months ago

v-zhuravlev commented 6 months ago

We want to reduce load on the backend, for that we want to use share-query Grafana feature: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/share-query/ https://grafana.com/blog/2020/10/14/learn-grafana-share-query-results-between-panels-to-reduce-load-time/

Here is how i did before new grafonnet(hackish): https://github.com/go-gitea/gitea/blob/main/contrib/gitea-monitoring-mixin/dashboards/overview.libsonnet#L275-L292 Unfortunately, can't assign static id to the panel, as it get overridden by g.dashboard.withPanels().

Perhaps, when dashboard is created with grafonnet id can be kept if it is already present in the panel?