Clean up autoDiscoverDatabases in the new collector

Signed-off-by: Joe Adams <github@joeadams.io>
This commit is contained in:
Joe Adams 2022-02-25 08:11:22 -05:00
parent 27d23d02ef
commit 9704b9fb2e
No known key found for this signature in database
GPG Key ID: 2A21CFFDE8B588C6
3 changed files with 3 additions and 22 deletions

View File

@ -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())

View File

@ -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

View File

@ -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) {