File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ grafana-wtf changelog
6
6
in progress
7
7
===========
8
8
9
+ 2021-12-10 0.11.1
10
+ =================
11
+ - Be more graceful when decoding Grafana dashboard data structures. Thanks, @jangaraj!
12
+
9
13
2021-12-10 0.11.0
10
14
=================
11
15
- Upgrade to ``colored==1.4.3 ``. Thanks, @dslackw!
Original file line number Diff line number Diff line change @@ -340,8 +340,12 @@ def index(self):
340
340
self .index_datasources ()
341
341
342
342
@staticmethod
343
- def collect_datasource_names (root ):
344
- return list (set ([item .datasource for item in root if item .datasource ]))
343
+ def collect_datasource_names (element ):
344
+ names = []
345
+ for node in element :
346
+ if "datasource" in node and node ["datasource" ]:
347
+ names .append (node .datasource )
348
+ return list (sorted (set (names )))
345
349
346
350
def index_dashboards (self ):
347
351
@@ -357,9 +361,10 @@ def index_dashboards(self):
357
361
self .dashboard_by_uid [uid ] = dashboard
358
362
359
363
# Map to data source names.
360
- ds_panels = self .collect_datasource_names (dashboard .dashboard .panels )
361
- ds_annotations = self .collect_datasource_names (dashboard .dashboard .annotations .list )
362
- ds_templating = self .collect_datasource_names (dashboard .dashboard .templating .list )
364
+ dbdata = dashboard .dashboard
365
+ ds_panels = self .collect_datasource_names (dbdata .get ("panels" , []))
366
+ ds_annotations = self .collect_datasource_names (dbdata .get ("annotations" , {}).get ("list" , []))
367
+ ds_templating = self .collect_datasource_names (dbdata .get ("templating" , {}).get ("list" , []))
363
368
self .dashboard_datasource_index [uid ] = list (sorted (set (ds_panels + ds_annotations + ds_templating )))
364
369
365
370
def index_datasources (self ):
You can’t perform that action at this time.
0 commit comments