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

Add disk usage metrics #83

Merged
merged 3 commits into from
Apr 13, 2021
Merged

Conversation

isaacseymour
Copy link
Collaborator

No description provided.

@rnaveiras
Copy link
Owner

hey, @isaacseymour thank you so much for this!

I'm going to double-check it and get it to release today.

WHERE nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY pg_relation_size(C.oid) DESC /*postgres_exporter*/`

tableUsageQuery = `
Copy link
Owner

@rnaveiras rnaveiras Apr 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isaacseymour as we discuss this would rewrite this way:

SELECT schemaname
     , relname
     , pg_table_size(relid)::float
  FROM pg_stat_user_tables /*postgres_exporter*/`

This will give us only the table size, including the toast tables and other things, but without the indices size. To get the whole size we can do an aggregation on Prometheus via a recording rule

collector/disk_usage.go Outdated Show resolved Hide resolved
collector/disk_usage.go Outdated Show resolved Hide resolved
collector/disk_usage.go Outdated Show resolved Hide resolved
@rnaveiras rnaveiras merged commit b3ff8c2 into rnaveiras:master Apr 13, 2021
@isaacseymour isaacseymour deleted the add-disk-usage branch April 13, 2021 10:02
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

Successfully merging this pull request may close these issues.

2 participants