justwatchcom / sql_exporter

Flexible SQL Exporter for Prometheus.
MIT License
393 stars 108 forks source link

Update MSSQL driver, fix compatibility with Azure Managed Instance DBs #68

Closed marevers closed 2 years ago

marevers commented 2 years ago

The current version is not compatible with Azure Managed Instance databases. Issue described in #60.

The exporter crashes when it tries to do a lazy close on the open connection. This seems to be incompatible with the MSSQL driver that is used: github.com/denisenkom/go-mssqldb

To fix the issue, I updated the MSSQL driver to its latest version (v0.12.2) and removed conn.SetConnMaxLifetime to disable lazy closes. The open connection is reused correctly and the exporter no longer crashes.

marevers commented 2 years ago

I added the condition plus modified the comment so that it better reflects why it is disabled. Also, the driver is sqlserver, not mysql. I tested it with that and it worked.

dewey commented 2 years ago

Thanks for the contribution! I'll release a new version next week, I also want to take a look at the other open PR before that.

marevers commented 2 years ago

@dewey are we still going to see the release with the changes?

dewey commented 2 years ago

Hey, sorry for the delay. I just released the new version.