matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.83k stars 2.13k forks source link

Referenced Prometheus datasource UIDs in Grafana dashboard do not match the defined Prometheus datasource variable #16405

Closed MichaelSasser closed 1 year ago

MichaelSasser commented 1 year ago

Description

The Grafana dashboard contains a mishmash of at least three different datasource UIDs for the Prometheus datasource type, leading to errors or "missing data" because only one of them is actually defined as a variable.

For example:

reivilibre commented 1 year ago

Hmm, I have noticed these getting muddled up in the past when exporting the dashboard. Grafana has been very temperamental about the exports sometimes; not entirely surprising it's not all correct. It'd be good to fix this if we can.

If someone wants to have a go at fixing it up and then seeing whether the export is happy/doesn't create a massive diff, please do give it a go and submit a PR!

MichaelSasser commented 1 year ago

Yeah. I can be quite temperamental. I've noticed that when the model has an __inputs section, Grafana treats those Variables as placeholders rather than variables, which it replaces by the actual datasource UID even if a variable with the same name exists. I'm not sure though whether this is a consistent defect or a feature. Another thing could think of are those Angular-based panels:

{
      "type": "panel",
      "id": "graph",
      "name": "Graph (old)",
      "version": ""
    },

They behave strangely sometimes. Well, different strangely at least, compared to the new ones. When they get an invalid data source, which might happen during the process of setting up a new datasource variable or changing an existing one in the UI, they might retain the UID of the last working datasource.

I had good results in the past, when I made such changes directly to the JSON model editor (Dashboard Settings -> JSON Model) with the integrated find and replace tool (Ctrl+f in the edit window) or externally. Though, make sure not to hit that "Save Changes" button in the JSON model editor not twice in a relative short time, or it might not actually save anything.