Setting a Datasource Timeout?

  • What Grafana version and what operating system are you using?
    Windows 11, Grafana 11.2

  • What are you trying to achieve?
    I am pulling in data from multiple database servers (both Postgresql servers), and performing a transformation to join everything into one table. This works great.

My issue is that when one of the data sources is not available, there is a long timeout (~15-20 seconds) where it waits for the queries (makes sense), then returns only data from the datasources that are available along with an error that it could not connect to one of the servers (makes sense).

I just want to shorten the timeout so if it sees the datasource is not available within 1-2 seconds, then it just returns data from the sources it could connect to. Not sure if this is a grafana setting or a postgres setting?

  • How are you trying to achieve it?
    I have a panel setup as a mixed datasource with multiple postgres servers setup as the datasource. I’ll update the panel when I know one source is available and when a second source is unavailable (no network connection)

  • What happened?
    It takes 15-20 seconds for the query to timeout, but I want to lower the timeout

  • What did you expect to happen?
    Timeout if a datasource isn’t available in a shorter period of time!

  • Can you copy/paste the configuration(s) that you are having problems with?
    Using the standard grafana config

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    Status: 500. Message: db query error: failed to connect to server - please inspect Grafana server log for details

This error is expected bc the data source isn’t available

  • Did you follow any online instructions? If so, what is the URL?

welcome @ebs27

is the issue that a data source is not available or the it times out?

Neither is an issue but both happen-- when a datasource isn’t available, I want it to timeout in a shorter period of time

I have a few devices posting data to independent databases (they are remote and not always on the network, so I decided to put local db servers on each). I’m remotely able to see each of these databases (when there’s a network connection) so i’ve setup a panel that uses each of the independent databases as a mixed datasource and join the tables together with a transformation.

When one of the databases isn’t available, I still want to display data from the other databases that are available. This happens, but it takes like 20 seconds for the connection to timeout and the panel to update when one source isn’t there, I just want to lower that timeout.

Looks like I can in Postgres (PostgreSQL: Documentation: 16: 34.1. Database Connection Control Functions) , but not sure how to set this in grafana

:grin: so both are issues. and honestly not something grafana can account for since it is only a visualization tool that is not designed to manage connections etc.

you first need to deal with your network connection issues, why do those happen? etc