Proposal: Reduce duplication of data in dashboard store

Summary

Our dashboard store has a few duplications, and some of them seem to be historical. I want to confirm with the team which would should/could be removed.

This fix could be done in several steps, is there any low-hanging fruit to start it?

Description

For a given chart in our dashboard, we have 3 places that describe it in the store, for example: system_metrics_kubernetes_container_memory_total appears like this:

Object with id: response_metrics_nginx_ingress_http_error_rate shares the the same keys/values with with 2 other objects in the store:

header header
groups[0].metrics[0].metrics[0] id, label, metric_id, prometheus_endpoint_path, query_range, unit, metricId (string)
groups[0].metrics[0].queries[0] id, label, metric_id, prometheus_endpoint_path, query_range, unit, result (array of data points x, y)
groups[0].panels[2].metrics[0] id, label, metric_id, prometheus_endpoint_path, query_range, unit,

Suggested approach:

As far as I could see, panels should be kept, as it contains information on the position of the chart in the dashboard. Other 2 should be migrated into it.

We seem to have some extra bandwidth this iteration on FE, so it could be a good time to make this change.

Background

We would like to re-order panels and charts in the FE using a drag and drop pattern (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31536), having data spread among different data structures makes this job more difficult

Edited by Miguel Rincon