Skip to content

Tag connections with application_name#2958

Merged
howardchung merged 1 commit into
odota:masterfrom
ff137:feat/postgres-application-name
May 18, 2026
Merged

Tag connections with application_name#2958
howardchung merged 1 commit into
odota:masterfrom
ff137:feat/postgres-application-name

Conversation

@ff137
Copy link
Copy Markdown
Contributor

@ff137 ff137 commented May 17, 2026

Set application_name on every Postgres connection so each session is
identifiable in pg_stat_activity. No behaviour change.

Naming:

  • Shared Knex pool: odota-<APP_NAME>
  • runReliableQueue dedicated Client: odota-<APP_NAME>-queue
  • Explorer readonly Pool: odota-<APP_NAME>-explorer
  • archivePostgresStream Client: odota-<APP_NAME>-archive

APP_NAME is set per process by ecosystem.config.js (e.g. inserter,
scanner, web, parser); falls back to "unknown" when run outside PM2.

With ~30 backend roles plus a clustered web role, this makes it possible
to answer "which service is holding connections?" with a single query:

SELECT application_name, state, count(*)
FROM pg_stat_activity
GROUP BY 1, 2 ORDER BY 3 DESC;

Set application_name on every Postgres connection so each session is
identifiable in pg_stat_activity. No behaviour change.

Naming:
- Shared Knex pool: odota-<APP_NAME>
- runReliableQueue dedicated Client: odota-<APP_NAME>-queue
- Explorer readonly Pool: odota-<APP_NAME>-explorer
- archivePostgresStream Client: odota-<APP_NAME>-archive

APP_NAME is set per process by ecosystem.config.js (e.g. inserter,
scanner, web, parser); falls back to "unknown" when run outside PM2.

With ~30 backend roles plus a clustered web role, this makes it possible
to answer "which service is holding connections?" with a single query:

  SELECT application_name, state, count(*)
  FROM pg_stat_activity
  GROUP BY 1, 2 ORDER BY 3 DESC;

Co-authored-by: Cursor <cursoragent@cursor.com>
@howardchung howardchung merged commit 05d01e1 into odota:master May 18, 2026
1 check passed
@ff137 ff137 deleted the feat/postgres-application-name branch May 18, 2026 14:54
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