feat: add statsd metrics to FAB rest API post, put and delete (#11362)

This commit is contained in:
Daniel Vaz Gaspar
2020-10-22 08:56:26 +01:00
committed by GitHub
parent 85e28dd04c
commit b86f779dc1
4 changed files with 127 additions and 106 deletions

View File

@@ -319,6 +319,30 @@ class BaseSupersetModelRestApi(ModelRestApi):
self.send_stats_metrics(response, self.get_list.__name__, duration)
return response
def post_headless(self) -> Response:
"""
Add statsd metrics to builtin FAB POST endpoint
"""
duration, response = time_function(super().post_headless)
self.send_stats_metrics(response, self.post.__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 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
@expose("/related/<column_name>", methods=["GET"])
@protect()
@safe