Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
 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
Exemplo n.º 5
0
 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
Exemplo n.º 6
0
 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
Exemplo n.º 7
0
 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
Exemplo n.º 8
0
    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
Exemplo n.º 9
0
 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