Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporter log error "queryNamespaceMappings returned 1 errors" when running custom query #965

Open
mg250492 opened this issue Nov 23, 2023 · 0 comments

Comments

@mg250492
Copy link

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: 68c176b)
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant