Skip to content

Commit 334a5da

Browse files
committed
add warning logs to base_api
1 parent 4c5ba76 commit 334a5da

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

superset/views/base_api.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,13 @@ def wraps(self: BaseSupersetApiMixin, *args: Any, **kwargs: Any) -> Response:
112112
try:
113113
duration, response = time_function(f, self, *args, **kwargs)
114114
except Exception as ex:
115-
self.incr_stats("error", func_name)
115+
if (
116+
hasattr(ex, "status")
117+
and ex.status < 500 # type: ignore # pylint: disable=no-member
118+
):
119+
self.incr_stats("warning", func_name)
120+
else:
121+
self.incr_stats("error", func_name)
116122
raise ex
117123

118124
self.send_stats_metrics(response, func_name, duration)

0 commit comments

Comments
 (0)