Cleanup #40966
mgr/dashboard: simplify Grafana checker ("check_grafana_uids.py")
0%
Description
It seems that "check_grafana_uids.py" checks that Grafana front-end UIDs match the UIDs in Grafana dasboard JSON definitions.
A simpler and more sustainable approach could be taken instead:
- Those UIDs that identify every Grafana Dashboard can be any string between 8-40 chards (https://grafana.com/docs/reference/dashboard/). So, instead of using the not-very-intuitive UIDs "41FrpeUiz", "x5ARzZtmk", "rtOg0AiWz" for the "rbd-overview.json", "host-details.json", etc., why not using "rbd-overview", "host-details", etc.? That allows the script to simply check that the "$UID.json" in the front-end matches an existing filename and its UID with no need to inspect all the files.
History
#1 Updated by Kiefer Chang about 4 years ago
There is a TODO enhancement in https://tracker.ceph.com/issues/40008#note-10
We can use this issue for tracking too.
#2 Updated by Ernesto Puerta about 4 years ago
Thanks for clarifying that Kiefer!
The approach suggested by Kanika is ok too. However, it still requires a mapping between every <cd-grafana> "grafana-dashboard-name" (human-friendly name I assume) to another UID in a mapping file. We may mix that with my suggestion with Kanika's and that would result in:- RBD component has a "<cd-grafana->" component with attribute "grafana-dashboard-name" = "rbd-overview",
- which is resolved in a mapping constant file as "rbd-overview = rbd-overview.json".
So the mapping file then would be kind of trivial. A different approach would be that <cd-grafana> is able to `auto-infer` where it's placed and present the corresponding dashboard. I still need think more about it to see whether it's good or risky approach. I like auto-magic things, but too auto-magic can be dangerous.
#3 Updated by Ernesto Puerta over 2 years ago
- Project changed from mgr to Dashboard
- Category changed from 132 to General
#4 Updated by Ernesto Puerta over 1 year ago
- Status changed from New to Won't Fix