From 19eb0ff6cd322c1acce9bd78b1492d1439dd5d92 Mon Sep 17 00:00:00 2001 From: Teboho Mokoni 222362154 <128044184+Teboho66@users.noreply.github.com> Date: Mon, 8 Jun 2026 16:37:45 +0000 Subject: [PATCH 1/2] Fix structured logging lint issues --- Assignment 12/api/logging_config.py | 3 +-- Assignment 12/handlers/routes/transactions.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Assignment 12/api/logging_config.py b/Assignment 12/api/logging_config.py index ff0fb73..79fc351 100644 --- a/Assignment 12/api/logging_config.py +++ b/Assignment 12/api/logging_config.py @@ -1,5 +1,4 @@ import structlog -import logging import sys def configure_logging(): @@ -20,4 +19,4 @@ def configure_logging(): ) def get_logger(name: str = __name__): - return structlog.get_logger(name) \ No newline at end of file + return structlog.get_logger(name) diff --git a/Assignment 12/handlers/routes/transactions.py b/Assignment 12/handlers/routes/transactions.py index d5bc560..11debe3 100644 --- a/Assignment 12/handlers/routes/transactions.py +++ b/Assignment 12/handlers/routes/transactions.py @@ -103,7 +103,7 @@ def submit_transaction( ) # ── Increment metrics ── transactions_total.labels(channel=body.channel).inc() - + return TransactionResponse.from_domain(txn) except Exception as e: raise _handle_service_errors(e) From 4419855394373f84e50b717b643c957848976ab1 Mon Sep 17 00:00:00 2001 From: Teboho Mokoni 222362154 <128044184+Teboho66@users.noreply.github.com> Date: Mon, 8 Jun 2026 16:42:18 +0000 Subject: [PATCH 2/2] Add structlog dependency to CI --- .github/workflows/ci.yml | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54abb68..512f1ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -226,7 +226,7 @@ jobs: cache: pip - name: Install dependencies - run: pip install fastapi uvicorn httpx pytest pytest-cov pydantic prometheus-fastapi-instrumentator + run: pip install fastapi uvicorn httpx pytest pytest-cov pydantic prometheus-fastapi-instrumentator structlog prometheus-fastapi-instrumentator structlog - name: Run Assignment 12 tests working-directory: "Assignment 12" diff --git a/requirements.txt b/requirements.txt index abc82cc..d5ab514 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,4 +16,4 @@ pydantic==2.10.3 # Build / packaging (CD pipeline) build==1.2.2 -wheel==0.45.1 \ No newline at end of file +wheel==0.45.1structlog