From f6244c05f9b98eb6455ed736240279d29a2b4051 Mon Sep 17 00:00:00 2001 From: Francia Csaba Date: Thu, 18 Apr 2024 15:16:10 +0200 Subject: [PATCH] Use carpool events for metrics --- amarillo/routers/carpool.py | 17 ----------------- amarillo/services/carpools.py | 5 ----- 2 files changed, 22 deletions(-) diff --git a/amarillo/routers/carpool.py b/amarillo/routers/carpool.py index 6aa4135..219d0b3 100644 --- a/amarillo/routers/carpool.py +++ b/amarillo/routers/carpool.py @@ -115,12 +115,6 @@ async def _delete_carpool(agency_id: str, carpool_id: str): os.remove(f"data/enhanced/{agency_id}/{carpool_id}.json", ) except FileNotFoundError: pass - - try: - from amarillo.plugins.metrics import trips_deleted_counter - trips_deleted_counter.inc() - except ImportError: - pass async def store_carpool(carpool: Carpool) -> Carpool: @@ -129,17 +123,6 @@ async def store_carpool(carpool: Carpool) -> Carpool: await set_lastUpdated_if_unset(carpool) await save_carpool(carpool) - try: - from amarillo.plugins.metrics import trips_created_counter, trips_updated_counter - if(carpool_exists): - # logger.info("Incrementing trips updated") - trips_updated_counter.inc() - else: - # logger.info("Incrementing trips created") - trips_created_counter.inc() - except ImportError: - pass - return carpool async def set_lastUpdated_if_unset(carpool): diff --git a/amarillo/services/carpools.py b/amarillo/services/carpools.py index 7b6fd39..7790cbc 100644 --- a/amarillo/services/carpools.py +++ b/amarillo/services/carpools.py @@ -37,11 +37,6 @@ class CarpoolService(): if cp and self.is_outdated(cp): logger.info("Purge outdated offer %s", key) self.delete(cp.agency, cp.id) - try: - from amarillo.plugins.metrics import trips_deleted_counter - trips_deleted_counter.inc() - except ImportError: - pass def get(self, agency_id: str, carpool_id: str): return self.carpools.get(f"{agency_id}:{carpool_id}")