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

Replace all Prometheus datasource UIDs of the Grafana Dashboard with the variable `${DS_PROMETHEUS}` and remove `__inputs` #16471

Closed MichaelSasser closed 1 year ago

MichaelSasser commented 1 year ago

Fixes: #16405

Pull Request Checklist

What was changed

I replaced the 000000001 and $datasource Prometheus datasource UIDs ${DS_PROMETHEUS} using regular expressions. Then I added the label "Datasource" to the DS_PROMETHEUS variable and removed the __inputs section, so Grafana doesn't treat the variable as a placeholder that it replaces on Import.

No errors on import, panels show data. Tested with Mimir 2.9.1 and a fresh Grafana 9.5.13 with Angular support enabled (due to the deprecated Angular-based panels).

Signed-off-by: Michael Sasser michael@michaelsasser.org

DMRobertson commented 1 year ago

(due to the deprecated Angular-based panels).

Hadn't heard of this; see https://grafana.com/docs/grafana/latest/developers/angular_deprecation/

In particular:

Our plan is to completely remove support for Angular plugins in version 11, which will be released in 2024. This means that all plugins that depend on Angular will stop working and the temporary option introduced in version 10 to enable Angular will be removed.

Looks like we'll have to fix this up in the next year or so!

MichaelSasser commented 1 year ago

There is a preview feature toggle called autoMigrateOldPanels (used like GF_FEATURE_TOGGLES_ENABLE=autoMigrateOldPanels or GF_FEATURE_TOGGLES_ENABLE=autoMigrateOldPanels anotherFeatureAsExampleThatDoesNotExist [...] for multiple feature) that automatically migrates the deprecated Angular panels.

Migrate old angular panels to supported versions (graph, table-old, worldmap, etc)

I have enabled it with Grafana 10.x when I moved the LGTM stack to a new server a few weeks ago. The feature does work semi-well. Most of the panels were migrated on import, but some did not. I haven't looked too much into it, but I have the feeling that it has to do with panels where the series does not exist on import yet. If I recall it correctly, I imported the alerts first, then the dashboards and later on, the recording rules because I forgot them for a minute. A large number of the panels that were not migrated had either used recordings or variables based on labels and filters that I changed in Mimir but not yet in the dashboard.

When I find some time, I'll try it again, do the rest manually if needed and hand in a PR.