postgres_exporter
postgres_exporter copied to clipboard
Multi-target support issue with UNIX socket path encoding
I'd like to collect metrics like analyze/vacuum stats for tables in multiple databases, not just the one in the primary DSN. I'm trying to use multi-target support for this, but running into an issue when using a UNIX socket for the connection, as the slashes in the path aren't being decoded correctly.
For example, the following URL:
http://localhost:9187/probe?target=user=app_prometheus_postgres_exporter%20dbname=postgres%20host=%2Frun%2Fpostgresql%20port=5432
Results in:
caller=probe.go:81 level=error target="user=app_prometheus_postgres_exporter dbname=postgres host=/run/postgresql port=5432" msg="Error opening connection to database" err="error querying postgresql version: parse \"postgresql://app_prometheus_postgres_exporter:@%2Frun%2Fpostgresql:5432?dbname=postgres\": invalid URL escape \"%2F\""
caller=postgres_exporter.go:682 level=error err="Error opening connection to database (could not parse DATA_SOURCE_NAME): parse \"postgresql://app_prometheus_postgres_exporter:@%2Frun%2Fpostgresql:5432?dbname=postgres\": invalid URL escape \"%2F\""
If there's a better/simpler way, please let me know.