Replace X-Request-Id with the trace ID and retire the guard suite
Step 6: downstream_client() no longer sends X-Request-Id, and request_id is gone from the internal request bodies, models, function signatures and log lines; correlation now travels as traceparent. The gateway's public request_id stays (the contract tests require it) but is now the trace ID, 32 hex digits and still a valid UUID, so the value the frontend shows can be pasted into Tempo. Step 7: delete tests/test_no_observability.py. It guarded the Phase 0 "no observability" state, which Phase 3 ends by design. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
1ab425dc44
commit
7ddb614ded
@@ -36,7 +36,6 @@ class CreateTransactionRequest(BaseModel):
|
||||
currency: str
|
||||
merchant_name: str
|
||||
category_id: int | None = None
|
||||
request_id: str = "unknown"
|
||||
|
||||
@field_validator("amount_minor")
|
||||
@classmethod
|
||||
@@ -49,7 +48,6 @@ class CreateTransactionRequest(BaseModel):
|
||||
|
||||
class SettleRequest(BaseModel):
|
||||
risk_score: float
|
||||
request_id: str = "unknown"
|
||||
|
||||
|
||||
@app.exception_handler(Exception)
|
||||
@@ -93,7 +91,7 @@ async def list_accounts():
|
||||
|
||||
@app.post("/internal/transactions")
|
||||
async def create_transaction(body: CreateTransactionRequest):
|
||||
logger.info(f"processing tx for account {body.account_id}, amount {body.amount_minor} request_id={body.request_id}")
|
||||
logger.info(f"processing tx for account {body.account_id}, amount {body.amount_minor}")
|
||||
|
||||
starved = await chaos.pool_starvation_enabled()
|
||||
poison_enabled = await chaos.poison_data_enabled()
|
||||
@@ -153,7 +151,7 @@ async def settle(tx_id: str, body: SettleRequest):
|
||||
use_lock = row_lock and bool(account.is_hot)
|
||||
balance = await repository.settle_transaction(session, tx=tx, risk_score=body.risk_score, use_row_lock=use_lock)
|
||||
|
||||
logger.info(f"settled transaction {tx_id} request_id={body.request_id}")
|
||||
logger.info(f"settled transaction {tx_id}")
|
||||
return {"status": "settled", "balance_minor": balance}
|
||||
|
||||
|
||||
@@ -167,5 +165,5 @@ async def reject(tx_id: str, body: SettleRequest):
|
||||
return JSONResponse(status_code=404, content={"error": "transaction not found"})
|
||||
balance = await repository.reject_transaction(session, tx=tx, risk_score=body.risk_score)
|
||||
|
||||
logger.info(f"rejected transaction {tx_id} request_id={body.request_id}")
|
||||
logger.info(f"rejected transaction {tx_id}")
|
||||
return {"status": "rejected", "balance_minor": balance}
|
||||
|
||||
Reference in New Issue
Block a user