From 1e32b956c376c6f430ee83c81929ac409b397ef7 Mon Sep 17 00:00:00 2001 From: TJ Hoplock Date: Sun, 29 Sep 2024 01:10:07 -0400 Subject: [PATCH 1/2] chore!: adopt log/slog, drop go-kit/log Requires: prometheus/common#697 This PR includes: - linter updates to enable `sloglint` linter - Go dep updates for prometheus/{client_golang,common,exporter-toolkit} libs - refactorings to adopt log/slog in favor of go-kit/log The bulk of this PR was automated by the following script which is being used to aid in converting the various exporters/projects to use slog: https://gist.github.com/tjhop/49f96fb7ebbe55b12deee0b0312d8434 Builds and passes tests locally with go workspaces and up-to-date main branch of prometheus/common. Signed-off-by: TJ Hoplock --- .golangci.yml | 1 + collector/binlog.go | 4 +-- collector/binlog_test.go | 4 +-- collector/engine_innodb.go | 4 +-- collector/engine_innodb_test.go | 4 +-- collector/engine_tokudb.go | 4 +-- collector/engine_tokudb_test.go | 4 +-- collector/exporter.go | 17 +++++---- collector/exporter_test.go | 4 +-- collector/global_status.go | 4 +-- collector/global_status_test.go | 4 +-- collector/global_variables.go | 4 +-- collector/global_variables_test.go | 4 +-- collector/heartbeat.go | 4 +-- collector/heartbeat_test.go | 4 +-- collector/info_schema_auto_increment.go | 4 +-- collector/info_schema_clientstats.go | 9 +++-- collector/info_schema_clientstats_test.go | 4 +-- collector/info_schema_innodb_cmp.go | 4 +-- collector/info_schema_innodb_cmp_test.go | 4 +-- collector/info_schema_innodb_cmpmem.go | 4 +-- collector/info_schema_innodb_cmpmem_test.go | 4 +-- collector/info_schema_innodb_metrics.go | 7 ++-- collector/info_schema_innodb_metrics_test.go | 4 +-- .../info_schema_innodb_sys_tablespaces.go | 4 +-- ...info_schema_innodb_sys_tablespaces_test.go | 6 ++-- collector/info_schema_processlist.go | 4 +-- collector/info_schema_processlist_test.go | 4 +-- collector/info_schema_query_response_time.go | 9 +++-- .../info_schema_query_response_time_test.go | 4 +-- collector/info_schema_replica_host.go | 7 ++-- collector/info_schema_replica_host_test.go | 4 +-- collector/info_schema_schemastats.go | 9 +++-- collector/info_schema_schemastats_test.go | 4 +-- collector/info_schema_tables.go | 4 +-- collector/info_schema_tablestats.go | 9 +++-- collector/info_schema_tablestats_test.go | 4 +-- collector/info_schema_userstats.go | 9 +++-- collector/info_schema_userstats_test.go | 4 +-- collector/mysql_user.go | 4 +-- collector/perf_schema_events_statements.go | 4 +-- .../perf_schema_events_statements_sum.go | 4 +-- collector/perf_schema_events_waits.go | 4 +-- collector/perf_schema_file_events.go | 4 +-- collector/perf_schema_file_instances.go | 4 +-- collector/perf_schema_file_instances_test.go | 4 +-- collector/perf_schema_index_io_waits.go | 4 +-- collector/perf_schema_index_io_waits_test.go | 4 +-- collector/perf_schema_memory_events.go | 4 +-- collector/perf_schema_memory_events_test.go | 4 +-- ...ma_replication_applier_status_by_worker.go | 4 +-- ...plication_applier_status_by_worker_test.go | 4 +-- ...f_schema_replication_group_member_stats.go | 4 +-- ...ema_replication_group_member_stats_test.go | 4 +-- .../perf_schema_replication_group_members.go | 4 +-- ...f_schema_replication_group_members_test.go | 6 ++-- collector/perf_schema_table_io_waits.go | 4 +-- collector/perf_schema_table_lock_waits.go | 4 +-- collector/scraper.go | 4 +-- collector/slave_hosts.go | 4 +-- collector/slave_hosts_test.go | 8 ++--- collector/slave_status.go | 4 +-- collector/slave_status_test.go | 4 +-- collector/sys_user_summary.go | 4 +-- collector/sys_user_summary_test.go | 4 +-- config/config.go | 10 +++--- config/config_test.go | 23 ++++++------ go.mod | 6 ++-- go.sum | 12 +++---- mysqld_exporter.go | 35 +++++++++---------- probe.go | 11 +++--- 71 files changed, 194 insertions(+), 212 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 489501cb5..1898b56fa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,4 +4,5 @@ linters: enable: - misspell - staticcheck + - sloglint disable-all: true diff --git a/collector/binlog.go b/collector/binlog.go index 7c5c9495e..e301a896a 100644 --- a/collector/binlog.go +++ b/collector/binlog.go @@ -18,10 +18,10 @@ package collector import ( "context" "fmt" + "log/slog" "strconv" "strings" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -71,7 +71,7 @@ func (ScrapeBinlogSize) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeBinlogSize) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeBinlogSize) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var logBin uint8 db := instance.getDB() err := db.QueryRowContext(ctx, logbinQuery).Scan(&logBin) diff --git a/collector/binlog_test.go b/collector/binlog_test.go index e85efb67c..577dd7a76 100644 --- a/collector/binlog_test.go +++ b/collector/binlog_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -44,7 +44,7 @@ func TestScrapeBinlogSize(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeBinlogSize{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeBinlogSize{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/engine_innodb.go b/collector/engine_innodb.go index 206038170..55f06438d 100644 --- a/collector/engine_innodb.go +++ b/collector/engine_innodb.go @@ -17,11 +17,11 @@ package collector import ( "context" + "log/slog" "regexp" "strconv" "strings" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -51,7 +51,7 @@ func (ScrapeEngineInnodbStatus) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeEngineInnodbStatus) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeEngineInnodbStatus) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() rows, err := db.QueryContext(ctx, engineInnodbStatusQuery) if err != nil { diff --git a/collector/engine_innodb_test.go b/collector/engine_innodb_test.go index 07817f1a1..0707e658d 100644 --- a/collector/engine_innodb_test.go +++ b/collector/engine_innodb_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -155,7 +155,7 @@ END OF INNODB MONITOR OUTPUT inst := &instance{db: db} ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeEngineInnodbStatus{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeEngineInnodbStatus{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/engine_tokudb.go b/collector/engine_tokudb.go index 52c411c8d..c6371fb79 100644 --- a/collector/engine_tokudb.go +++ b/collector/engine_tokudb.go @@ -18,9 +18,9 @@ package collector import ( "context" "database/sql" + "log/slog" "strings" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -50,7 +50,7 @@ func (ScrapeEngineTokudbStatus) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeEngineTokudbStatus) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeEngineTokudbStatus) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() tokudbRows, err := db.QueryContext(ctx, engineTokudbStatusQuery) if err != nil { diff --git a/collector/engine_tokudb_test.go b/collector/engine_tokudb_test.go index d08446d3d..e0b4f4b17 100644 --- a/collector/engine_tokudb_test.go +++ b/collector/engine_tokudb_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -60,7 +60,7 @@ func TestScrapeEngineTokudbStatus(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeEngineTokudbStatus{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeEngineTokudbStatus{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/exporter.go b/collector/exporter.go index 2f12e3f96..4e98ea25d 100644 --- a/collector/exporter.go +++ b/collector/exporter.go @@ -16,13 +16,12 @@ package collector import ( "context" "fmt" + "log/slog" "strings" "sync" "time" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/go-sql-driver/mysql" "github.com/prometheus/client_golang/prometheus" ) @@ -80,14 +79,14 @@ var _ prometheus.Collector = (*Exporter)(nil) // Exporter collects MySQL metrics. It implements prometheus.Collector. type Exporter struct { ctx context.Context - logger log.Logger + logger *slog.Logger dsn string scrapers []Scraper instance *instance } // New returns a new MySQL exporter for the provided DSN. -func New(ctx context.Context, dsn string, scrapers []Scraper, logger log.Logger) *Exporter { +func New(ctx context.Context, dsn string, scrapers []Scraper, logger *slog.Logger) *Exporter { // Setup extra params for the DSN, default to having a lock timeout. dsnParams := []string{fmt.Sprintf(timeoutParam, *exporterLockTimeout)} @@ -129,14 +128,14 @@ func (e *Exporter) scrape(ctx context.Context, ch chan<- prometheus.Metric) floa scrapeTime := time.Now() instance, err := newInstance(e.dsn) if err != nil { - level.Error(e.logger).Log("msg", "Error opening connection to database", "err", err) + e.logger.Error("Error opening connection to database", "err", err) return 0.0 } defer instance.Close() e.instance = instance if err := instance.Ping(); err != nil { - level.Error(e.logger).Log("msg", "Error pinging mysqld", "err", err) + e.logger.Error("Error pinging mysqld", "err", err) return 0.0 } @@ -157,8 +156,8 @@ func (e *Exporter) scrape(ctx context.Context, ch chan<- prometheus.Metric) floa label := "collect." + scraper.Name() scrapeTime := time.Now() collectorSuccess := 1.0 - if err := scraper.Scrape(ctx, instance, ch, log.With(e.logger, "scraper", scraper.Name())); err != nil { - level.Error(e.logger).Log("msg", "Error from scraper", "scraper", scraper.Name(), "target", e.getTargetFromDsn(), "err", err) + if err := scraper.Scrape(ctx, instance, ch, e.logger.With("scraper", scraper.Name())); err != nil { + e.logger.Error("Error from scraper", "scraper", scraper.Name(), "target", e.getTargetFromDsn(), "err", err) collectorSuccess = 0.0 } ch <- prometheus.MustNewConstMetric(mysqlScrapeCollectorSuccess, prometheus.GaugeValue, collectorSuccess, label) @@ -172,7 +171,7 @@ func (e *Exporter) getTargetFromDsn() string { // Get target from DSN. dsnConfig, err := mysql.ParseDSN(e.dsn) if err != nil { - level.Error(e.logger).Log("msg", "Error parsing DSN", "err", err) + e.logger.Error("Error parsing DSN", "err", err) return "" } return dsnConfig.Addr diff --git a/collector/exporter_test.go b/collector/exporter_test.go index 3f742263a..db447bfe2 100644 --- a/collector/exporter_test.go +++ b/collector/exporter_test.go @@ -17,9 +17,9 @@ import ( "context" "testing" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -36,7 +36,7 @@ func TestExporter(t *testing.T) { []Scraper{ ScrapeGlobalStatus{}, }, - log.NewNopLogger(), + promslog.NewNopLogger(), ) convey.Convey("Metrics describing", t, func() { diff --git a/collector/global_status.go b/collector/global_status.go index c0a131ead..aa3117c03 100644 --- a/collector/global_status.go +++ b/collector/global_status.go @@ -18,11 +18,11 @@ package collector import ( "context" "database/sql" + "log/slog" "regexp" "strconv" "strings" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -99,7 +99,7 @@ func (ScrapeGlobalStatus) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeGlobalStatus) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeGlobalStatus) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() globalStatusRows, err := db.QueryContext(ctx, globalStatusQuery) if err != nil { diff --git a/collector/global_status_test.go b/collector/global_status_test.go index eea8fd58f..3c379dbb7 100644 --- a/collector/global_status_test.go +++ b/collector/global_status_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -64,7 +64,7 @@ func TestScrapeGlobalStatus(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeGlobalStatus{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeGlobalStatus{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/global_variables.go b/collector/global_variables.go index 6b286ce13..926ffbb31 100644 --- a/collector/global_variables.go +++ b/collector/global_variables.go @@ -18,11 +18,11 @@ package collector import ( "context" "database/sql" + "log/slog" "regexp" "strconv" "strings" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -138,7 +138,7 @@ func (ScrapeGlobalVariables) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeGlobalVariables) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeGlobalVariables) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() globalVariablesRows, err := db.QueryContext(ctx, globalVariablesQuery) if err != nil { diff --git a/collector/global_variables_test.go b/collector/global_variables_test.go index 1bab0a9d6..3e75e8cce 100644 --- a/collector/global_variables_test.go +++ b/collector/global_variables_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -53,7 +53,7 @@ func TestScrapeGlobalVariables(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeGlobalVariables{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeGlobalVariables{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/heartbeat.go b/collector/heartbeat.go index 6b32048fa..68845d910 100644 --- a/collector/heartbeat.go +++ b/collector/heartbeat.go @@ -19,10 +19,10 @@ import ( "context" "database/sql" "fmt" + "log/slog" "strconv" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -100,7 +100,7 @@ func nowExpr() string { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeHeartbeat) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeHeartbeat) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() query := fmt.Sprintf(heartbeatQuery, nowExpr(), *collectHeartbeatDatabase, *collectHeartbeatTable) heartbeatRows, err := db.QueryContext(ctx, query) diff --git a/collector/heartbeat_test.go b/collector/heartbeat_test.go index 1d553bc35..2a734138e 100644 --- a/collector/heartbeat_test.go +++ b/collector/heartbeat_test.go @@ -20,9 +20,9 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -73,7 +73,7 @@ func TestScrapeHeartbeat(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeHeartbeat{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeHeartbeat{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_auto_increment.go b/collector/info_schema_auto_increment.go index 55376b194..f60cedec8 100644 --- a/collector/info_schema_auto_increment.go +++ b/collector/info_schema_auto_increment.go @@ -17,8 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -69,7 +69,7 @@ func (ScrapeAutoIncrementColumns) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeAutoIncrementColumns) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeAutoIncrementColumns) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() autoIncrementRows, err := db.QueryContext(ctx, infoSchemaAutoIncrementQuery) if err != nil { diff --git a/collector/info_schema_clientstats.go b/collector/info_schema_clientstats.go index 64afe35a8..8c8f327ad 100644 --- a/collector/info_schema_clientstats.go +++ b/collector/info_schema_clientstats.go @@ -18,10 +18,9 @@ package collector import ( "context" "fmt" + "log/slog" "strings" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" ) @@ -160,16 +159,16 @@ func (ScrapeClientStat) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeClientStat) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeClientStat) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var varName, varVal string db := instance.getDB() err := db.QueryRowContext(ctx, userstatCheckQuery).Scan(&varName, &varVal) if err != nil { - level.Debug(logger).Log("msg", "Detailed client stats are not available.") + logger.Debug("Detailed client stats are not available.") return nil } if varVal == "OFF" { - level.Debug(logger).Log("msg", "MySQL variable is OFF.", "var", varName) + logger.Debug("MySQL variable is OFF.", "var", varName) return nil } diff --git a/collector/info_schema_clientstats_test.go b/collector/info_schema_clientstats_test.go index cd14ad1a1..395046af4 100644 --- a/collector/info_schema_clientstats_test.go +++ b/collector/info_schema_clientstats_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -42,7 +42,7 @@ func TestScrapeClientStat(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeClientStat{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeClientStat{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_innodb_cmp.go b/collector/info_schema_innodb_cmp.go index 2db730622..f6496dfb5 100644 --- a/collector/info_schema_innodb_cmp.go +++ b/collector/info_schema_innodb_cmp.go @@ -17,8 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -76,7 +76,7 @@ func (ScrapeInnodbCmp) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeInnodbCmp) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeInnodbCmp) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() informationSchemaInnodbCmpRows, err := db.QueryContext(ctx, innodbCmpQuery) if err != nil { diff --git a/collector/info_schema_innodb_cmp_test.go b/collector/info_schema_innodb_cmp_test.go index 26e19fee7..044b65c61 100644 --- a/collector/info_schema_innodb_cmp_test.go +++ b/collector/info_schema_innodb_cmp_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -39,7 +39,7 @@ func TestScrapeInnodbCmp(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeInnodbCmp{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeInnodbCmp{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_innodb_cmpmem.go b/collector/info_schema_innodb_cmpmem.go index 607bd9f53..b1cdd562c 100644 --- a/collector/info_schema_innodb_cmpmem.go +++ b/collector/info_schema_innodb_cmpmem.go @@ -17,8 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -71,7 +71,7 @@ func (ScrapeInnodbCmpMem) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeInnodbCmpMem) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeInnodbCmpMem) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() informationSchemaInnodbCmpMemRows, err := db.QueryContext(ctx, innodbCmpMemQuery) if err != nil { diff --git a/collector/info_schema_innodb_cmpmem_test.go b/collector/info_schema_innodb_cmpmem_test.go index 77558eb69..f330284a1 100644 --- a/collector/info_schema_innodb_cmpmem_test.go +++ b/collector/info_schema_innodb_cmpmem_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -39,7 +39,7 @@ func TestScrapeInnodbCmpMem(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeInnodbCmpMem{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeInnodbCmpMem{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_innodb_metrics.go b/collector/info_schema_innodb_metrics.go index 4abb0a8fb..92c803fb4 100644 --- a/collector/info_schema_innodb_metrics.go +++ b/collector/info_schema_innodb_metrics.go @@ -19,10 +19,9 @@ import ( "context" "errors" "fmt" + "log/slog" "regexp" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" ) @@ -92,7 +91,7 @@ func (ScrapeInnodbMetrics) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeInnodbMetrics) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeInnodbMetrics) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var enabledColumnName string var query string @@ -132,7 +131,7 @@ func (ScrapeInnodbMetrics) Scrape(ctx context.Context, instance *instance, ch ch if subsystem == "buffer_page_io" { match := bufferPageRE.FindStringSubmatch(name) if len(match) != 3 { - level.Warn(logger).Log("msg", "innodb_metrics subsystem buffer_page_io returned an invalid name", "name", name) + logger.Warn("innodb_metrics subsystem buffer_page_io returned an invalid name", "name", name) continue } switch match[1] { diff --git a/collector/info_schema_innodb_metrics_test.go b/collector/info_schema_innodb_metrics_test.go index ea8b295ca..10ab6d571 100644 --- a/collector/info_schema_innodb_metrics_test.go +++ b/collector/info_schema_innodb_metrics_test.go @@ -19,9 +19,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -54,7 +54,7 @@ func TestScrapeInnodbMetrics(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeInnodbMetrics{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeInnodbMetrics{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_innodb_sys_tablespaces.go b/collector/info_schema_innodb_sys_tablespaces.go index 1f291fbfd..5caebeb67 100644 --- a/collector/info_schema_innodb_sys_tablespaces.go +++ b/collector/info_schema_innodb_sys_tablespaces.go @@ -19,9 +19,9 @@ import ( "context" "errors" "fmt" + "log/slog" "github.com/blang/semver/v4" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -101,7 +101,7 @@ func (ScrapeInfoSchemaInnodbTablespaces) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeInfoSchemaInnodbTablespaces) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeInfoSchemaInnodbTablespaces) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var tablespacesTablename string var query string db := instance.getDB() diff --git a/collector/info_schema_innodb_sys_tablespaces_test.go b/collector/info_schema_innodb_sys_tablespaces_test.go index 6b2c35b69..213ae96d6 100644 --- a/collector/info_schema_innodb_sys_tablespaces_test.go +++ b/collector/info_schema_innodb_sys_tablespaces_test.go @@ -20,9 +20,9 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/blang/semver/v4" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -52,7 +52,7 @@ func TestScrapeInfoSchemaInnodbTablespaces(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeInfoSchemaInnodbTablespaces{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeInfoSchemaInnodbTablespaces{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) @@ -101,7 +101,7 @@ func TestScrapeInfoSchemaInnodbTablespacesWithoutSpaceType(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeInfoSchemaInnodbTablespaces{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeInfoSchemaInnodbTablespaces{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_processlist.go b/collector/info_schema_processlist.go index fbe33e448..3dd5d5e2d 100755 --- a/collector/info_schema_processlist.go +++ b/collector/info_schema_processlist.go @@ -18,12 +18,12 @@ package collector import ( "context" "fmt" + "log/slog" "reflect" "sort" "strings" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -96,7 +96,7 @@ func (ScrapeProcesslist) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeProcesslist) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeProcesslist) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { processQuery := fmt.Sprintf( infoSchemaProcesslistQuery, *processlistMinTime, diff --git a/collector/info_schema_processlist_test.go b/collector/info_schema_processlist_test.go index beaa349c5..356f1fa79 100644 --- a/collector/info_schema_processlist_test.go +++ b/collector/info_schema_processlist_test.go @@ -20,9 +20,9 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -57,7 +57,7 @@ func TestScrapeProcesslist(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeProcesslist{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeProcesslist{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_query_response_time.go b/collector/info_schema_query_response_time.go index f163eccb1..c872abdd8 100644 --- a/collector/info_schema_query_response_time.go +++ b/collector/info_schema_query_response_time.go @@ -17,11 +17,10 @@ package collector import ( "context" + "log/slog" "strconv" "strings" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" ) @@ -119,16 +118,16 @@ func (ScrapeQueryResponseTime) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeQueryResponseTime) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeQueryResponseTime) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var queryStats uint8 db := instance.getDB() err := db.QueryRowContext(ctx, queryResponseCheckQuery).Scan(&queryStats) if err != nil { - level.Debug(logger).Log("msg", "Query response time distribution is not available.") + logger.Debug("Query response time distribution is not available.") return nil } if queryStats == 0 { - level.Debug(logger).Log("msg", "MySQL variable is OFF.", "var", "query_response_time_stats") + logger.Debug("MySQL variable is OFF.", "var", "query_response_time_stats") return nil } diff --git a/collector/info_schema_query_response_time_test.go b/collector/info_schema_query_response_time_test.go index bf342f9c9..f3d32fdc7 100644 --- a/collector/info_schema_query_response_time_test.go +++ b/collector/info_schema_query_response_time_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -53,7 +53,7 @@ func TestScrapeQueryResponseTime(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeQueryResponseTime{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeQueryResponseTime{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_replica_host.go b/collector/info_schema_replica_host.go index 78a7e5e4c..743626431 100644 --- a/collector/info_schema_replica_host.go +++ b/collector/info_schema_replica_host.go @@ -17,9 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" - "github.com/go-kit/log/level" MySQL "github.com/go-sql-driver/mysql" "github.com/prometheus/client_golang/prometheus" ) @@ -83,14 +82,14 @@ func (ScrapeReplicaHost) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeReplicaHost) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeReplicaHost) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() replicaHostRows, err := db.QueryContext(ctx, replicaHostQuery) if err != nil { if mysqlErr, ok := err.(*MySQL.MySQLError); ok { // Now the error number is accessible directly // Check for error 1109: Unknown table if mysqlErr.Number == 1109 { - level.Debug(logger).Log("msg", "information_schema.replica_host_status is not available.") + logger.Debug("information_schema.replica_host_status is not available.") return nil } } diff --git a/collector/info_schema_replica_host_test.go b/collector/info_schema_replica_host_test.go index 1bc56bb04..26adb7f9b 100644 --- a/collector/info_schema_replica_host_test.go +++ b/collector/info_schema_replica_host_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -40,7 +40,7 @@ func TestScrapeReplicaHost(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeReplicaHost{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeReplicaHost{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_schemastats.go b/collector/info_schema_schemastats.go index 2825e3efd..2fbbc9e19 100644 --- a/collector/info_schema_schemastats.go +++ b/collector/info_schema_schemastats.go @@ -17,9 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" ) @@ -71,17 +70,17 @@ func (ScrapeSchemaStat) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeSchemaStat) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeSchemaStat) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var varName, varVal string db := instance.getDB() err := db.QueryRowContext(ctx, userstatCheckQuery).Scan(&varName, &varVal) if err != nil { - level.Debug(logger).Log("msg", "Detailed schema stats are not available.") + logger.Debug("Detailed schema stats are not available.") return nil } if varVal == "OFF" { - level.Debug(logger).Log("msg", "MySQL variable is OFF.", "var", varName) + logger.Debug("MySQL variable is OFF.", "var", varName) return nil } diff --git a/collector/info_schema_schemastats_test.go b/collector/info_schema_schemastats_test.go index 4d90b1d41..df89381fb 100644 --- a/collector/info_schema_schemastats_test.go +++ b/collector/info_schema_schemastats_test.go @@ -18,8 +18,8 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -42,7 +42,7 @@ func TestScrapeSchemaStat(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeSchemaStat{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeSchemaStat{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_tables.go b/collector/info_schema_tables.go index d5537561b..9818cc6ed 100644 --- a/collector/info_schema_tables.go +++ b/collector/info_schema_tables.go @@ -18,10 +18,10 @@ package collector import ( "context" "fmt" + "log/slog" "strings" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -96,7 +96,7 @@ func (ScrapeTableSchema) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeTableSchema) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeTableSchema) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var dbList []string db := instance.getDB() if *tableSchemaDatabases == "*" { diff --git a/collector/info_schema_tablestats.go b/collector/info_schema_tablestats.go index 29fabb912..dcf17b9ce 100644 --- a/collector/info_schema_tablestats.go +++ b/collector/info_schema_tablestats.go @@ -17,9 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" ) @@ -71,16 +70,16 @@ func (ScrapeTableStat) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeTableStat) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeTableStat) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var varName, varVal string db := instance.getDB() err := db.QueryRowContext(ctx, userstatCheckQuery).Scan(&varName, &varVal) if err != nil { - level.Debug(logger).Log("msg", "Detailed table stats are not available.") + logger.Debug("Detailed table stats are not available.") return nil } if varVal == "OFF" { - level.Debug(logger).Log("msg", "MySQL variable is OFF.", "var", varName) + logger.Debug("MySQL variable is OFF.", "var", varName) return nil } diff --git a/collector/info_schema_tablestats_test.go b/collector/info_schema_tablestats_test.go index b50abc628..bb9adb22d 100644 --- a/collector/info_schema_tablestats_test.go +++ b/collector/info_schema_tablestats_test.go @@ -18,8 +18,8 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -43,7 +43,7 @@ func TestScrapeTableStat(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeTableStat{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeTableStat{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/info_schema_userstats.go b/collector/info_schema_userstats.go index c8c55e07d..e5a2ba9ae 100644 --- a/collector/info_schema_userstats.go +++ b/collector/info_schema_userstats.go @@ -18,10 +18,9 @@ package collector import ( "context" "fmt" + "log/slog" "strings" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" ) @@ -156,16 +155,16 @@ func (ScrapeUserStat) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeUserStat) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeUserStat) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var varName, varVal string db := instance.getDB() err := db.QueryRowContext(ctx, userstatCheckQuery).Scan(&varName, &varVal) if err != nil { - level.Debug(logger).Log("msg", "Detailed user stats are not available.") + logger.Debug("Detailed user stats are not available.") return nil } if varVal == "OFF" { - level.Debug(logger).Log("msg", "MySQL variable is OFF.", "var", varName) + logger.Debug("MySQL variable is OFF.", "var", varName) return nil } diff --git a/collector/info_schema_userstats_test.go b/collector/info_schema_userstats_test.go index 57292c298..afc395d6d 100644 --- a/collector/info_schema_userstats_test.go +++ b/collector/info_schema_userstats_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -42,7 +42,7 @@ func TestScrapeUserStat(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeUserStat{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeUserStat{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/mysql_user.go b/collector/mysql_user.go index b91db67cb..6648c958d 100644 --- a/collector/mysql_user.go +++ b/collector/mysql_user.go @@ -19,10 +19,10 @@ import ( "context" "database/sql" "fmt" + "log/slog" "strings" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -120,7 +120,7 @@ func (ScrapeUser) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeUser) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeUser) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() var ( userRows *sql.Rows diff --git a/collector/perf_schema_events_statements.go b/collector/perf_schema_events_statements.go index fe125601e..0dc742102 100644 --- a/collector/perf_schema_events_statements.go +++ b/collector/perf_schema_events_statements.go @@ -18,9 +18,9 @@ package collector import ( "context" "fmt" + "log/slog" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -181,7 +181,7 @@ func (ScrapePerfEventsStatements) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfEventsStatements) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfEventsStatements) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { perfQuery := fmt.Sprintf( perfEventsStatementsQuery, *perfEventsStatementsDigestTextLimit, diff --git a/collector/perf_schema_events_statements_sum.go b/collector/perf_schema_events_statements_sum.go index fbb27af05..26b597350 100644 --- a/collector/perf_schema_events_statements_sum.go +++ b/collector/perf_schema_events_statements_sum.go @@ -17,8 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -176,7 +176,7 @@ func (ScrapePerfEventsStatementsSum) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfEventsStatementsSum) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfEventsStatementsSum) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() // Timers here are returned in picoseconds. perfEventsStatementsSumRows, err := db.QueryContext(ctx, perfEventsStatementsSumQuery) diff --git a/collector/perf_schema_events_waits.go b/collector/perf_schema_events_waits.go index e485af0f6..726d9ed35 100644 --- a/collector/perf_schema_events_waits.go +++ b/collector/perf_schema_events_waits.go @@ -17,8 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -60,7 +60,7 @@ func (ScrapePerfEventsWaits) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfEventsWaits) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfEventsWaits) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() // Timers here are returned in picoseconds. perfSchemaEventsWaitsRows, err := db.QueryContext(ctx, perfEventsWaitsQuery) diff --git a/collector/perf_schema_file_events.go b/collector/perf_schema_file_events.go index d2c1d1eda..59db9b5dc 100644 --- a/collector/perf_schema_file_events.go +++ b/collector/perf_schema_file_events.go @@ -17,8 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -69,7 +69,7 @@ func (ScrapePerfFileEvents) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfFileEvents) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfFileEvents) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() // Timers here are returned in picoseconds. perfSchemaFileEventsRows, err := db.QueryContext(ctx, perfFileEventsQuery) diff --git a/collector/perf_schema_file_instances.go b/collector/perf_schema_file_instances.go index ce308f339..f4c44b98b 100644 --- a/collector/perf_schema_file_instances.go +++ b/collector/perf_schema_file_instances.go @@ -17,10 +17,10 @@ package collector import ( "context" + "log/slog" "strings" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -79,7 +79,7 @@ func (ScrapePerfFileInstances) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfFileInstances) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfFileInstances) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() // Timers here are returned in picoseconds. perfSchemaFileInstancesRows, err := db.QueryContext(ctx, perfFileInstancesQuery, *performanceSchemaFileInstancesFilter) diff --git a/collector/perf_schema_file_instances_test.go b/collector/perf_schema_file_instances_test.go index 9750dc0d6..ac0e6e893 100644 --- a/collector/perf_schema_file_instances_test.go +++ b/collector/perf_schema_file_instances_test.go @@ -20,9 +20,9 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -49,7 +49,7 @@ func TestScrapePerfFileInstances(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapePerfFileInstances{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapePerfFileInstances{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { panic(fmt.Sprintf("error calling function on test: %s", err)) } close(ch) diff --git a/collector/perf_schema_index_io_waits.go b/collector/perf_schema_index_io_waits.go index 24b9bf979..8a83aaf79 100644 --- a/collector/perf_schema_index_io_waits.go +++ b/collector/perf_schema_index_io_waits.go @@ -17,8 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -63,7 +63,7 @@ func (ScrapePerfIndexIOWaits) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfIndexIOWaits) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfIndexIOWaits) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() perfSchemaIndexWaitsRows, err := db.QueryContext(ctx, perfIndexIOWaitsQuery) if err != nil { diff --git a/collector/perf_schema_index_io_waits_test.go b/collector/perf_schema_index_io_waits_test.go index 31c09da64..b709dfb79 100644 --- a/collector/perf_schema_index_io_waits_test.go +++ b/collector/perf_schema_index_io_waits_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -41,7 +41,7 @@ func TestScrapePerfIndexIOWaits(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapePerfIndexIOWaits{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapePerfIndexIOWaits{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/perf_schema_memory_events.go b/collector/perf_schema_memory_events.go index f4040793f..a4b1856e0 100644 --- a/collector/perf_schema_memory_events.go +++ b/collector/perf_schema_memory_events.go @@ -17,10 +17,10 @@ package collector import ( "context" + "log/slog" "strings" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -78,7 +78,7 @@ func (ScrapePerfMemoryEvents) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfMemoryEvents) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfMemoryEvents) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() perfSchemaMemoryEventsRows, err := db.QueryContext(ctx, perfMemoryEventsQuery) if err != nil { diff --git a/collector/perf_schema_memory_events_test.go b/collector/perf_schema_memory_events_test.go index 53cacbe91..af5a43da8 100644 --- a/collector/perf_schema_memory_events_test.go +++ b/collector/perf_schema_memory_events_test.go @@ -20,9 +20,9 @@ import ( "github.com/DATA-DOG/go-sqlmock" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -55,7 +55,7 @@ func TestScrapePerfMemoryEvents(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapePerfMemoryEvents{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapePerfMemoryEvents{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { panic(fmt.Sprintf("error calling function on test: %s", err)) } close(ch) diff --git a/collector/perf_schema_replication_applier_status_by_worker.go b/collector/perf_schema_replication_applier_status_by_worker.go index 5826b408c..743d7aaf7 100644 --- a/collector/perf_schema_replication_applier_status_by_worker.go +++ b/collector/perf_schema_replication_applier_status_by_worker.go @@ -15,9 +15,9 @@ package collector import ( "context" + "log/slog" "time" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -100,7 +100,7 @@ func (ScrapePerfReplicationApplierStatsByWorker) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfReplicationApplierStatsByWorker) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfReplicationApplierStatsByWorker) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() perfReplicationApplierStatsByWorkerRows, err := db.QueryContext(ctx, perfReplicationApplierStatsByWorkerQuery) if err != nil { diff --git a/collector/perf_schema_replication_applier_status_by_worker_test.go b/collector/perf_schema_replication_applier_status_by_worker_test.go index 2858933ee..6486af9de 100644 --- a/collector/perf_schema_replication_applier_status_by_worker_test.go +++ b/collector/perf_schema_replication_applier_status_by_worker_test.go @@ -19,9 +19,9 @@ import ( "time" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -55,7 +55,7 @@ func TestScrapePerfReplicationApplierStatsByWorker(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapePerfReplicationApplierStatsByWorker{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapePerfReplicationApplierStatsByWorker{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/perf_schema_replication_group_member_stats.go b/collector/perf_schema_replication_group_member_stats.go index 94d4fa228..502c298e4 100644 --- a/collector/perf_schema_replication_group_member_stats.go +++ b/collector/perf_schema_replication_group_member_stats.go @@ -16,9 +16,9 @@ package collector import ( "context" "database/sql" + "log/slog" "strconv" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -79,7 +79,7 @@ func (ScrapePerfReplicationGroupMemberStats) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfReplicationGroupMemberStats) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfReplicationGroupMemberStats) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() rows, err := db.QueryContext(ctx, perfReplicationGroupMemberStatsQuery) if err != nil { diff --git a/collector/perf_schema_replication_group_member_stats_test.go b/collector/perf_schema_replication_group_member_stats_test.go index 570f39b75..9c192867f 100644 --- a/collector/perf_schema_replication_group_member_stats_test.go +++ b/collector/perf_schema_replication_group_member_stats_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -67,7 +67,7 @@ func TestScrapePerfReplicationGroupMemberStats(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapePerfReplicationGroupMemberStats{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapePerfReplicationGroupMemberStats{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/perf_schema_replication_group_members.go b/collector/perf_schema_replication_group_members.go index 1623a10bb..936b2abfe 100644 --- a/collector/perf_schema_replication_group_members.go +++ b/collector/perf_schema_replication_group_members.go @@ -16,9 +16,9 @@ package collector import ( "context" "database/sql" + "log/slog" "strings" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -45,7 +45,7 @@ func (ScrapePerfReplicationGroupMembers) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfReplicationGroupMembers) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfReplicationGroupMembers) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() perfReplicationGroupMembersRows, err := db.QueryContext(ctx, perfReplicationGroupMembersQuery) if err != nil { diff --git a/collector/perf_schema_replication_group_members_test.go b/collector/perf_schema_replication_group_members_test.go index c47aa9bac..f3492892f 100644 --- a/collector/perf_schema_replication_group_members_test.go +++ b/collector/perf_schema_replication_group_members_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -51,7 +51,7 @@ func TestScrapePerfReplicationGroupMembers(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapePerfReplicationGroupMembers{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapePerfReplicationGroupMembers{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) @@ -103,7 +103,7 @@ func TestScrapePerfReplicationGroupMembersMySQL57(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapePerfReplicationGroupMembers{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapePerfReplicationGroupMembers{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/perf_schema_table_io_waits.go b/collector/perf_schema_table_io_waits.go index a74657b39..4343e6cb7 100644 --- a/collector/perf_schema_table_io_waits.go +++ b/collector/perf_schema_table_io_waits.go @@ -17,8 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -64,7 +64,7 @@ func (ScrapePerfTableIOWaits) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfTableIOWaits) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfTableIOWaits) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() perfSchemaTableWaitsRows, err := db.QueryContext(ctx, perfTableIOWaitsQuery) if err != nil { diff --git a/collector/perf_schema_table_lock_waits.go b/collector/perf_schema_table_lock_waits.go index 81b5d9f91..ea0cfff96 100644 --- a/collector/perf_schema_table_lock_waits.go +++ b/collector/perf_schema_table_lock_waits.go @@ -17,8 +17,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -93,7 +93,7 @@ func (ScrapePerfTableLockWaits) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapePerfTableLockWaits) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapePerfTableLockWaits) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() perfSchemaTableLockWaitsRows, err := db.QueryContext(ctx, perfTableLockWaitsQuery) if err != nil { diff --git a/collector/scraper.go b/collector/scraper.go index a73819fb5..81486de71 100644 --- a/collector/scraper.go +++ b/collector/scraper.go @@ -15,8 +15,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" _ "github.com/go-sql-driver/mysql" "github.com/prometheus/client_golang/prometheus" ) @@ -34,5 +34,5 @@ type Scraper interface { Version() float64 // Scrape collects data from database connection and sends it over channel as prometheus metric. - Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error + Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error } diff --git a/collector/slave_hosts.go b/collector/slave_hosts.go index eff61ff8f..6fe059402 100644 --- a/collector/slave_hosts.go +++ b/collector/slave_hosts.go @@ -18,8 +18,8 @@ package collector import ( "context" "database/sql" + "log/slog" - "github.com/go-kit/log" "github.com/google/uuid" "github.com/prometheus/client_golang/prometheus" ) @@ -63,7 +63,7 @@ func (ScrapeSlaveHosts) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeSlaveHosts) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeSlaveHosts) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var ( slaveHostsRows *sql.Rows err error diff --git a/collector/slave_hosts_test.go b/collector/slave_hosts_test.go index 58db11298..56da3786c 100644 --- a/collector/slave_hosts_test.go +++ b/collector/slave_hosts_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -40,7 +40,7 @@ func TestScrapeSlaveHostsOldFormat(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeSlaveHosts{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeSlaveHosts{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) @@ -79,7 +79,7 @@ func TestScrapeSlaveHostsNewFormat(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeSlaveHosts{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeSlaveHosts{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) @@ -118,7 +118,7 @@ func TestScrapeSlaveHostsWithoutSlaveUuid(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeSlaveHosts{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeSlaveHosts{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/slave_status.go b/collector/slave_status.go index 703dad4f4..5d3b11aee 100644 --- a/collector/slave_status.go +++ b/collector/slave_status.go @@ -19,9 +19,9 @@ import ( "context" "database/sql" "fmt" + "log/slog" "strings" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -69,7 +69,7 @@ func (ScrapeSlaveStatus) Version() float64 { } // Scrape collects data from database connection and sends it over channel as prometheus metric. -func (ScrapeSlaveStatus) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeSlaveStatus) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { var ( slaveStatusRows *sql.Rows err error diff --git a/collector/slave_status_test.go b/collector/slave_status_test.go index 31324f9c8..c49423160 100644 --- a/collector/slave_status_test.go +++ b/collector/slave_status_test.go @@ -18,9 +18,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -39,7 +39,7 @@ func TestScrapeSlaveStatus(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeSlaveStatus{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeSlaveStatus{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/collector/sys_user_summary.go b/collector/sys_user_summary.go index a2ab948b8..e4d38ff1b 100644 --- a/collector/sys_user_summary.go +++ b/collector/sys_user_summary.go @@ -15,8 +15,8 @@ package collector import ( "context" + "log/slog" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" ) @@ -98,7 +98,7 @@ func (ScrapeSysUserSummary) Version() float64 { } // Scrape the information from sys.user_summary, creating a metric for each value of each row, labeled with the user -func (ScrapeSysUserSummary) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error { +func (ScrapeSysUserSummary) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger *slog.Logger) error { db := instance.getDB() diff --git a/collector/sys_user_summary_test.go b/collector/sys_user_summary_test.go index ad6d1d705..38d569f60 100644 --- a/collector/sys_user_summary_test.go +++ b/collector/sys_user_summary_test.go @@ -21,9 +21,9 @@ import ( "testing" "github.com/DATA-DOG/go-sqlmock" - "github.com/go-kit/log" "github.com/prometheus/client_golang/prometheus" dto "github.com/prometheus/client_model/go" + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -113,7 +113,7 @@ func TestScrapeSysUserSummary(t *testing.T) { ch := make(chan prometheus.Metric) go func() { - if err = (ScrapeSysUserSummary{}).Scrape(context.Background(), inst, ch, log.NewNopLogger()); err != nil { + if err = (ScrapeSysUserSummary{}).Scrape(context.Background(), inst, ch, promslog.NewNopLogger()); err != nil { t.Errorf("error calling function on test: %s", err) } close(ch) diff --git a/config/config.go b/config/config.go index 27ce4b76d..a69805113 100644 --- a/config/config.go +++ b/config/config.go @@ -17,15 +17,13 @@ import ( "crypto/tls" "crypto/x509" "fmt" + "log/slog" "net" "os" "strconv" "strings" "sync" - "github.com/go-kit/log" - "github.com/go-kit/log/level" - "github.com/go-sql-driver/mysql" "github.com/prometheus/client_golang/prometheus" @@ -84,7 +82,7 @@ func (ch *MySqlConfigHandler) GetConfig() *Config { return ch.Config } -func (ch *MySqlConfigHandler) ReloadConfig(filename string, mysqldAddress string, mysqldUser string, tlsInsecureSkipVerify bool, logger log.Logger) error { +func (ch *MySqlConfigHandler) ReloadConfig(filename string, mysqldAddress string, mysqldUser string, tlsInsecureSkipVerify bool, logger *slog.Logger) error { var host, port string defer func() { if err != nil { @@ -136,11 +134,11 @@ func (ch *MySqlConfigHandler) ReloadConfig(filename string, mysqldAddress string err = sec.StrictMapTo(mysqlcfg) if err != nil { - level.Error(logger).Log("msg", "failed to parse config", "section", sectionName, "err", err) + logger.Error("failed to parse config", "section", sectionName, "err", err) continue } if err := mysqlcfg.validateConfig(); err != nil { - level.Error(logger).Log("msg", "failed to validate config", "section", sectionName, "err", err) + logger.Error("failed to validate config", "section", sectionName, "err", err) continue } diff --git a/config/config_test.go b/config/config_test.go index a282efcfc..c1d21b07b 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -18,8 +18,7 @@ import ( "os" "testing" - "github.com/go-kit/log" - + "github.com/prometheus/common/promslog" "github.com/smartystreets/goconvey/convey" ) @@ -28,7 +27,7 @@ func TestValidateConfig(t *testing.T) { c := MySqlConfigHandler{ Config: &Config{}, } - if err := c.ReloadConfig("testdata/client.cnf", "localhost:3306", "", true, log.NewNopLogger()); err != nil { + if err := c.ReloadConfig("testdata/client.cnf", "localhost:3306", "", true, promslog.NewNopLogger()); err != nil { t.Error(err) } @@ -60,7 +59,7 @@ func TestValidateConfig(t *testing.T) { c := MySqlConfigHandler{ Config: &Config{}, } - if err := c.ReloadConfig("testdata/child_client.cnf", "localhost:3306", "", true, log.NewNopLogger()); err != nil { + if err := c.ReloadConfig("testdata/child_client.cnf", "localhost:3306", "", true, promslog.NewNopLogger()); err != nil { t.Error(err) } cfg := c.GetConfig() @@ -73,7 +72,7 @@ func TestValidateConfig(t *testing.T) { Config: &Config{}, } os.Setenv("MYSQLD_EXPORTER_PASSWORD", "supersecretpassword") - if err := c.ReloadConfig("", "testhost:5000", "testuser", true, log.NewNopLogger()); err != nil { + if err := c.ReloadConfig("", "testhost:5000", "testuser", true, promslog.NewNopLogger()); err != nil { t.Error(err) } @@ -90,7 +89,7 @@ func TestValidateConfig(t *testing.T) { Config: &Config{}, } os.Setenv("MYSQLD_EXPORTER_PASSWORD", "supersecretpassword") - err := c.ReloadConfig("", "testhost", "testuser", true, log.NewNopLogger()) + err := c.ReloadConfig("", "testhost", "testuser", true, promslog.NewNopLogger()) convey.So( err, convey.ShouldBeError, @@ -102,7 +101,7 @@ func TestValidateConfig(t *testing.T) { Config: &Config{}, } os.Setenv("MYSQLD_EXPORTER_PASSWORD", "supersecretpassword") - if err := c.ReloadConfig("testdata/client.cnf", "localhost:3306", "fakeuser", true, log.NewNopLogger()); err != nil { + if err := c.ReloadConfig("testdata/client.cnf", "localhost:3306", "fakeuser", true, promslog.NewNopLogger()); err != nil { t.Error(err) } @@ -117,7 +116,7 @@ func TestValidateConfig(t *testing.T) { Config: &Config{}, } os.Clearenv() - err := c.ReloadConfig("testdata/missing_user.cnf", "localhost:3306", "", true, log.NewNopLogger()) + err := c.ReloadConfig("testdata/missing_user.cnf", "localhost:3306", "", true, promslog.NewNopLogger()) convey.So( err, convey.ShouldResemble, @@ -130,7 +129,7 @@ func TestValidateConfig(t *testing.T) { Config: &Config{}, } os.Clearenv() - if err := c.ReloadConfig("testdata/missing_password.cnf", "localhost:3306", "", true, log.NewNopLogger()); err != nil { + if err := c.ReloadConfig("testdata/missing_password.cnf", "localhost:3306", "", true, promslog.NewNopLogger()); err != nil { t.Error(err) } @@ -151,7 +150,7 @@ func TestFormDSN(t *testing.T) { ) convey.Convey("Host exporter dsn", t, func() { - if err := c.ReloadConfig("testdata/client.cnf", "localhost:3306", "", false, log.NewNopLogger()); err != nil { + if err := c.ReloadConfig("testdata/client.cnf", "localhost:3306", "", false, promslog.NewNopLogger()); err != nil { t.Error(err) } convey.Convey("Default Client", func() { @@ -191,7 +190,7 @@ func TestFormDSNWithSslSkipVerify(t *testing.T) { ) convey.Convey("Host exporter dsn with tls skip verify", t, func() { - if err := c.ReloadConfig("testdata/client.cnf", "localhost:3306", "", true, log.NewNopLogger()); err != nil { + if err := c.ReloadConfig("testdata/client.cnf", "localhost:3306", "", true, promslog.NewNopLogger()); err != nil { t.Error(err) } convey.Convey("Default Client", func() { @@ -223,7 +222,7 @@ func TestFormDSNWithCustomTls(t *testing.T) { ) convey.Convey("Host exporter dsn with custom tls", t, func() { - if err := c.ReloadConfig("testdata/client_custom_tls.cnf", "localhost:3306", "", false, log.NewNopLogger()); err != nil { + if err := c.ReloadConfig("testdata/client_custom_tls.cnf", "localhost:3306", "", false, promslog.NewNopLogger()); err != nil { t.Error(err) } convey.Convey("Target tls enabled", func() { diff --git a/go.mod b/go.mod index eb0ae5cb1..9193fa770 100644 --- a/go.mod +++ b/go.mod @@ -6,14 +6,13 @@ require ( github.com/DATA-DOG/go-sqlmock v1.5.2 github.com/alecthomas/kingpin/v2 v2.4.0 github.com/blang/semver/v4 v4.0.0 - github.com/go-kit/log v0.2.1 github.com/go-sql-driver/mysql v1.8.1 github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.6.0 - github.com/prometheus/client_golang v1.20.2 + github.com/prometheus/client_golang v1.20.4 github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.59.1 - github.com/prometheus/exporter-toolkit v0.12.0 + github.com/prometheus/exporter-toolkit v0.13.0 github.com/smartystreets/goconvey v1.8.1 gopkg.in/ini.v1 v1.67.0 ) @@ -24,7 +23,6 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/gopherjs/gopherjs v1.17.2 // indirect github.com/jpillora/backoff v1.0.0 // indirect github.com/jtolds/gls v4.20.0+incompatible // indirect diff --git a/go.sum b/go.sum index 733ed9a79..54f913efe 100644 --- a/go.sum +++ b/go.sum @@ -17,10 +17,6 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= -github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y= github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -53,14 +49,14 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= -github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= +github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI= +github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= -github.com/prometheus/exporter-toolkit v0.12.0 h1:DkE5RcEZR3lQA2QD5JLVQIf41dFKNsVMXFhgqcif7fo= -github.com/prometheus/exporter-toolkit v0.12.0/go.mod h1:fQH0KtTn0yrrS0S82kqppRjDDiwMfIQUwT+RBRRhwUc= +github.com/prometheus/exporter-toolkit v0.13.0 h1:lmA0Q+8IaXgmFRKw09RldZmZdnvu9wwcDLIXGmTPw1c= +github.com/prometheus/exporter-toolkit v0.13.0/go.mod h1:2uop99EZl80KdXhv/MxVI2181fMcwlsumFOqBecGkG0= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/mysqld_exporter.go b/mysqld_exporter.go index 7a3c9e3f2..d50bb60ef 100644 --- a/mysqld_exporter.go +++ b/mysqld_exporter.go @@ -16,19 +16,18 @@ package main import ( "context" "fmt" + "log/slog" "net/http" "os" "strconv" "time" "github.com/alecthomas/kingpin/v2" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" versioncollector "github.com/prometheus/client_golang/prometheus/collectors/version" "github.com/prometheus/client_golang/prometheus/promhttp" - "github.com/prometheus/common/promlog" - "github.com/prometheus/common/promlog/flag" + "github.com/prometheus/common/promslog" + "github.com/prometheus/common/promslog/flag" "github.com/prometheus/common/version" "github.com/prometheus/exporter-toolkit/web" webflag "github.com/prometheus/exporter-toolkit/web/kingpinflag" @@ -159,7 +158,7 @@ func init() { prometheus.MustRegister(versioncollector.NewCollector("mysqld_exporter")) } -func newHandler(scrapers []collector.Scraper, logger log.Logger) http.HandlerFunc { +func newHandler(scrapers []collector.Scraper, logger *slog.Logger) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var dsn string var err error @@ -172,10 +171,10 @@ func newHandler(scrapers []collector.Scraper, logger log.Logger) http.HandlerFun cfg := c.GetConfig() cfgsection, ok := cfg.Sections["client"] if !ok { - level.Error(logger).Log("msg", "Failed to parse section [client] from config file", "err", err) + logger.Error("Failed to parse section [client] from config file", "err", err) } if dsn, err = cfgsection.FormDSN(target); err != nil { - level.Error(logger).Log("msg", "Failed to form dsn from section [client]", "err", err) + logger.Error("Failed to form dsn from section [client]", "err", err) } collect := q["collect[]"] @@ -185,7 +184,7 @@ func newHandler(scrapers []collector.Scraper, logger log.Logger) http.HandlerFun // If a timeout is configured via the Prometheus header, add it to the context. timeoutSeconds, err := getScrapeTimeoutSeconds(r, *timeoutOffset) if err != nil { - level.Error(logger).Log("msg", "Error getting timeout from Prometheus header", "err", err) + logger.Error("Error getting timeout from Prometheus header", "err", err) } if timeoutSeconds > 0 { // Create new timeout context with request context as parent. @@ -230,19 +229,19 @@ func main() { } // Parse flags. - promlogConfig := &promlog.Config{} - flag.AddFlags(kingpin.CommandLine, promlogConfig) + promslogConfig := &promslog.Config{} + flag.AddFlags(kingpin.CommandLine, promslogConfig) kingpin.Version(version.Print("mysqld_exporter")) kingpin.HelpFlag.Short('h') kingpin.Parse() - logger := promlog.New(promlogConfig) + logger := promslog.New(promslogConfig) - level.Info(logger).Log("msg", "Starting mysqld_exporter", "version", version.Info()) - level.Info(logger).Log("msg", "Build context", "build_context", version.BuildContext()) + logger.Info("Starting mysqld_exporter", "version", version.Info()) + logger.Info("Build context", "build_context", version.BuildContext()) var err error if err = c.ReloadConfig(*configMycnf, *mysqldAddress, *mysqldUser, *tlsInsecureSkipVerify, logger); err != nil { - level.Info(logger).Log("msg", "Error parsing host config", "file", *configMycnf, "err", err) + logger.Info("Error parsing host config", "file", *configMycnf, "err", err) os.Exit(1) } @@ -250,7 +249,7 @@ func main() { enabledScrapers := []collector.Scraper{} for scraper, enabled := range scraperFlags { if *enabled { - level.Info(logger).Log("msg", "Scraper enabled", "scraper", scraper.Name()) + logger.Info("Scraper enabled", "scraper", scraper.Name()) enabledScrapers = append(enabledScrapers, scraper) } } @@ -270,7 +269,7 @@ func main() { } landingPage, err := web.NewLandingPage(landingConfig) if err != nil { - level.Error(logger).Log("err", err) + logger.Error("Error creating landing page", "err", err) os.Exit(1) } http.Handle("/", landingPage) @@ -278,14 +277,14 @@ func main() { http.HandleFunc("/probe", handleProbe(enabledScrapers, logger)) http.HandleFunc("/-/reload", func(w http.ResponseWriter, r *http.Request) { if err = c.ReloadConfig(*configMycnf, *mysqldAddress, *mysqldUser, *tlsInsecureSkipVerify, logger); err != nil { - level.Warn(logger).Log("msg", "Error reloading host config", "file", *configMycnf, "error", err) + logger.Warn("Error reloading host config", "file", *configMycnf, "error", err) return } _, _ = w.Write([]byte(`ok`)) }) srv := &http.Server{} if err := web.ListenAndServe(srv, toolkitFlags, logger); err != nil { - level.Error(logger).Log("msg", "Error starting HTTP server", "err", err) + logger.Error("Error starting HTTP server", "err", err) os.Exit(1) } } diff --git a/probe.go b/probe.go index c101aee6f..a6027fb6d 100644 --- a/probe.go +++ b/probe.go @@ -16,17 +16,16 @@ package main import ( "context" "fmt" + "log/slog" "net/http" "time" - "github.com/go-kit/log" - "github.com/go-kit/log/level" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/mysqld_exporter/collector" ) -func handleProbe(scrapers []collector.Scraper, logger log.Logger) http.HandlerFunc { +func handleProbe(scrapers []collector.Scraper, logger *slog.Logger) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { ctx := r.Context() params := r.URL.Query() @@ -45,13 +44,13 @@ func handleProbe(scrapers []collector.Scraper, logger log.Logger) http.HandlerFu cfg := c.GetConfig() cfgsection, ok := cfg.Sections[authModule] if !ok { - level.Error(logger).Log("msg", fmt.Sprintf("Could not find section [%s] from config file", authModule)) + logger.Error(fmt.Sprintf("Could not find section [%s] from config file", authModule)) http.Error(w, fmt.Sprintf("Could not find config section [%s]", authModule), http.StatusBadRequest) return } dsn, err := cfgsection.FormDSN(target) if err != nil { - level.Error(logger).Log("msg", fmt.Sprintf("Failed to form dsn from section [%s]", authModule), "err", err) + logger.Error(fmt.Sprintf("Failed to form dsn from section [%s]", authModule), "err", err) http.Error(w, fmt.Sprintf("Error forming dsn from config section [%s]", authModule), http.StatusBadRequest) return } @@ -59,7 +58,7 @@ func handleProbe(scrapers []collector.Scraper, logger log.Logger) http.HandlerFu // If a timeout is configured via the Prometheus header, add it to the context. timeoutSeconds, err := getScrapeTimeoutSeconds(r, *timeoutOffset) if err != nil { - level.Error(logger).Log("msg", "Error getting timeout from Prometheus header", "err", err) + logger.Error("Error getting timeout from Prometheus header", "err", err) } if timeoutSeconds > 0 { // Create new timeout context with request context as parent. From a9e29fdbd767992676d930074242a5e577f3dec0 Mon Sep 17 00:00:00 2001 From: TJ Hoplock Date: Tue, 1 Oct 2024 09:43:28 -0400 Subject: [PATCH 2/2] build(deps): bump prometheus/common to v0.60.0 Signed-off-by: TJ Hoplock --- go.mod | 12 ++++++------ go.sum | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 9193fa770..17ba2ac16 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/google/uuid v1.6.0 github.com/prometheus/client_golang v1.20.4 github.com/prometheus/client_model v0.6.1 - github.com/prometheus/common v0.59.1 + github.com/prometheus/common v0.60.0 github.com/prometheus/exporter-toolkit v0.13.0 github.com/smartystreets/goconvey v1.8.1 gopkg.in/ini.v1 v1.67.0 @@ -34,12 +34,12 @@ require ( github.com/prometheus/procfs v0.15.1 // indirect github.com/smarty/assertions v1.15.0 // indirect github.com/xhit/go-str2duration/v2 v2.1.0 // indirect - golang.org/x/crypto v0.26.0 // indirect - golang.org/x/net v0.28.0 // indirect - golang.org/x/oauth2 v0.22.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/oauth2 v0.23.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/text v0.18.0 // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/go.sum b/go.sum index 54f913efe..663a1a4f1 100644 --- a/go.sum +++ b/go.sum @@ -53,8 +53,8 @@ github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zI github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0= -github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0= +github.com/prometheus/common v0.60.0 h1:+V9PAREWNvJMAuJ1x1BaWl9dewMW4YrHZQbx0sJNllA= +github.com/prometheus/common v0.60.0/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= github.com/prometheus/exporter-toolkit v0.13.0 h1:lmA0Q+8IaXgmFRKw09RldZmZdnvu9wwcDLIXGmTPw1c= github.com/prometheus/exporter-toolkit v0.13.0/go.mod h1:2uop99EZl80KdXhv/MxVI2181fMcwlsumFOqBecGkG0= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= @@ -71,18 +71,18 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc= github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= -golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= -golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= +golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= +golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=