diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9ddf6b2..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "cmake.ignoreCMakeListsMissing": true -} \ No newline at end of file diff --git a/backend/deployment b/backend/deployment index 4f0a028..904f16b 160000 --- a/backend/deployment +++ b/backend/deployment @@ -1 +1 @@ -Subproject commit 4f0a0289fcf8a7755d7dc1a76b443fe1233685ae +Subproject commit 904f16bfc0624b6ab8569e0a70050aaa3bd64b3f diff --git a/backend/src/constants.py b/backend/src/constants.py index 303e7ed..208bfa6 100644 --- a/backend/src/constants.py +++ b/backend/src/constants.py @@ -21,11 +21,19 @@ debug = os.getenv('DEBUG', "false") == "true" if os.getenv('KUBERNETES_SERVICE_HOST', None) is not None: # in that case we want to log to stdout and also to loki from loki_logger_handler.loki_logger_handler import LokiLoggerHandler + loki_url = os.getenv('LOKI_URL') + if loki_url is None: + raise ValueError("LOKI_URL environment variable is not set") + loki_handler = LokiLoggerHandler( - url=os.getenv('LOKI_URL', 'http://loki:3100'), - labels={'app': 'anyway', 'env': 'production' if debug else 'staging'} + url = loki_url, + labels = {'app': 'anyway', 'environment': 'production' if debug else 'staging'} ) + print(f"Logging to Loki at {loki_url} with {loki_handler.labels} and {debug=}") if debug: + # we need to silence the debug logs made by the loki handler + logging.getLogger('urllib3.connectionpool').setLevel(logging.INFO) + logging.basicConfig( level=logging.DEBUG, handlers=[loki_handler, logging.StreamHandler()]