microsoft / microsoft/aspire

Parameterise the Prometheus Data Source in Grafana Dashboards

Open
#11,071 6 comments 0 reactions 0 assignees View on GitHub
area-grafana
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

Each panel in the [Grafana dashboards](https://github.com/dotnet/aspire/tree/main/src/Grafana) 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:

```jsonc
{
"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"
}
]
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.