Open agilbert314 opened 1 year ago
I would expect Grafana Cloud to be able to upload a grafanalib generated dashboard from the button Upload a Dashboard.
Upload a Dashboard
Grafana Cloud reports the error: Old dashboard JSON format and direct the user to Grafana documentation Read about Importing & Sharing with Grafana 2.x or 3.0.
Old dashboard JSON format
With this Ptyhon script:
from grafanalib.core import ( Dashboard, Stat, Target, GridPos, Template, Templating, Time, Repeat ) application = 'backend' statusTemplate = Template(default='', dataSource='Prometheus', name='statusCode', multi=True, query=( f'http_server_requests_seconds_count{{' f'application="{application.upper()}",' f'uri=~"/public/api/v1/.*"' f'}}' ), regex='.*status="(\\d+)".*', ) templateList = [statusTemplate] dashboard = Dashboard( title='Some Dashboard', timezone='', time=Time('now-24h', 'now'), panels=[ Stat( title='STATUS $statusCode', dataSource=None, reduceCalc='lastNotNull', repeat=Repeat(direction='h', variable='statusCode'), targets=[ Target( expr=(f'round(sum(increase(http_server_requests_seconds_count{{' f'status="$statusCode", ' f'application="{application.upper()}", ' f'uri=~"/public/api/v1/.*"' f'}}[$__range:])))') ), ], gridPos=GridPos(h=6, w=12, x=0, y=0), ) ], templating=Templating(list=templateList) ).auto_panel_ids()
With this command line:
generate-dashboard -o grafana_dashboard.json backend.dashboard.py
Note that the genarated JSON is supported by grafana version 7.3.4.
What you expected to happen?
I would expect Grafana Cloud to be able to upload a grafanalib generated dashboard from the button
Upload a Dashboard
.What happened?
Grafana Cloud reports the error:
Old dashboard JSON format
and direct the user to Grafana documentation Read about Importing & Sharing with Grafana 2.x or 3.0.How to reproduce it?
With this Ptyhon script:
With this command line: