diff --git a/cmd/postgres_exporter/main.go b/cmd/postgres_exporter/main.go index 39e401e53..35db723a2 100644 --- a/cmd/postgres_exporter/main.go +++ b/cmd/postgres_exporter/main.go @@ -119,7 +119,6 @@ func main() { logger, dsn, []string{}, - collector.WithAutoDiscoverDatabases(*autoDiscoverDatabases), ) if err != nil { level.Error(logger).Log("msg", "Failed to create PostgresCollector", "err", err.Error()) diff --git a/collector/collector.go b/collector/collector.go index e75f67ddc..58765b659 100644 --- a/collector/collector.go +++ b/collector/collector.go @@ -87,10 +87,6 @@ type PostgresCollector struct { logger log.Logger servers map[string]*server - - // autoDiscoverDatabases will cause the collector to query the database - // to find other servers and also scrape them. - autoDiscoverDatabases bool } type Option func(*PostgresCollector) error @@ -146,12 +142,6 @@ func NewPostgresCollector(logger log.Logger, dsns []string, filters []string, op if err != nil { return nil, err } - // Manually provided servers are always classified as "primary" - s.isPrimary = true - - // TODO(@sysadmind): We need to discover the downstream servers and add them here. - // if p.autoDiscoverDatabases { - // } servers[dsn] = s } @@ -161,13 +151,6 @@ func NewPostgresCollector(logger log.Logger, dsns []string, filters []string, op return p, nil } -func WithAutoDiscoverDatabases(discover bool) Option { - return func(p *PostgresCollector) error { - p.autoDiscoverDatabases = discover - return nil - } -} - // Describe implements the prometheus.Collector interface. func (p PostgresCollector) Describe(ch chan<- *prometheus.Desc) { ch <- scrapeDurationDesc diff --git a/collector/server.go b/collector/server.go index 3c6d1c858..fa490a2c6 100644 --- a/collector/server.go +++ b/collector/server.go @@ -22,10 +22,9 @@ import ( ) type server struct { - dsn string - name string - db *sql.DB - isPrimary bool // Certain queries are only run on the primary server + dsn string + name string + db *sql.DB } func makeServer(dsn string) (*server, error) {