You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by li...@apache.org on 2022/08/04 00:20:28 UTC

[superset] branch master updated: chore: always get dashboard_id on dashboard API get endpoint (#20894)

This is an automated email from the ASF dual-hosted git repository.

lilykuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new c33af83823 chore: always get dashboard_id on dashboard API get endpoint (#20894)
c33af83823 is described below

commit c33af83823f3af2e98b3144b583687d6abf063a9
Author: Lily Kuang <li...@preset.io>
AuthorDate: Wed Aug 3 17:20:20 2022 -0700

    chore: always get dashboard_id on dashboard API get endpoint (#20894)
    
    * chore: always get dashboard_id on dashboard API get endpoint
    
    * lint
    
    * pylint
    
    * fix pylint
    
    * lint
---
 superset/dashboards/api.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/superset/dashboards/api.py b/superset/dashboards/api.py
index 460cfcb0ea..be523446a1 100644
--- a/superset/dashboards/api.py
+++ b/superset/dashboards/api.py
@@ -285,13 +285,14 @@ class DashboardRestApi(BaseSupersetModelRestApi):
     @protect()
     @safe
     @statsd_metrics
-    @event_logger.log_this_with_context(
-        action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.get",
-        log_to_statsd=False,
-    )
     @with_dashboard
-    # pylint: disable=arguments-renamed, arguments-differ
-    def get(self, dash: Dashboard) -> Response:
+    @event_logger.log_this_with_extra_payload
+    # pylint: disable=arguments-differ
+    def get(
+        self,
+        dash: Dashboard,
+        add_extra_log_payload: Callable[..., None] = lambda **kwargs: None,
+    ) -> Response:
         """Gets a dashboard
         ---
         get:
@@ -323,6 +324,9 @@ class DashboardRestApi(BaseSupersetModelRestApi):
               $ref: '#/components/responses/404'
         """
         result = self.dashboard_get_response_schema.dump(dash)
+        add_extra_log_payload(
+            dashboard_id=dash.id, action=f"{self.__class__.__name__}.get"
+        )
         return self.response(200, result=result)
 
     @etag_cache(