aminghadersohi commented on code in PR #41921:
URL: https://github.com/apache/superset/pull/41921#discussion_r3632216036


##########
superset/mcp_service/middleware.py:
##########
@@ -363,6 +506,14 @@ async def on_call_tool(
                 mcp_call_id,
                 extra,
             )
+            await self._emit_call_metrics(
+                context,
+                tool_name,
+                mcp_tool,
+                success=success,
+                raised_is_user_error=raised_is_user_error,
+                duration_ms=duration_ms,
+            )

Review Comment:
   Valid catch — fixed in 664b5c7d8b573f7dc6a456123771c03deab0304d. The `await 
self._emit_call_metrics(...)` in the `finally` is now wrapped in its own 
try/except that logs a warning and swallows the failure, matching the guard 
already applied to the `event_logger.log` call above it. Added two regression 
tests: a stats client raising `RuntimeError` neither turns a successful call 
into an error (result still returned) nor replaces the tool's original 
exception (the original `ValueError` still propagates, not the metrics 
`RuntimeError`).



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to