feat: Implemented observability layer and benchmarking

This commit is contained in:
2026-07-03 11:20:23 +05:30
parent 9713a12591
commit c9ec297a5f
7 changed files with 202 additions and 101 deletions

View File

@@ -6,10 +6,14 @@ from app.utils.csv_parser import parse_and_validate_csv
from app.worker import process_transaction_job
from app.core.observability import time_it
class JobService:
def __init__(self, repo: JobRepository):
self.repo = repo
@time_it("Upload CSV Service")
async def upload_csv(self, filename: str, content: bytes) -> Job:
parsed_transactions = parse_and_validate_csv(content)
@@ -19,17 +23,20 @@ class JobService:
return job
@time_it("Get Job Status Service")
async def get_job_status(self, job_id: str) -> Job:
job = await self.repo.get_by_id(job_id)
if not job:
raise JobNotFoundException(job_id)
return job
@time_it("Get Job Results Service")
async def get_job_results(self, job_id: str) -> Job:
job = await self.repo.get_by_id(job_id)
if not job:
raise JobNotFoundException(job_id)
return job
@time_it("List Jobs Service")
async def list_jobs(self, status: Optional[str] = None) -> List[Job]:
return await self.repo.list_all(status=status)