use additional loki logger
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				Run linting on the backend code / Build (pull_request) Successful in 28s
				
			
		
			
				
	
				Run testing on the backend code / Build (pull_request) Failing after 1m27s
				
			
		
			
				
	
				Build and deploy the backend to staging / Build and push image (pull_request) Failing after 20s
				
			
		
			
				
	
				Build and deploy the backend to staging / Deploy to staging (pull_request) Has been skipped
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	Run linting on the backend code / Build (pull_request) Successful in 28s
				
			Run testing on the backend code / Build (pull_request) Failing after 1m27s
				
			Build and deploy the backend to staging / Build and push image (pull_request) Failing after 20s
				
			Build and deploy the backend to staging / Deploy to staging (pull_request) Has been skipped
				
			This commit is contained in:
		@@ -25,3 +25,4 @@ pymemcache = "*"
 | 
			
		||||
fastapi-cli = "*"
 | 
			
		||||
scikit-learn = "*"
 | 
			
		||||
pyqt6 = "*"
 | 
			
		||||
loki-logger-handler = "*"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								backend/Pipfile.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										11
									
								
								backend/Pipfile.lock
									
									
									
										generated
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
    "_meta": {
 | 
			
		||||
        "hash": {
 | 
			
		||||
            "sha256": "bb22b4e28c7aa199c94b688ad93d3ab0ccf1089a172131f4aec03b78e7bd7f1c"
 | 
			
		||||
            "sha256": "6edd6644586e8814a0b4526adb3352dfc17828ca129de7a68c1d5929efe94daa"
 | 
			
		||||
        },
 | 
			
		||||
        "pipfile-spec": 6,
 | 
			
		||||
        "requires": {},
 | 
			
		||||
@@ -507,6 +507,15 @@
 | 
			
		||||
            "markers": "python_version >= '3.8'",
 | 
			
		||||
            "version": "==1.4.7"
 | 
			
		||||
        },
 | 
			
		||||
        "loki-logger-handler": {
 | 
			
		||||
            "hashes": [
 | 
			
		||||
                "sha256:aa1a9c933282c134a1e4271aba3cbaa2a3660eab6ea415bad7a072444ab98aa8",
 | 
			
		||||
                "sha256:f6114727a9e5e6f3f2058b9b5324d1cab6d1a04e802079f7b57a8aeb7bd0a112"
 | 
			
		||||
            ],
 | 
			
		||||
            "index": "pypi",
 | 
			
		||||
            "markers": "python_version >= '2.7'",
 | 
			
		||||
            "version": "==1.0.2"
 | 
			
		||||
        },
 | 
			
		||||
        "lxml": {
 | 
			
		||||
            "hashes": [
 | 
			
		||||
                "sha256:01220dca0d066d1349bd6a1726856a78f7929f3878f7e2ee83c296c69495309e",
 | 
			
		||||
 
 | 
			
		||||
 Submodule backend/deployment updated: 718df09e88...4f0a0289fc
									
								
							
							
								
								
									
										1094
									
								
								backend/report.html
									
									
									
									
									
								
							
							
						
						
									
										1094
									
								
								backend/report.html
									
									
									
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
"""Module allowing to access the parameters of route generation"""
 | 
			
		||||
"""Module setting global parameters for the application, such as logging, cache, route generation, etc."""
 | 
			
		||||
 | 
			
		||||
import logging
 | 
			
		||||
import os
 | 
			
		||||
@@ -16,19 +16,33 @@ cache_dir_string = os.getenv('OSM_CACHE_DIR', './cache')
 | 
			
		||||
OSM_CACHE_DIR = Path(cache_dir_string)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# if we are in a debug session, set verbose and rich logging
 | 
			
		||||
if os.getenv('DEBUG', "false") == "true":
 | 
			
		||||
# if we are in a debug (local) session, set verbose and rich logging
 | 
			
		||||
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_handler = LokiLoggerHandler(
 | 
			
		||||
        url=os.getenv('LOKI_URL', 'http://loki:3100'),
 | 
			
		||||
        labels={'app': 'anyway', 'env': 'production' if debug else 'staging'}
 | 
			
		||||
    )
 | 
			
		||||
    if debug:
 | 
			
		||||
        logging.basicConfig(
 | 
			
		||||
            level=logging.DEBUG,
 | 
			
		||||
            handlers=[loki_handler, logging.StreamHandler()]
 | 
			
		||||
        )
 | 
			
		||||
    else:
 | 
			
		||||
        logging.basicConfig(
 | 
			
		||||
            level=logging.INFO,
 | 
			
		||||
            handlers=[loki_handler, logging.StreamHandler()]
 | 
			
		||||
        )
 | 
			
		||||
else:
 | 
			
		||||
    # in that case we are local and we want to log to stdout only, but make it pretty
 | 
			
		||||
    from rich.logging import RichHandler
 | 
			
		||||
    logging.basicConfig(
 | 
			
		||||
        level=logging.DEBUG,
 | 
			
		||||
        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
 | 
			
		||||
        handlers=[RichHandler()]
 | 
			
		||||
    )
 | 
			
		||||
else:
 | 
			
		||||
    logging.basicConfig(
 | 
			
		||||
        level=logging.INFO,
 | 
			
		||||
        format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
MEMCACHED_HOST_PATH = os.getenv('MEMCACHED_HOST_PATH', None)
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ from .utils.landmarks_manager import LandmarkManager
 | 
			
		||||
from .utils.toilets_manager import ToiletsManager
 | 
			
		||||
from .utils.optimizer import Optimizer
 | 
			
		||||
from .utils.refiner import Refiner
 | 
			
		||||
from .persistence import client as cache_client
 | 
			
		||||
from .cache import client as cache_client
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
logger = logging.getLogger(__name__)
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ from fastapi import HTTPException
 | 
			
		||||
from pydantic import ValidationError
 | 
			
		||||
 | 
			
		||||
from ..structs.landmark import Landmark
 | 
			
		||||
from ..persistence import client as cache_client
 | 
			
		||||
from ..cache import client as cache_client
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def landmarks_to_osmid(landmarks: list[Landmark]) -> list[int] :
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user