def delete_headless(self, pk: int) -> Response: """ Add statsd metrics to builtin FAB DELETE endpoint """ duration, response = time_function(super().delete_headless, pk) self.send_stats_metrics(response, self.delete.__name__, duration) return response
def get_list_headless(self, **kwargs: Any) -> Response: """ Add statsd metrics to builtin FAB GET list endpoint """ duration, response = time_function(super().get_list_headless, **kwargs) self.send_stats_metrics(response, self.get_list.__name__, duration) return response
def put_headless(self, pk: int) -> Response: """ Add statsd metrics to builtin FAB PUT endpoint """ duration, response = time_function(super().put_headless, pk) self.send_stats_metrics(response, self.put.__name__, duration) return response
def info_headless(self, **kwargs: Any) -> Response: """ Add statsd metrics to builtin FAB _info endpoint """ duration, response = time_function(super().info_headless, **kwargs) self.send_stats_metrics(response, self.info.__name__, duration) return response
def delete_headless(self, pk: int) -> Response: """ Add statsd metrics to builtin FAB DELETE endpoint """ ref = f"{self.__class__.__name__}.delete" with log_context(ref, ref, log_to_statsd=False): duration, response = time_function(super().delete_headless, pk) self.send_stats_metrics(response, self.delete.__name__, duration) return response
def post_headless(self) -> Response: """ Add statsd metrics to builtin FAB POST endpoint """ ref = f"{self.__class__.__name__}.post" with log_context(ref, ref, log_to_statsd=False): duration, response = time_function(super().post_headless) self.send_stats_metrics(response, self.post.__name__, duration) return response
def get_list_headless(self, **kwargs: Any) -> Response: """ Add statsd metrics to builtin FAB GET list endpoint """ ref = f"{self.__class__.__name__}.get_list" with log_context(ref, ref, log_to_statsd=False): duration, response = time_function(super().get_list_headless, **kwargs) self.send_stats_metrics(response, self.get_list.__name__, duration) return response
def wraps(self: "BaseSupersetModelRestApi", *args: Any, **kwargs: Any) -> Response: try: duration, response = time_function(f, self, *args, **kwargs) except Exception as ex: self.incr_stats("error", f.__name__) raise ex self.send_stats_metrics(response, f.__name__, duration) return response
def wraps(self: "BaseSupersetModelRestApi", *args: Any, **kwargs: Any) -> Response: duration, response = time_function(f, self, *args, **kwargs) self.send_stats_metrics(response, f.__name__, duration) return response