prometheus-community / prometheus-community/postgres_exporter

queries.yaml from repo is not working

Open
#741 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
3.6k
Forks
835
Avg merge
2d 4h
Merged PRs (30d)
10

Description

What did you do?
Using --extend.query-path=/usr/local/bin/queries.yaml to use the additional stats from queries.yaml.

What did you expect to see?
I expected to see e.g. pg_stat_user_tables_n_dead_tup parameter exported on the metrics endpoint.

What did you see instead? Under which circumstances?
The parameter is not exported (and no other data beginning with pg_stat_user_tables_). Debug logging in syslog shows caller=namespace.go:193 level=debug msg="Querying namespace" namespace=pg_stat_user_tables with no errors.

pg_exporter_user_queries_load_error returns 0 for the loaded file.

I can see pg_replication_lag and pg_postmaster_start_time_seconds, which are the first 2 metrics in queries.yaml so I wonder if there is some weird syntax error that I can't see in queries.yaml in the repo.

Environment
Ubuntu 22.04

  • System information:

    Linux 5.15.0-1029-azure x86_64

  • postgres_exporter version:

    postgres_exporter, version 0.12.0-rc.0 (branch: HEAD, revision: ce947b190896adee8834d9042944c805db3a90b7)
    build user: root@f461ec45c280
    build date: 20220829-15:41:50
    go version: go1.18.5
    platform: linux/amd64

  • postgres_exporter flags:

 --web.listen-address=:9187 --web.telemetry-path=/metrics --extend.query-path=/usr/local/bin/queries.yaml
  • PostgreSQL version:

    14.5

  • Logs:

Jan  4 09:58:28 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:28.455Z caller=main.go:96 level=error msg="Error loading config" err="Error opening config file \"postgres_exporter.yml\": open postgres_exporter.yml: no such file or directory"
Jan  4 09:58:28 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:28.455Z caller=main.go:149 level=info msg="Listening on address" address=:9187
Jan  4 09:58:28 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:28.455Z caller=tls_config.go:195 level=info msg="TLS is disabled." http2=false
Jan  4 09:58:57 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:57.929Z caller=namespace.go:193 level=debug msg="Querying namespace" namespace=pg_stat_database_conflicts
Jan  4 09:58:57 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:57.929Z caller=namespace.go:193 level=debug msg="Querying namespace" namespace=pg_locks
Jan  4 09:58:57 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:57.930Z caller=namespace.go:193 level=debug msg="Querying namespace" namespace=pg_stat_user_tables
Jan  4 09:58:57 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:57.931Z caller=namespace.go:193 level=debug msg="Querying namespace" namespace=pg_statio_user_tables
Jan  4 09:58:57 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:57.931Z caller=namespace.go:193 level=debug msg="Querying namespace" namespace=pg_stat_archiver
Jan  4 09:58:57 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:57.932Z caller=namespace.go:193 level=debug msg="Querying namespace" namespace=pg_stat_database
Jan  4 09:58:57 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:57.933Z caller=namespace.go:193 level=debug msg="Querying namespace" namespace=pg_postmaster
Jan  4 09:58:57 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:57.933Z caller=namespace.go:193 level=debug msg="Querying namespace" namespace=pg_replication
Jan  4 09:58:57 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:57.935Z caller=collector.go:190 level=debug msg="collector succeeded" name=bgwriter duration_seconds=0.010618432
Jan  4 09:58:57 microservices-postgres1 postgres_exporter[1446023]: ts=2023-01-04T09:58:57.940Z caller=collector.go:190 level=debug msg="collector succeeded" name=database duration_seconds=0.015734093

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with queries.yaml and namespace.go around line 193, then reproduce the reported --extend.query-path behavior and inspect the metrics endpoint for the pg_stat_user_tables namespace. Done means the query file loads without error and metrics such as pg_stat_user_tables_n_dead_tup are exported as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.