Compare commits

...

1 Commits

Author SHA1 Message Date
33ce291b09 launch adjustments 2024-12-29 14:51:28 +01:00
2 changed files with 4 additions and 2 deletions

@ -16,4 +16,4 @@ ENV OSM_CACHE_DIR=/cache
ENV MEMCACHED_HOST_PATH=none
ENV LOKI_URL=none
CMD ["fastapi", "src/main.py", "--port", "8000", "--workers", "$NUM_WORKERS"]
CMD ["fastapi", "run", "src/main.py", "--port", "8000", "--workers", "$NUM_WORKERS"]

@ -15,7 +15,7 @@ def configure_logging():
is_kubernetes = os.getenv('KUBERNETES_SERVICE_HOST') is not None
if not is_kubernetes:
if is_kubernetes:
# 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')
@ -31,6 +31,8 @@ def configure_logging():
logger.info(f"Logging to Loki at {loki_url} with {loki_handler.labels} and {is_debug=}")
logging_handlers = [loki_handler, logging.StreamHandler()]
logging_level = logging.DEBUG if is_debug else logging.INFO
# silence the chatty logs loki generates itself
logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
# no need for time since it's added by loki or can be shown in kube logs
logging_format = '%(name)s - %(levelname)s - %(message)s'