Skip to content

Conversation

@gaantunes
Copy link
Contributor

@gaantunes gaantunes commented Oct 10, 2025

PR Description

In Postgres, the xid is lazily assigned, so while a query may show up in pg_stat_activity, it will only be assigned a xid when it affectively touches or locks data. Plus, not all queries are transactions.

This is migrating to use query_start instead of xid as the sample event keys.

Also remove idle state events altogether, since we need to track specifically idle in transaction and idle in transaction (aborted), which is covered.

Which issue(s) this PR fixes

Notes to the Reviewer

PR Checklist

  • CHANGELOG.md updated
  • Documentation added
  • Tests updated
  • Config converters updated

@gaantunes gaantunes changed the title database_observability: fix postgres xid post assigments after transaction starts database_observability: fix postgres xid post assigments after query starts Oct 10, 2025
@gaantunes gaantunes changed the title database_observability: fix postgres xid post assigments after query starts database_observability: fix postgres samples to account for xid lazy assigments after query starts Oct 10, 2025
@gaantunes gaantunes changed the title database_observability: fix postgres samples to account for xid lazy assigments after query starts database_observability: use query_start as a key instead of xid for query samples Oct 10, 2025
@gaantunes gaantunes changed the title database_observability: use query_start as a key instead of xid for query samples database_observability: use query_start as a key instead of xid for query samples, removing idle state entries Oct 10, 2025
Copy link
Contributor

@rgeyer rgeyer left a comment

Choose a reason for hiding this comment

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

LGTM. Tho I'm sure Matt and Cristian have more context.

@gaantunes gaantunes merged commit 70783ef into main Oct 21, 2025
41 of 42 checks passed
@gaantunes gaantunes deleted the gaantunes/pg-samples-add-fix branch October 21, 2025 21:30
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.

4 participants