Commit 3394456
committed
[Operating] allow to identify DB connection "owner"
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;1 parent b3858fd commit 3394456
2 files changed
+30
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
76 | 101 | | |
77 | 102 | | |
78 | 103 | | |
| |||
84 | 109 | | |
85 | 110 | | |
86 | 111 | | |
87 | | - | |
| 112 | + | |
88 | 113 | | |
89 | 114 | | |
90 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
256 | 259 | | |
257 | 260 | | |
258 | 261 | | |
| |||
0 commit comments