sql_exporter icon indicating copy to clipboard operation
sql_exporter copied to clipboard

No metrics gathered, [from Gatherer #1] bad connection

Open dtoxin7 opened this issue 4 years ago • 6 comments

There is a problem when there are no calls to the exporter for a long time, he seems to "fall asleep" and, when asked again, swears like this:

> No metrics gathered, [from Gatherer #1] bad connection

Restarting the exporter solves the problem and it continues to work and returns the metrics normally, as long as requests to it go.

How to reproduce the problem

  1. Raise an exporter anywhere
  2. Collect a couple of queries to the database and contact the exporter for them
  3. Wait 5-15 minutes without making any requests
  4. Contact the exporter again, there will be a problem.

dtoxin7 avatar Oct 11 '20 12:10 dtoxin7

Hi @dtoxin7 ! I'm interested in your problem, as I've experienced something similar in the past. If you have time, please take a look at the fork here: https://github.com/burningalchemist/sql_exporter.

I've made several changes/options and it resolved my problem.

burningalchemist avatar Oct 19 '20 08:10 burningalchemist

I am fairly new at this @burningalchemist, when you say changes/options do you mean as part of the sql_exporter.yml file? Or is code related?

jesus-velez avatar Oct 23 '20 15:10 jesus-velez

@jesus-velez It's mainly code related, but it's also reflected in the settings. :) It really depends on how a driver interacts with your database instance (and what are the quirks), but you can try an alternative driver pgx, if you work with Postgres, and/or add max_connection_lifetime: parameter to sql_exporter.yml and try it out.

As I said, I had a similar case and was able to find a solution for it. Also, in the fork I currently maintain, the drivers and their dependencies have been updated, it might be the case too.

But yeah, it's a path of trial and errors. I'm happy to support, if you can try things out and provide some intermediate results. :)

burningalchemist avatar Oct 23 '20 15:10 burningalchemist

Awesome. Thanks for getting back to me I'll try it out and five any feedback.

jesus-velez avatar Oct 24 '20 00:10 jesus-velez

@burningalchemist I've I've used this since you recommended it and everything works perfect. Thanks so much for the suggestion.

jesus-velez avatar Jul 02 '21 17:07 jesus-velez

@jesus-velez Glad to hear it works for you! 👍

burningalchemist avatar Jul 02 '21 17:07 burningalchemist