You've already forked mysqld_exporter
mirror of
https://github.com/prometheus/mysqld_exporter.git
synced 2025-07-31 17:44:21 +03:00
Add the instance struct to handle connections (#859)
The intent is to use the instance struct to hold the connection to the database as well as metadata about the instance: - version - flavor (mariadb or mysql) Change is similar to prometheus-community/postgres_exporter#785 Signed-off-by: Vlad Gusev <vlad.esten@gmail.com>
This commit is contained in:
@ -37,6 +37,7 @@ func TestScrapePerfFileInstances(t *testing.T) {
|
||||
t.Fatalf("error opening a stub database connection: %s", err)
|
||||
}
|
||||
defer db.Close()
|
||||
inst := &instance{db: db}
|
||||
|
||||
columns := []string{"FILE_NAME", "EVENT_NAME", "COUNT_READ", "COUNT_WRITE", "SUM_NUMBER_OF_BYTES_READ", "SUM_NUMBER_OF_BYTES_WRITE"}
|
||||
|
||||
@ -48,7 +49,7 @@ func TestScrapePerfFileInstances(t *testing.T) {
|
||||
|
||||
ch := make(chan prometheus.Metric)
|
||||
go func() {
|
||||
if err = (ScrapePerfFileInstances{}).Scrape(context.Background(), db, ch, log.NewNopLogger()); err != nil {
|
||||
if err = (ScrapePerfFileInstances{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil {
|
||||
panic(fmt.Sprintf("error calling function on test: %s", err))
|
||||
}
|
||||
close(ch)
|
||||
|
Reference in New Issue
Block a user