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

pg_stat_* metrics are reported for all databases on the server, regardless of how they're included / excluded #994

Open
RealOrangeOne opened this issue Jan 4, 2024 · 0 comments

Comments

@RealOrangeOne
Copy link

What did you do?

When listing data sources to scrape only specific databases on a single postgres server (I'd use autodiscovery, but that looks deprecated), the pg_stat_* metrics include all databases, with no way to exclude them besides modifying any relevant alerts etc.

What did you expect to see?

For pg_stat_* metrics, only metrics for databases we're explicitly scraping are considered

What did you see instead? Under which circumstances?

All databases are scraped. This is clearly visible from the code - there's no filtering being done:

statDatabaseQuery = `
SELECT
datid
,datname
,numbackends
,xact_commit
,xact_rollback
,blks_read
,blks_hit
,tup_returned
,tup_fetched
,tup_inserted
,tup_updated
,tup_deleted
,conflicts
,temp_files
,temp_bytes
,deadlocks
,blk_read_time
,blk_write_time
,active_time
,stats_reset
FROM pg_stat_database;
`

Environment

  • System information:

    N/A

  • postgres_exporter version:

    used via Grafana Agent, which seems to be v0.11.1

  • postgres_exporter flags:

    N/A

  • PostgreSQL version:

    15.5.0

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