sadpandajoe commented on code in PR #42089:
URL: https://github.com/apache/superset/pull/42089#discussion_r3694429359


##########
superset/utils/decorators.py:
##########
@@ -36,7 +36,21 @@
     from superset.stats_logger import BaseStatsLogger
 
 
-def statsd_gauge(metric_prefix: str | None = None) -> Callable[..., Any]:
+def record_statsd_gauge_failure(metric_prefix: str, ex: Exception) -> None:
+    """Record a warning or error gauge using the shared exception contract."""
+    suffix = (
+        "warning"
+        if hasattr(ex, "status") and ex.status < 500  # pylint: 
disable=no-member
+        else "error"
+    )
+    app.config["STATS_LOGGER"].gauge(f"{metric_prefix}.{suffix}", 1)

Review Comment:
   Fixed in `fd94e504f8`. The helper now reads the optional status once behind 
a defensive fallback, treats only integer values below 500 as warnings, and 
classifies absent, invalid, or unreadable values as errors without replacing 
the original exception. Added regression cases for both a string status and a 
status property that raises.



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