Skip to content

[receiver/postgresqlreceiver] fix postgresql.table.size to include indexes and TOAST data - #50918

Open
spathlavath wants to merge 2 commits into
open-telemetry:mainfrom
newrelic-forks:fix/postgresql-table-size-total
Open

[receiver/postgresqlreceiver] fix postgresql.table.size to include indexes and TOAST data#50918
spathlavath wants to merge 2 commits into
open-telemetry:mainfrom
newrelic-forks:fix/postgresql-table-size-total

Conversation

@spathlavath

Copy link
Copy Markdown
Contributor

Description

  • postgresql.table.size was computed using pg_relation_size(), which only measures a table's main data heap
  • It silently excludes the table's indexes and TOAST storage (used for large column values)
  • Metric is documented as "Disk space used by a table" — the old query didn't match that description
  • Fixed by switching the query to pg_total_relation_size() (data + indexes + TOAST)
  • Added a regression test since the existing shared integration fixture explicitly excludes this metric from value comparison (IgnoreMetricValues), so nothing previously caught this

Link to tracking issue

Fixes #50914

Testing

  • make fmt - clean
  • make lint - clean
  • make generate - clean, no unexpected diffs
  • Full unit test suite - passing
  • Full integration test suite - passing, including new test on both postgres:13.18 and postgres:17.2

Documentation

  • metadata.yaml description updated to reflect the corrected behavior
  • documentation.md regenerated via make generate to match

Authorship

  • I, a human, wrote this pull request description myself.

@sv-splunk sv-splunk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[receiver/postgresql] postgresql.table.size only reports data heap size, excludes indexes and TOAST

2 participants