Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

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

Merged
merged 3 commits into from
Oct 23, 2023
Merged

Conversation

MichaelSasser
Copy link
Contributor

@MichaelSasser MichaelSasser commented Oct 12, 2023

Fixes: #16405

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Pull request includes a sign off
  • Code style is correct
    (run the linters)
    Not applicable

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 [email protected]

@MichaelSasser MichaelSasser changed the title Replace all Prometheus datasource UIDs with the variable ${DS_PROMETHEUS} and remove __inputs Replace all Prometheus datasource UIDs of the Grafana Dashboard with the variable ${DS_PROMETHEUS} and remove __inputs Oct 12, 2023
@MichaelSasser MichaelSasser marked this pull request as ready for review October 12, 2023 11:14
@MichaelSasser MichaelSasser requested a review from a team as a code owner October 12, 2023 11:14
@DMRobertson
Copy link
Contributor

(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!

Copy link
Contributor

@DMRobertson DMRobertson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Super, thanks for confirming (and more generally for your diligence in fixing this).

@DMRobertson DMRobertson merged commit 3df70aa into matrix-org:develop Oct 23, 2023
30 checks passed
@MichaelSasser MichaelSasser deleted the #16405-fix-prometheus-ds-uids branch October 24, 2023 04:08
@MichaelSasser
Copy link
Contributor Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants