Skip to content

Parameterise the Prometheus Data Source in Grafana Dashboards #60204

Open
@martincostello

Description

Each panel in the Grafana dashboards are tied directly to a specific datasource ID at the point it is imported, rather than being a variable in of itself.

https://github.com/dotnet/aspire/blob/fc0d681c0921984da03e61dcbf69ce5528a658d3/src/Grafana/dashboards/aspnetcore.json#L77-L80

In the case that a Grafana instance has multiple data sources, this makes it difficult to switch between different deployments of an application in the same dashboard.

It would be useful if the dashboards instead defined a Data Source variable and referenced that instead for easy switching.

For example:

{
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${prometheus}"
      }
      // The actual panel...
    }
  ],
  "templating": {
    "list": [
      {
        "current": {
          "selected": true,
          "text": "Prometheus Production-EU-WEST-1",
          "value": "Prometheus Production-EU-WEST-1"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "prometheus",
        "options": [],
        "query": "prometheus",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      }
    ]
  }
}

Metadata

Assignees

Labels

needs-area-labelUsed by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions