grafana / grafonnet-lib

Jsonnet library for generating Grafana dashboard files.
https://grafana.github.io/grafonnet-lib/
Apache License 2.0
1.08k stars 217 forks source link

Add a little helper library to automatically manage the layout of panels #343

Closed tomwilkie closed 3 years ago

tomwilkie commented 3 years ago

Signed-off-by: Tom Wilkie tom@grafana.com

tomwilkie commented 3 years ago

Let me know if you think this belongs here; if so I'll tidy it up a little and get it ready for commit.

malcolmholmes commented 3 years ago

Grafonnet-7.0 is a generated lib - created from the https://github.com/grafana/dashboard-spec repo. Nothing much further is happening with that repo - it was eclipsed by the schema efforts in Grafana. However, it is the right place for small PRs such as this one, then grafonnet-7.0 can be regenerated (I think that is in CI, but @trotttrotttrott would know).

trotttrotttrott commented 3 years ago

The grafonnet-7.0/ directory is managed with the spec-import target. As it stands, it would wipe out anything added by other means.

https://github.com/grafana/grafonnet-lib/blob/05fb200ee1a1816fc1b4c522071d5606d8dd71c1/Makefile#L49-L50

Seems to me, adding it here would be ideal: https://github.com/grafana/dashboard-spec/blob/master/templates/jsonnet/dashboard.tmpl. The addPanel/addPanels functions are static right now. But it would change the way this is used as the file wouldn't be imported separately.

tomwilkie commented 3 years ago

I've stuck it in a new contrib directory for now; I don't want to change the semantics of existing functions as this could break existing users.