Exporter log error "queryNamespaceMappings returned 1 errors" when running custom query
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go, postgresql
- Domain
- databases, observability
Research direction
The report points to namespace.go:236 and postgres_exporter.go:682; start by tracing how PG_EXPORTER_AUTO_DISCOVER_DATABASES applies configured custom queries across databases. Define and verify a way for pg_open to target one database, with the query running there without relation-not-found or error logs on other databases. No test file is named in the report.
Written by the indexing model from the issue text.
Description
What did you do?
I have 1 postgres server with multiple databases for multiple services, and I run multiple metrics on all databases,
And I want to setup a custom query for specific database.
the query:
pg_open:
query: "SELECT status status,count(*) total FROM repository group by status"
metrics:
- status:
usage: "LABEL"
description: "status"
- total:
usage: "GAUGE"
description: "total"
What did you expect to see?
To not see error logs from running this query, I want this query to run on 1 database only.
What did you see instead? Under which circumstances?
Error logs:
caller=namespace.go:236 level=info err="Error running query on database \"localhost:5432\": pg_open pq: relation \"repository\" does not exist"
caller=postgres_exporter.go:682 level=error err="queryNamespaceMappings returned 1 errors"
Environment
- System information:
Linux 5.15.0-79-generic x86_64
- postgres_exporter version:
postgres_exporter, version 0.15.0 (branch: HEAD, revision: 68c176b8833b7580bf847cecf60f8e0ad5923f9a)
build user: root@05d0b99bd5f7
build date: 20231108-12:59:10
go version: go1.20.11
platform: linux/amd64
tags: unknown
- postgres_exporter flags:
- name: DATA_SOURCE_USER
value: postgres
- name: DATA_SOURCE_URI
value: localhost?sslmode=disable
- name: PG_EXPORTER_EXTEND_QUERY_PATH
value: /config/queries.yaml
- name: PG_EXPORTER_AUTO_DISCOVER_DATABASES
value: 'true'
- PostgreSQL version:
postgres:13-alpine
- Exporter Logs:
caller=namespace.go:236 level=info err="Error running query on database \"localhost:5432\": pg_open pq: relation \"repository\" does not exist"
caller=postgres_exporter.go:682 level=error err="queryNamespaceMappings returned 1 errors"
- Dominant language
- Go
- Stars
- 3.6k
- Forks
- 835
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 10
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from prometheus-community/postgres_exporter
-
BDU:2025-02344 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
prometheus-community/postgres_exporter#716 · 3 reactions ·
All issues in prometheus-community/postgres_exporter
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100