Skip to content
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

Automating Grafonnet Dashboards: jsonnet JSON Output Not Compatible with Grafana HTTP API #224

Open
amitoj opened this issue Sep 27, 2024 · 1 comment

Comments

@amitoj
Copy link

amitoj commented Sep 27, 2024

I'm using the Grafonnet library to generate dashboard JSONs, but while the output works when manually added to Grafana, I want to automate the process for continuous development and validation. When I attempt to create the dashboard via the Grafana HTTP API, it rejects the JSON generated by Grafonnet because the API requires a wrapped format.

The Grafonnet JSON output looks like this (using small format without panels for brevity) :

{ 
    "id": null,
    "uid": null,
    "title": "Production Overview",
    "tags": [ "templated" ],
    "timezone": "browser",
    "schemaVersion": 16,
    "refresh": "25s"
}

But the HTTP API expects:

{
  "dashboard": {
    "id": null,
    "uid": null,
    "title": "Production Overview",
    "tags": [ "templated" ],
    "timezone": "browser",
    "schemaVersion": 16,
    "refresh": "25s"
  },
  "folderUid": "l3KqBxCMz",
  "message": "Made changes to xyz",
  "overwrite": false
}

There seems to be no Grafonnet function to wrap the dashboard JSON with the necessary metadata (e.g., folderUid, message, overwrite).

How are others automating this process for CI/CD workflows with Grafonnet? Am I missing a step or workaround? Any insights or recommended solutions would be appreciated.

@Duologic
Copy link
Member

I agree this is a bit annoying, Grafonnet currently only implements the dashboard spec, not the HTTP API envelope. We have this on our backlog but not planned yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants