Use carpool events for metrics
Some checks failed
Amarillo/amarillo-gitea/amarillo-core/pipeline/head There was a failure building this commit
Some checks failed
Amarillo/amarillo-gitea/amarillo-core/pipeline/head There was a failure building this commit
This commit is contained in:
parent
3e3766953b
commit
f6244c05f9
|
|
@ -116,12 +116,6 @@ async def _delete_carpool(agency_id: str, carpool_id: str):
|
|||
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:
|
||||
carpool_exists = os.path.exists(f"data/carpool/{carpool.agency}/{carpool.id}.json")
|
||||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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}")
|
||||
|
|
|
|||
Loading…
Reference in a new issue