1
0
mirror of https://github.com/prometheus/mysqld_exporter.git synced 2025-07-30 06:43:05 +03:00

Add minimal MySQL version to Scraper interface (#328)

* Add Version method to Scraper interface.
* Skip scrapers for unsupported MySQL versions.

Signed-off-by: Alexey Palazhchenko <alexey.palazhchenko@percona.com>
This commit is contained in:
Alexey Palazhchenko
2018-10-29 18:35:38 +03:00
committed by Ben Kochie
parent ff14a3d4cb
commit 1465a0b0e0
30 changed files with 267 additions and 8 deletions

View File

@ -64,6 +64,11 @@ func (ScrapeBinlogSize) Help() string {
return "Collect the current size of all registered binlog files"
}
// Version of MySQL from which scraper is available.
func (ScrapeBinlogSize) Version() float64 {
return 5.1
}
// Scrape collects data from database connection and sends it over channel as prometheus metric.
func (ScrapeBinlogSize) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric) error {
var logBin uint8
@ -113,3 +118,6 @@ func (ScrapeBinlogSize) Scrape(ctx context.Context, db *sql.DB, ch chan<- promet
return nil
}
// check interface
var _ Scraper = ScrapeBinlogSize{}