cncf / demo

Demo of CNCF technologies
https://cncf.io
Apache License 2.0
77 stars 39 forks source link

Grafana roundtrip json export/import bug #175

Open namliz opened 7 years ago

namliz commented 7 years ago

Unfortunately I can reproduce this issue reliably: https://github.com/grafana/grafana/issues/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.

namliz commented 7 years ago

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.

chunxiangli commented 6 years ago

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.