feat(api): label Postgres connections with application_name per component and alias (#11494)

This commit is contained in:
César Arroba
2026-06-08 13:45:06 +02:00
committed by GitHub
parent 28b045302f
commit 061fbaa7bb
6 changed files with 86 additions and 0 deletions
+9
View File
@@ -68,6 +68,15 @@ manage_db_partitions() {
fi
}
# Identify this process to Postgres (application_name=<component>:<alias>) so
# connections are attributable by component in pg_stat_activity. Web tiers
# report "api"; everything else uses the launch subcommand.
case "$1" in
prod|dev) DJANGO_APP_COMPONENT="api" ;;
*) DJANGO_APP_COMPONENT="$1" ;;
esac
export DJANGO_APP_COMPONENT
case "$1" in
dev)
apply_migrations