Skip to content

feat(cost): add Postgres cost attribution - #616

Draft
sechmann wants to merge 4 commits into
mainfrom
postgres-cost
Draft

sechmann wants to merge 4 commits into
mainfrom
postgres-cost

Conversation

@sechmann

Copy link
Copy Markdown
Contributor

Summary

Add Postgres-specific billing cost storage, queries, and GraphQL access, keeping these costs distinct from same-named workloads. Preserve existing workload and team cost summaries.

Changes

  • Storage and import: Add Postgres identity to cost records, queries, and migration; validate imported Postgres rows and keep service dimensions.
  • GraphQL and cost client: Expose daily and monthly Postgres cost periods with service breakdowns.
  • Tests and docs: Add importer, query, and integration tests; document the API contract and rollout considerations.
  • Generated files: Update generated SQL, GraphQL, and mock code; remove obsolete go.sum entries.

Notes

Production attribution also requires compatible BigQuery tenant views and a reviewed replacement or reimport plan; this patch does not change BigQuery views. Upserting newly attributed rows alone can leave stale costs under their previous identity.

@sechmann
sechmann requested a review from a team as a code owner November 11, 2026 10:27
@sechmann
sechmann marked this pull request as draft November 11, 2026 10:28
Date civil.Date `bigquery:"date"`
Cost float32 `bigquery:"cost"`
ServiceName bigquery.NullString `bigquery:"service_name"`
PostgresName bigquery.NullString `bigquery:"postgres_name"`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ugly, but not sure how we can / should implement this otherwise.
New BigQuery view for postgreses?

type loaders struct {
client Client
internalQuerier *costsql.Queries
internalQuerier costsql.Querier

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

bad?

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.

1 participant