Skip to content

PG-1459 Keep username and datname fields empty if we cannont get real values#636

Merged
artemgavrilov merged 1 commit intomainfrom
PG-1459-username-and-datname
Apr 2, 2026
Merged

PG-1459 Keep username and datname fields empty if we cannont get real values#636
artemgavrilov merged 1 commit intomainfrom
PG-1459-username-and-datname

Conversation

@artemgavrilov
Copy link
Copy Markdown
Contributor

@artemgavrilov artemgavrilov commented Mar 25, 2026

PG-1459

Description

Keep username and datname fields empty if we cannont get real values

Links

@artemgavrilov artemgavrilov force-pushed the PG-1459-username-and-datname branch from 4b085be to 0b493f8 Compare March 27, 2026 16:02
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.34%. Comparing base (b6ffd37) to head (046589e).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
pg_stat_monitor.c 66.66% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #636      +/-   ##
==========================================
+ Coverage   85.89%   86.34%   +0.44%     
==========================================
  Files           3        3              
  Lines        1354     1347       -7     
  Branches      218      217       -1     
==========================================
  Hits         1163     1163              
+ Misses         91       87       -4     
+ Partials      100       97       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread regression/expected/application_name_unique.out Outdated
Comment thread pg_stat_monitor.c Outdated
Comment thread regression/expected/user.out Outdated
@artemgavrilov artemgavrilov marked this pull request as ready for review March 27, 2026 16:18
Comment thread pg_stat_monitor.c Outdated
Copy link
Copy Markdown
Contributor

@jeltz jeltz left a comment

Choose a reason for hiding this comment

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

I feel the title of the PR and the commit are misleading. To me the biggest change seems to be that we collect the information earlier.

@jeltz
Copy link
Copy Markdown
Contributor

jeltz commented Mar 31, 2026

There isnät even a test for the new empty behvior.

@artemgavrilov artemgavrilov force-pushed the PG-1459-username-and-datname branch 2 times, most recently from 2b1c060 to 5291ca9 Compare March 31, 2026 14:15
@artemgavrilov artemgavrilov changed the title PG-1459 Keep username and datname empty if we cannot get real values PG-1459 Improve how we collect username and datname Mar 31, 2026
@artemgavrilov artemgavrilov force-pushed the PG-1459-username-and-datname branch from 5291ca9 to dbf1edc Compare March 31, 2026 14:37
@artemgavrilov artemgavrilov changed the title PG-1459 Improve how we collect username and datname PG-1459 Improve username and datname collecting Mar 31, 2026
@artemgavrilov
Copy link
Copy Markdown
Contributor Author

@jeltz I added test and changed commit/PR message

@artemgavrilov artemgavrilov requested a review from jeltz March 31, 2026 15:09
Copy link
Copy Markdown
Contributor

@jeltz jeltz left a comment

Choose a reason for hiding this comment

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

The code looks good, but I think it would be nicer as two commits:

  1. Which fixes the bug and adds a test case
  2. Which changes the message for when we cannot get the user from the previous message to the empty string

This means we can trivially revert 2 if people change their minds.

I also think "collecting" likely should be "collection" but I am not a native speaker either.

If we cannot get username and datname real values just keep these fields
empty.
@artemgavrilov artemgavrilov force-pushed the PG-1459-username-and-datname branch from dbf1edc to 046589e Compare April 1, 2026 17:44
@artemgavrilov artemgavrilov changed the title PG-1459 Improve username and datname collecting PG-1459 Keep username and datname fields empty if we cannont get real values Apr 1, 2026
@artemgavrilov
Copy link
Copy Markdown
Contributor Author

The code looks good, but I think it would be nicer as two commits:

1. Which fixes the bug and adds a test case

2. Which changes the message for when we cannot get the user from the previous message to the empty string

This means we can trivially revert 2 if people change their minds.

I also think "collecting" likely should be "collection" but I am not a native speaker either.

Damn, I was wrong about transactions. It tuned out that subtransaction state changed (internal structure), not real transaction. So we still can get username and datname if user made rollback manually. However getting this fields earlier solves another problem, I'll address them in another PR.

This PR now covers only actual bug report.

@artemgavrilov artemgavrilov merged commit ab68d1d into main Apr 2, 2026
47 of 51 checks passed
@artemgavrilov artemgavrilov deleted the PG-1459-username-and-datname branch April 2, 2026 12:45
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