free / sql_exporter

Database agnostic SQL exporter for Prometheus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

dtoxin7 opened this issue · 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.

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.

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 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. :)

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

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

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