-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto generate from grafana schema? #607
Comments
Grafana CUE/Thema is cute but highly experimental and not working. |
@alkuzad Thank you for the information. I have implemented (since hours ago) using auto-generation and minor manual modifications: https://github.com/fzyzcjy/grafana-dashboard-python
I also do not use jsonnet, and love to use existing toolkits around python (huge ecosystem!) |
@fzyzcjy It is a nice experiment but I do not believe in the stage for use yet, given the amount of manual changes needed. I saw also one additional problem - I use InfluxDB but Grafana/Grok does not have it and Grafanalib does. |
Yes I think so.
Hmm, where is that schema from? Is it by manual reverse engineering, or the JSON schema is published outside grok? |
I just think it was not ported from the older grafonnet-lib. https://github.com/grafana/grafonnet-lib/blob/master/grafonnet/influxdb.libsonnet |
I see. But I guess it is very easy to solve, if all the code is in https://github.com/weaveworks/grafanalib/blob/main/grafanalib/influxdb.py. We only need to write a Pydantic class |
Btw what manual changes do you have in mind? I have already changed many things, but most are just adding default values and making type constraints looser, so they are quite straightforward. |
https://github.com/fzyzcjy/grafana-dashboard-python/blob/master/misc/model_generation/manual_patch.patch this, it looked to me like a lot of tuning applied over auto-generated schema. |
Yes and no. It is mostly just
|
@alkuzad By the way, did you find Grafanalib missing some fields once in a while? I did have that problem sometimes, and has to modify its source code. |
@fzyzcjy I am not an extensive user yet, I am experimenting with dashboard.json generation and especially converting it from the raw export. trimDefaults seems to not work and I want to figure out how to convert dashboard.json raw form into more easy to read one :) |
As a quick side-note: a library fully-generated from schemas is being worked on by Grafana and published here https://github.com/grafana/grafana-foundation-sdk/ :) |
Hi thanks for the lib! I wonder whether it is reasonable to be auto-generated from the grafana schema https://github.com/grafana/grafana/blob/main/kinds/dashboard/dashboard_kind.cue. By doing that, we can, for example:
The text was updated successfully, but these errors were encountered: