grafana / grafonnet

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

Adding maxPerRow for all panels and repeatDirection for row panel #140

Closed vishnuchalla closed 1 month ago

vishnuchalla commented 9 months ago

These two attributes are required for below reasons.

CLAassistant commented 9 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Vishnu Challa seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

vishnuchalla commented 9 months ago

@K-Phoen @iainlane @Duologic Requesting a review.

Duologic commented 9 months ago

The files in gen/ are generated, please do not edit them by hand. Have a look at https://github.com/grafana/grafonnet/blob/main/DEVELOPMENT.md to see how the generate process works.

It looks like the schema for the row panel is missing these fields. These functions can be added in this file: https://github.com/grafana/grafonnet/blob/main/custom/row.libsonnet

malcolmholmes commented 9 months ago

Better would be an issue or PR against grafana/grafana to update the underlying schema. Then Grafonnet would automatically pick it up.

vishnuchalla commented 8 months ago

Better would be an issue or PR against grafana/grafana to update the underlying schema. Then Grafonnet would automatically pick it up.

Grafana upstream already seems to be having these elements in their schema, as we can see them in the UI dashboard.

vishnuchalla commented 8 months ago

The files in gen/ are generated, please do not edit them by hand. Have a look at https://github.com/grafana/grafonnet/blob/main/DEVELOPMENT.md to see how the generate process works.

It looks like the schema for the row panel is missing these fields. These functions can be added in this file: https://github.com/grafana/grafonnet/blob/main/custom/row.libsonnet

Made these changes in schema as suggested instead of generated files. I am not sure why make generate is not working in my local and running into below error.

+ cp -r /home/vchalla/myforks/grafonnet/custom /home/vchalla/myforks/grafonnet/gen/grafonnet-v10.1.0
+ mapfile -t FILES
++ jsonnet -J vendor -S -c -m /home/vchalla/myforks/grafonnet/gen --tla-str version=v10.1.0 --tla-code-file schemas=github.com/grafana/grok/jsonnet/v10.1.0/imports.libsonnet --tla-code-file openapiSpec=github.com/grafana/grafana/public/openapi3.json -e '(import '\''generator/main.libsonnet'\'')'
RUNTIME ERROR: vendor/github.com/crdsonnet/crdsonnet/crdsonnet/renderEngines/ast.libsonnet:46:15-18 Unknown variable: xtd
    vendor/github.com/crdsonnet/crdsonnet/crdsonnet/renderEngines/main.libsonnet:4:8-32 object <anonymous>
    vendor/github.com/crdsonnet/crdsonnet/crdsonnet/render.libsonnet:24:13-32   object <anonymous>
    vendor/github.com/crdsonnet/crdsonnet/crdsonnet/render.libsonnet:26:15-26   object <anonymous>
    vendor/github.com/crdsonnet/crdsonnet/crdsonnet/render.libsonnet:38:7-8 
    vendor/github.com/crdsonnet/crdsonnet/crdsonnet/processor.libsonnet:31:7-51 function <anonymous>
    vendor/github.com/crdsonnet/crdsonnet/crdsonnet/main.libsonnet:146:12-48    function <anonymous>
    generator/alerting.libsonnet:(93:9)-(99:10) thunk from <thunk <ast> from <function <anonymous>>>
    generator/utils.libsonnet:33:7-16   
    vendor/github.com/Duologic/jsonnet-libsonnet/utils.libsonnet:37:26-35   thunk from <function <anonymous>>
    vendor/github.com/Duologic/jsonnet-libsonnet/utils.libsonnet:27:28-31   thunk from <function <anonymous>>
    ...
    vendor/github.com/Duologic/jsonnet-libsonnet/main.libsonnet:(33:5)-(44:6)   
    vendor/github.com/Duologic/jsonnet-libsonnet/main.libsonnet:(51:26)-(57:8)  object <anonymous>
    vendor/github.com/Duologic/jsonnet-libsonnet/main.libsonnet:59:20-30    thunk from <object <anonymous>>
    vendor/github.com/Duologic/jsonnet-libsonnet/main.libsonnet:59:9-31 object <anonymous>
    generator/alerting.libsonnet:(116:5)-(120:15)   function <anonymous>
    generator/alerting.libsonnet:63:25-85   object <anonymous>
    generator/alerting.libsonnet:15:20-32   object <anonymous>
    generator/main.libsonnet:21:9-20    object <anonymous>
    Field "grafonnet-v10.1.0/clean/alerting/contactPoint.libsonnet" 
    During manifestation    

+ jsonnet -S -c -m /home/vchalla/myforks/grafonnet/gen/grafonnet-v10.1.0 vendor/generator/dependencies.libsonnet
/home/vchalla/myforks/grafonnet/gen/grafonnet-v10.1.0/jsonnetfile.json
+ jrsonnet -J vendor -S -c -m /home/vchalla/myforks/grafonnet/gen/grafonnet-v10.1.0/docs/ --exec '(import '\''doc-util/main.libsonnet'\'').render(import '\''/home/vchalla/myforks/grafonnet/gen/grafonnet-v10.1.0/main.libsonnet'\'')'
./scripts/generate.sh: line 49: jrsonnet: command not found
+ finish
+ rm -rf /tmp/tmp.81Tat8DGoI
make: *** [Makefile:8: gen/grafonnet-latest] Error 127
isarns commented 4 months ago

./scripts/generate.sh: line 49: jrsonnet: command not found

@vishnuchalla You are missing jrsonnet

Duologic commented 1 month ago

Hey, sorry for letting this hang for so long.

I've just been looking into this, trying to figure out why those fields aren't there. AFAICT these values don't make sense on a row panel, the direction is always vertical, regardless of the value in the json, that's just how rows work. The maxPerRow doesn't mean anything as nested rows don't exist.

repeatDirection is available on panels: example

maxPerRow fixed in #207 along with a few other fields.