You've already forked mysqld_exporter
mirror of
https://github.com/prometheus/mysqld_exporter.git
synced 2025-07-30 06:43:05 +03:00
Introduce Scraper interface
Signed-off-by: Kamil Dziedzic <arvenil@klecza.pl>
This commit is contained in:
@ -19,7 +19,20 @@ const (
|
||||
)
|
||||
|
||||
// ScrapeEngineInnodbStatus scrapes from `SHOW ENGINE INNODB STATUS`.
|
||||
func ScrapeEngineInnodbStatus(db *sql.DB, ch chan<- prometheus.Metric) error {
|
||||
type ScrapeEngineInnodbStatus struct{}
|
||||
|
||||
// Name of the Scraper. Should be unique.
|
||||
func (ScrapeEngineInnodbStatus) Name() string {
|
||||
return "engine_innodb_status"
|
||||
}
|
||||
|
||||
// Help describes the role of the Scraper.
|
||||
func (ScrapeEngineInnodbStatus) Help() string {
|
||||
return "Collect from SHOW ENGINE INNODB STATUS"
|
||||
}
|
||||
|
||||
// Scrape collects data from database connection and sends it over channel as prometheus metric.
|
||||
func (ScrapeEngineInnodbStatus) Scrape(db *sql.DB, ch chan<- prometheus.Metric) error {
|
||||
rows, err := db.Query(engineInnodbStatusQuery)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user