Reputation: 765
I have a Prometheus metric like this:
lines_added{project="xx",user="xx"}
The project label and user label are integer ids, not good for legend on graph.
I have another variable members
as query from a PostgreSQL data source:
select u.id as __value,u.name as __text
from project_authorizations pa left join users u
on pa.user_id = u.id
where pa.project_id=[[project]]
For the lines_added
metric, how can I make it display the user's real name according "id"->"name" mapping in variable members
?
Is that possible with Grafana?
Upvotes: 8
Views: 2984
Reputation: 13341
You don't need dashboard variables for this.
Current versions of Grafana support interpretation of time series as tables. This way those can be join similarly to join of SQL.
--Mixed--
There is a catch though: the field should have the same name in both datasets, and only one field is allowed for joining.
Upvotes: 0