mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-05-16 23:08:45 +00:00
PMM-9541 Fix database discover when using socket (#118)
When discovering databases and using local socket connection add trailing "/" to the database name to omit using it as a host for the connection.
This commit is contained in:
parent
aec5cf01b1
commit
c3fbc44358
@ -75,7 +75,11 @@ func (e *Exporter) discoverDatabaseDSNs() []string {
|
||||
}
|
||||
|
||||
if dsnURI != nil {
|
||||
dsnURI.Path = databaseName
|
||||
if dsnURI.Host == "" && strings.HasPrefix(dsnURI.Path, "/") {
|
||||
dsnURI.Path = "/" + databaseName
|
||||
} else {
|
||||
dsnURI.Path = databaseName
|
||||
}
|
||||
dsn = dsnURI.String()
|
||||
} else {
|
||||
// replacing one dbname with another is complicated.
|
||||
|
Loading…
Reference in New Issue
Block a user