Skip to content

Commit 031c87e

Browse files
Lily Kuangjinghua-qa
Lily Kuang
authored andcommitted
chore: always get dashboard_id on dashboard API get endpoint (apache#20894)
* chore: always get dashboard_id on dashboard API get endpoint * lint * pylint * fix pylint * lint (cherry picked from commit c33af83)
1 parent aa3a02d commit 031c87e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

superset/dashboards/api.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,14 @@ def __repr__(self) -> str:
285285
@protect()
286286
@safe
287287
@statsd_metrics
288-
@event_logger.log_this_with_context(
289-
action=lambda self, *args, **kwargs: f"{self.__class__.__name__}.get",
290-
log_to_statsd=False,
291-
)
292288
@with_dashboard
293-
# pylint: disable=arguments-renamed, arguments-differ
294-
def get(self, dash: Dashboard) -> Response:
289+
@event_logger.log_this_with_extra_payload
290+
# pylint: disable=arguments-differ
291+
def get(
292+
self,
293+
dash: Dashboard,
294+
add_extra_log_payload: Callable[..., None] = lambda **kwargs: None,
295+
) -> Response:
295296
"""Gets a dashboard
296297
---
297298
get:
@@ -323,6 +324,9 @@ def get(self, dash: Dashboard) -> Response:
323324
$ref: '#/components/responses/404'
324325
"""
325326
result = self.dashboard_get_response_schema.dump(dash)
327+
add_extra_log_payload(
328+
dashboard_id=dash.id, action=f"{self.__class__.__name__}.get"
329+
)
326330
return self.response(200, result=result)
327331

328332
@etag_cache(

0 commit comments

Comments
 (0)