Discuss: Figure out best approach to assign Ids to panels in monitoring dashboard
Problem to solve
We need to display annotations on the charts within the monitoring dashboard. One of the user workflows is to be able to create annotations that are specific to a panel or a set of panels. In order to do that there needs to be a way to uniquely identify panels within the monitoring dashboard.
This issue is to explore and identify the best approach to create and store a unique Id for panels across all monitoring dashboards.
Further details
Currently, in the monitoring dashboard, the panels do not have a unique identifier. The metrics within the panels have an Id but not the panels. Now that we have a request to support annotations there is a need to associate each panel with one or more annotations.
Specifically, we want to investigate the best ways to process the panels within common & custom dashboards yml files and identify the panels. These Ids should be constant and resistant to changes in the panel properties (like metrics and etc).
During the discussion on how to store annotations quite a lot of questions were raised regarding the panel identifier. More details on #205091 (closed) comments.
Other features that would also benefit are:
Related problems
Processing and identifying metrics defined in yml files. Currently only common and custom metrics, but not custom dashboards, have ids, which is blocking matter for alerts #28242 (closed) and #194267 (closed)
When we are going to discuss how to process changes made to yml in order to assign ids to panels we can also try address this issue
Proposal
After taking into account several technical factors and the timeline for annotations feature delivery the decision is to proceed with panel title + panel group + panel type as a unique identifier for a panel. The output of this discussion is below two issues:
#212615 (closed) - Validate duplicate panel groups in monitoring dashboard and surface a message
#212617 (closed) - Create Ids for panels in the monitoring dashboard yml file
What if two dashboards have the same panel group title and panel title?
Because annotations are scoped to a dashboard, collisions will not occur.
Why do we need the panel type
A single metric could be visualized in an area chart and line chart. For that reason, we're taking into account the panel type as well. For e.g. CPU usage can be a line or area chart.
What if two groups have the same title? We do not have validation as of %12.10
A warning message could be surfaced to inform the user about duplicate group titles. This could be a simple frontend fix until the backend introduces more dashboard file validations.
Will these Ids be generated on the FE or BE?
It is ideal if the BE could generate the Ids and pass it along with the rest of the dashboard properties to the FE.