[Operating] allow to identify DB connection "owner"#1261
Merged
Conversation
When having several different services running as part of a CRCon setup, and trying to identify what component/service is using a particular amount/number of DB connections is hard, apart from telling the total number of open connections. This commit aims to solve this issue by providing a proper identification for a DB connection. It is composed out of the name of the component that initiated the connection (e.g. gunicorn for the API backend, auto_settings for the autosettings component, etc) together with the server number. The name is inferred from the application start commands to keep the API for using the DB layer in the CRCon stable and to not bother callers to provide any identification. If a component name cannot be inferred, a generic "CRCon Generic" name is used. The connection name will show up as the "application_name" in the pg_stat_activity table of postgres, which can be quried with: select * from pg_stat_activity;
Collaborator
Author
This was referenced Apr 6, 2026
Fragger
approved these changes
Apr 7, 2026
Collaborator
Fragger
left a comment
There was a problem hiding this comment.
Ran this and it all seems to work, will be good info have.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

When having several different services running as part of a CRCon setup, and trying to identify what component/service is using a particular amount/number of DB connections is hard, apart from telling the total number of open connections.
This commit aims to solve this issue by providing a proper identification for a DB connection. It is composed out of the name of the component that initiated the connection (e.g. gunicorn for the API backend, auto_settings for the autosettings component, etc) together with the server number.
The name is inferred from the application start commands to keep the API for using the DB layer in the CRCon stable and to not bother callers to provide any identification. If a component name cannot be inferred, a generic "CRCon Generic" name is used.
The connection name will show up as the "application_name" in the pg_stat_activity table of postgres, which can be quried with: select * from pg_stat_activity;