You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2021/08/07 17:20:19 UTC
[superset] branch log_thumb created (now 9a16605)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a change to branch log_thumb
in repository https://gitbox.apache.org/repos/asf/superset.git.
at 9a16605 chore: add stats logging to thumbnail api
This branch includes the following new commits:
new 9a16605 chore: add stats logging to thumbnail api
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[superset] 01/01: chore: add stats logging to thumbnail api
Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch log_thumb
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 9a16605a6bf0dca363f7c83157ce9de0cc8a942c
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Sat Aug 7 10:06:27 2021 -0700
chore: add stats logging to thumbnail api
---
docker-compose.yml | 3 +++
superset-frontend/package-lock.json | 2 ++
superset/charts/api.py | 3 +++
superset/dashboards/api.py | 3 +++
4 files changed, 11 insertions(+)
diff --git a/docker-compose.yml b/docker-compose.yml
index 8b94f70..93a7980 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -118,6 +118,9 @@ services:
depends_on: *superset-depends-on
user: *superset-user
volumes: *superset-volumes
+ # Bump memory limit if processing selenium / thumbails on superset-worker
+ # mem_limit: 2038m
+ # mem_reservation: 128M
superset-worker-beat:
image: *superset-image
diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json
index 12200bc..51d8814 100644
--- a/superset-frontend/package-lock.json
+++ b/superset-frontend/package-lock.json
@@ -29440,6 +29440,7 @@
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
+ "hasInstallScript": true,
"optional": true,
"os": [
"darwin"
@@ -48774,6 +48775,7 @@
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
+ "hasInstallScript": true,
"optional": true,
"os": [
"darwin"
diff --git a/superset/charts/api.py b/superset/charts/api.py
index 5ed2b57..8de2e42 100644
--- a/superset/charts/api.py
+++ b/superset/charts/api.py
@@ -989,6 +989,7 @@ class ChartRestApi(BaseSupersetModelRestApi):
)
# If not screenshot then send request to compute thumb to celery
if not screenshot:
+ self.incr_stats("async", self.thumbnail.__name__)
logger.info(
"Triggering thumbnail compute (chart id: %s) ASYNC", str(chart.id)
)
@@ -996,11 +997,13 @@ class ChartRestApi(BaseSupersetModelRestApi):
return self.response(202, message="OK Async")
# If digests
if chart.digest != digest:
+ self.incr_stats("redirect", self.thumbnail.__name__)
return redirect(
url_for(
f"{self.__class__.__name__}.thumbnail", pk=pk, digest=chart.digest
)
)
+ self.incr_stats("from_cache", self.thumbnail.__name__)
return Response(
FileWrapper(screenshot), mimetype="image/png", direct_passthrough=True
)
diff --git a/superset/dashboards/api.py b/superset/dashboards/api.py
index cd74c9d..bca0334 100644
--- a/superset/dashboards/api.py
+++ b/superset/dashboards/api.py
@@ -820,10 +820,12 @@ class DashboardRestApi(BaseSupersetModelRestApi):
).get_from_cache(cache=thumbnail_cache)
# If the screenshot does not exist, request one from the workers
if not screenshot:
+ self.incr_stats("async", self.thumbnail.__name__)
cache_dashboard_thumbnail.delay(dashboard_url, dashboard.digest, force=True)
return self.response(202, message="OK Async")
# If digests
if dashboard.digest != digest:
+ self.incr_stats("redirect", self.thumbnail.__name__)
return redirect(
url_for(
f"{self.__class__.__name__}.thumbnail",
@@ -831,6 +833,7 @@ class DashboardRestApi(BaseSupersetModelRestApi):
digest=dashboard.digest,
)
)
+ self.incr_stats("from_cache", self.thumbnail.__name__)
return Response(
FileWrapper(screenshot), mimetype="image/png", direct_passthrough=True
)