Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

application_name added in connect_args #3927

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion source/jormungandr/jormungandr/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 6 additions & 0 deletions source/tyr/tyr/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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://<user>:<password>@<host>:<port>/<dbname>
Expand Down