mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-04-04 23:29:30 +00:00
Refactoring: fix error
This commit is contained in:
parent
d74818ccac
commit
c4508ff430
@ -1485,15 +1485,15 @@ func (e *Exporter) discoverDatabaseDSNs() []string {
|
||||
func (e *Exporter) scrapeDSN(ch chan<- prometheus.Metric, dsn string) error {
|
||||
server, err := e.servers.GetServer(dsn)
|
||||
|
||||
if err != nil {
|
||||
return &ErrorConnectToServer{fmt.Sprintf("Error opening connection to database (%s): %s", loggableDSN(dsn), err.Error())}
|
||||
}
|
||||
|
||||
// Check if autoDiscoverDatabases is false, set dsn as master database (Default: false)
|
||||
if !e.autoDiscoverDatabases {
|
||||
server.master = true
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return &ErrorConnectToServer{fmt.Sprintf("Error opening connection to database (%s): %s", loggableDSN(dsn), err.Error())}
|
||||
}
|
||||
|
||||
// Check if map versions need to be updated
|
||||
if err := e.checkMapVersions(ch, server); err != nil {
|
||||
log.Warnln("Proceeding with outdated query maps, as the Postgres version could not be determined:", err)
|
||||
|
Loading…
Reference in New Issue
Block a user