You've already forked mysqld_exporter
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:
committed by
Ben Kochie
parent
ff14a3d4cb
commit
1465a0b0e0
@ -131,6 +131,11 @@ func (ScrapeGlobalVariables) Help() string {
|
||||
return "Collect from SHOW GLOBAL VARIABLES"
|
||||
}
|
||||
|
||||
// Version of MySQL from which scraper is available.
|
||||
func (ScrapeGlobalVariables) Version() float64 {
|
||||
return 5.1
|
||||
}
|
||||
|
||||
// Scrape collects data from database connection and sends it over channel as prometheus metric.
|
||||
func (ScrapeGlobalVariables) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric) error {
|
||||
globalVariablesRows, err := db.QueryContext(ctx, globalVariablesQuery)
|
||||
@ -227,3 +232,6 @@ func validPrometheusName(s string) string {
|
||||
s = strings.ToLower(s)
|
||||
return s
|
||||
}
|
||||
|
||||
// check interface
|
||||
var _ Scraper = ScrapeGlobalVariables{}
|
||||
|
Reference in New Issue
Block a user