From 87ab55643f586d0c1315360ab94f38c21d1c013f Mon Sep 17 00:00:00 2001 From: Abderrahim AZIME Date: Tue, 31 Jan 2023 21:45:31 +0100 Subject: [PATCH] application_name added in connect_args --- source/jormungandr/jormungandr/default_settings.py | 4 +++- source/tyr/tyr/default_settings.py | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/source/jormungandr/jormungandr/default_settings.py b/source/jormungandr/jormungandr/default_settings.py index cb8e20fa89..7f26109090 100644 --- a/source/jormungandr/jormungandr/default_settings.py +++ b/source/jormungandr/jormungandr/default_settings.py @@ -6,7 +6,9 @@ from flask_restful.inputs import boolean # sql queries will return an exception if the query did not succeed before `statement_timeout` -DEFAULT_SQLALCHEMY_ENGINE_OPTIONS = {"connect_args": {"options": "-c statement_timeout=1000"}} # 1000ms +DEFAULT_SQLALCHEMY_ENGINE_OPTIONS = { + "connect_args": {"options": "-c statement_timeout=1000", "application_name": "Jormungandr"} +} # 1000ms # path of the configuration file for each instances INSTANCES_DIR = os.getenv('JORMUNGANDR_INSTANCES_DIR', '/etc/jormungandr.d') diff --git a/source/tyr/tyr/default_settings.py b/source/tyr/tyr/default_settings.py index d83068460c..ee1628ddf7 100644 --- a/source/tyr/tyr/default_settings.py +++ b/source/tyr/tyr/default_settings.py @@ -2,6 +2,7 @@ from datetime import timedelta from celery import schedules import os +import json from flask_restful.inputs import boolean # URL for the brokker, by default it's the local rabbitmq @@ -19,6 +20,11 @@ 'TYR_SQLALCHEMY_DATABASE_URI', 'postgresql://navitia:navitia@localhost/jormungandr' ) +DEFAULT_SQLALCHEMY_ENGINE_OPTIONS = {"connect_args": {"application_name": "Tyr"}} + +SQLALCHEMY_ENGINE_OPTIONS = ( + json.loads(os.getenv('TYR_SQLALCHEMY_ENGINE_OPTIONS', '{}')) or DEFAULT_SQLALCHEMY_ENGINE_OPTIONS +) # URI for cities database # postgresql://:@:/