Set postgres application_name when connecting #3

Open
opened 2026-04-15 22:22:50 +00:00 by sgcommand · 1 comment
Member

Set the PostgreSQL application_name when opening database connections so sessions are identifiable in pg_stat_activity and monitoring.

Why:

  • easier to trace which service opened a connection
  • better observability during debugging and performance analysis
  • clearer separation of relspecgo traffic from other clients

Suggested implementation:

  • set application_name explicitly in the PostgreSQL DSN or client config
  • use a stable value like relspecgo, or a more specific component name if needed

Acceptance criteria:

  • new PostgreSQL connections from relspecgo include application_name
  • the value is visible in pg_stat_activity
  • documentation and/or tests updated where practical
Set the PostgreSQL application_name when opening database connections so sessions are identifiable in pg_stat_activity and monitoring. Why: - easier to trace which service opened a connection - better observability during debugging and performance analysis - clearer separation of relspecgo traffic from other clients Suggested implementation: - set application_name explicitly in the PostgreSQL DSN or client config - use a stable value like relspecgo, or a more specific component name if needed Acceptance criteria: - new PostgreSQL connections from relspecgo include application_name - the value is visible in pg_stat_activity - documentation and/or tests updated where practical
Author
Member

Also include the application version in the PostgreSQL application_name value if practical, so connections are attributable to both the service and the running build version. For example: relspecgo/1.2.3 or similar. This would make it easier to correlate behavior with deployments and identify which version opened a given session in pg_stat_activity.

Also include the application version in the PostgreSQL application_name value if practical, so connections are attributable to both the service and the running build version. For example: relspecgo/1.2.3 or similar. This would make it easier to correlate behavior with deployments and identify which version opened a given session in pg_stat_activity.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wdevs/relspecgo#3