Can we add two data sources in the same panel

Hello All,

I have two data sources Prometheus and Postgres. I want to access these two data sources in a single dashboard. I added multiple data sources and displayed these two data sources in a table using the common column instance in both data sources.

I added filters to the dashboard. But I added only from the Postgres data source.
Above the table, I have added multiple “single panels”. some panels contain Prometheus data source and some contain Postgres data source.

But my issue was, when I apply filters only Postgres related are changing but the panels related to the Prometheus are not changing. What changes do I need to do such that if I apply any filter accordingly every panel should change?

Any leads?

Thanks & regards,
Bharath Kumar.

Hi @chembakayalabharath,

Thanks for opening this post. Did you try to use the option of Mixed datasource when creating a panel and when you need to select your datasource? was that option available to you?

Hello @usmanahmad ,
Yeah, I had selected Mixed Datasource. Actually, the issue got resolved. We are using Prometheus and Postgres Data sources.

Thanks for the response.

Hi @chembakayalabharath,

Glad to hear, we will appreciate it if you can post your resolution steps so that other community users can also know how you solve it and give their feedback :slight_smile:

Thanks.

Hello @usmanahmad,

Definitely.
Data Sources: Prometheus and Postgres
Common Key: Instance(IP) is the common key between both data sources.

Problem Statement:
I have two data sources. I have filters for both data sources. But if I apply Prometheus filters the Postgres filters are not applied and vice versa.

Solution:
Generally, for the table panel, we can add multiple data sources and we can represent them in a single table by applying outer join in transformation.

I am using stat panels, gauge panels, and so on. These panel data are not reflected as per the filters applied.

What I did was we can create a table panel where we can apply join and add the queries as per the requirement and then hide the unnecessary columns.
For ex: If we are creating a stat panel for the Prometheus data source then hide all the columns related to the Postgres Data source in the transformation section using organize fields. Then in the table, we will one column with multiple values. Then again in transformation, you can add the reduce option and use any aggregator according to your requirement and change the panel name from table to stat.

Now irrespective of the data source, if we apply any filter it will reflect the panel.

If you didn’t get anything, please post your comment I will get back to you. If you have any other solution let me know.

Thanks & regards,
Bharath Kumar.

1 Like