Skip to content

Long running query times out #195

@zrd740

Description

@zrd740

Describe the bug
I have a MSSQL query that takes about 2 minutes to complete. One of my main reasons for wanting to use sql-exporter is so that I can pull the results of all these queries into Prometheus so I can see the values in grafana without having to wait for the queries to run every time I want to refresh a dashboard, also so I can see how the values are changing over time.

When I try and run the query through sql_exporter, I get:
ts=2023-02-17T00:25:21.925Z caller=klog.go:84 level=debug func=Infof msg="Error gathering metrics: [from Gatherer #1] [collector="qb-test", query="ar_balance"] context deadline exceeded"

I can see that the query is running, and it gets this error before the query is expected to return the data.

To Reproduce
Try to run a query longer than 20 seconds, and you will get this error.

Expected behavior
I couldn't find a way to set the timeout for running a query, it would be great to have this in the .yml file so that it could be adjusted for more use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions