cncf/demo

Grafana roundtrip json export/import bug

Opened this issue · 2 comments

Unfortunately I can reproduce this issue reliably: grafana/grafana#2816

  1. Create dashboard in Grafana 3
  2. Export json file

Import json file manually (via Grafana web UI) works.
Import via API does not despite making the exact same API calls.

In other words, there's some additional json munging required, can't submit dashboard file as-is.
This is an inconvenience because now a hackish post processing step is necessary for demo outputs.

Note: the really odd thing is that backwards compatibility with Grafana 2 is good so dashboards exported from that are imported correctly both ways.

This is the dashboard json baked into current kube-grafana container:
https://github.com/cncf/demo/blob/master/Docker/grafana/dashboards/cncfdemo.json

This is how it roundtrips back out if you export it from the UI:
https://gist.github.com/zilman/4fde89c1d07d370e709559bb44274ffa

The diff:

"dashboard" : {
...
    "overwrite" : true,
    "inputs" : [ { 
        "name" : "DS_PROMETHEUS",
        "type" : "datasource",
        "pluginId" : "prometheus",
        "value" : "Prometheus"
    } ]

Without injecting this blob it just fails to import programatically.

What would be the final solution for this problem. I tried that containerized grafana with baked json in
https://github.com/cncf/demo/blob/master/Docker/grafana/dashboards/cncfdemo.json
That still failed.