pierrejeambrun commented on code in PR #64523:
URL: https://github.com/apache/airflow/pull/64523#discussion_r3092211774


##########
airflow-core/src/airflow/api_fastapi/common/http_access_log.py:
##########
@@ -95,6 +176,23 @@ async def capture_send(message: Message) -> None:
                     client = scope.get("client")
                     client_addr = f"{client[0]}:{client[1]}" if client else 
None
 
+                    # Observability failures must never affect serving the 
request.
+                    try:
+                        _emit_api_metrics(
+                            scope=scope,
+                            path=path,
+                            method=method,
+                            status_code=status,
+                            duration_us=duration_us,
+                        )
+                    except Exception:
+                        logger.exception(
+                            "failed to emit API metrics",
+                            method=method,
+                            path=path,
+                            status_code=status,
+                        )
+

Review Comment:
   Can we create it's own middleware for Instrumentation instead off adding 
this to the 'Log' middleware, which feels weird.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to