grafana-dashboard requests not properly deserialized
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Grafana Charm |
Fix Released
|
Medium
|
Unassigned |
Bug Description
A year ago, the grafana-dashboard interface was implemented, allowing related applications to share dashboards via the charms.reactive Request/Response pattern [1].
When I tested with prometheus-
"""
Error importing dashboard "libvirt": [{"classificati
"""
dashboards.
"""
for dash in dashboards.
dash_obj = dash.dashboard
if isinstance(
dash_obj = json.loads(
success, reason = import_
"""
Note: import_dashboard should return: (True, None)
1. https:/
2. see import_dashboards function on reactive/grafana.py
Related branches
- Xav Paice (community): Approve
- BootStack Reviewers: Pending requested
-
Diff: 36 lines (+13/-2)2 files modifiedmetadata.yaml (+1/-1)
reactive/grafana.py (+12/-1)
Changed in charm-grafana: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in charm-grafana: | |
milestone: | none → 20.05 |
status: | Triaged → Fix Committed |
Changed in charm-grafana: | |
status: | Fix Committed → Fix Released |
It think we could fix this by further improving the import_dashboard function to handle multiple data types. Check if 'dashboard' is a string, then attempt to convert it into a dictionary with json.loads; if that fails then it can return the its 'success' status and the reason being "cannot convert strng to json"
Logging needs to be implemented in the reactive code for import_dashboards to report the import status and reason, in any case.