Compare commits

...

2 Commits

Author SHA1 Message Date
Evan
31aa3bd80a test: add docstring to SCARF_ANALYTICS frontend config test
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 11:05:08 -07:00
Superset Dev
a48d5fefaf fix(telemetry): make SCARF_ANALYTICS opt-out work at runtime
The Scarf telemetry pixel was gated only on `process.env.SCARF_ANALYTICS`,
which webpack inlines at build time. On the official Docker image and the
PyPI wheel the frontend is pre-built, so setting `SCARF_ANALYTICS=false`
at container runtime (Helm `extraEnv`, docker/.env, etc.) had no effect —
the documented opt-out simply didn't work for most deployments (#32110).

Expose `SCARF_ANALYTICS` as a backend config read from the environment and
ship it to the client via the bootstrap payload (`FRONTEND_CONF_KEYS`), then
have RightMenu pass it to `<TelemetryPixel enabled>`. The build-time
`process.env` check is kept as a short-circuit for source builds. Default is
unchanged (telemetry on unless explicitly disabled).

Docs (Kubernetes, Docker Compose, FAQ) updated to document the runtime
opt-out; the k8s page previously only covered opting out of image-pull
telemetry, not the pixel.

Fixes #32110

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-29 11:05:08 -07:00

View File

@@ -76,6 +76,15 @@ def test_default_map_renderer_is_exposed_to_frontend_config() -> None:
assert "DEFAULT_MAP_RENDERER" in FRONTEND_CONF_KEYS
def test_scarf_analytics_is_exposed_to_frontend_config() -> None:
"""SCARF_ANALYTICS must reach the frontend config so pre-built images can opt
out at runtime via the config/env var (the webpack build-time flag cannot be
changed there)."""
from superset.views.base import FRONTEND_CONF_KEYS
assert "SCARF_ANALYTICS" in FRONTEND_CONF_KEYS
_FULL_METADATA = {
"version_string": "4.0.0",
"version_sha": "abcdef12",