Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions a2a/weather_service/src/weather_service/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,16 @@ def run():
# Add tracing middleware - creates root span with MLflow/GenAI attributes
app.add_middleware(BaseHTTPMiddleware, dispatch=create_tracing_middleware())

class LogAuthorizationMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request, call_next):
auth_header = request.headers.get("authorization", "No Authorization header")
logger.info(
f"🔐 Incoming request to {request.url.path} with Authorization: {auth_header[:80] + '...' if len(auth_header) > 80 else auth_header}"
)
response = await call_next(request)
return response

# Add logging middleware
@app.middleware("http")
async def log_authorization_header(request, call_next):
auth_header = request.headers.get("authorization", "No Authorization header")
logger.info(
f"🔐 Incoming request to {request.url.path} with Authorization: {auth_header[:80] + '...' if len(auth_header) > 80 else auth_header}"
)
response = await call_next(request)
return response
app.add_middleware(LogAuthorizationMiddleware)

uvicorn.run(app, host="0.0.0.0", port=8000)
Loading