Vitor-Avila commented on code in PR #36001:
URL: https://github.com/apache/superset/pull/36001#discussion_r2494522301


##########
superset/charts/data/api.py:
##########
@@ -173,18 +178,31 @@ def get_data(self, pk: int) -> Response:
         except (TypeError, json.JSONDecodeError):
             form_data = {}
 
-        return self._get_data_response(
+        result, response = self._get_data_response(
             command=command, form_data=form_data, 
datasource=query_context.datasource
         )
 
+        # Add is_cached to event logs
+        if result and "queries" in result:
+            is_cached_values = [query.get("is_cached") for query in 
result["queries"]]
+            if len(is_cached_values) == 1:
+                add_extra_log_payload(is_cached=is_cached_values[0])
+            elif is_cached_values:
+                add_extra_log_payload(is_cached=is_cached_values)

Review Comment:
   Any chance we could centralize this in a helper (or handle this as part of 
`_get_data_response` or `_send_chart_response` just to keep it DRYer?



##########
superset/charts/data/api.py:
##########
@@ -173,18 +178,31 @@ def get_data(self, pk: int) -> Response:
         except (TypeError, json.JSONDecodeError):
             form_data = {}
 
-        return self._get_data_response(
+        result, response = self._get_data_response(
             command=command, form_data=form_data, 
datasource=query_context.datasource
         )
 
+        # Add is_cached to event logs
+        if result and "queries" in result:
+            is_cached_values = [query.get("is_cached") for query in 
result["queries"]]
+            if len(is_cached_values) == 1:
+                add_extra_log_payload(is_cached=is_cached_values[0])
+            elif is_cached_values:
+                add_extra_log_payload(is_cached=is_cached_values)

Review Comment:
   Any chance we could centralize this in a helper (or handle this as part of 
`_get_data_response` or `_send_chart_response`) just to keep it DRYer?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to