Customize application_name for different connections in dispatcher service (#13074)

* Introduce new method in settings, import in-line w NOQA mark

* Further refine the app_name to use shorter service names like dispatcher

* Clean up listener logic, change some names
This commit is contained in:
Alan Rominger
2023-04-13 22:36:36 -04:00
committed by GitHub
parent 2205664fb4
commit 342e9197b8
7 changed files with 61 additions and 9 deletions

View File

@@ -100,6 +100,8 @@ except IOError:
# The below runs AFTER all of the custom settings are imported.
DATABASES.setdefault('default', dict()).setdefault('OPTIONS', dict()).setdefault(
'application_name', f'{CLUSTER_HOST_ID}-{os.getpid()}-{" ".join(sys.argv)}'[:63] # NOQA
) # noqa
from .application_name import set_application_name
set_application_name(DATABASES, CLUSTER_HOST_ID) # NOQA
del set_application_name