mirror of
https://github.com/apache/superset.git
synced 2026-06-27 02:19:22 +00:00
Compare commits
4 Commits
chore/ci/s
...
fix/scarf-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ea05c294a | ||
|
|
b6cb2f561f | ||
|
|
ea1fd88791 | ||
|
|
7893678fc0 |
@@ -223,8 +223,9 @@ compose based installation, edit the `x-superset-image:` line in your `docker-co
|
|||||||
`docker-compose-non-dev.yml` files, replacing `apachesuperset.docker.scarf.sh/apache/superset` with
|
`docker-compose-non-dev.yml` files, replacing `apachesuperset.docker.scarf.sh/apache/superset` with
|
||||||
`apache/superset` to pull the image directly from Docker Hub.
|
`apache/superset` to pull the image directly from Docker Hub.
|
||||||
|
|
||||||
To disable the Scarf telemetry pixel, set the `SCARF_ANALYTICS` environment variable to `False` in
|
To disable the Scarf telemetry pixel, set the `SCARF_ANALYTICS` environment variable to `false` in
|
||||||
your terminal and/or in your `docker/.env` file.
|
your `docker/.env` file. This is read at runtime, so it disables the pixel on the pre-built image
|
||||||
|
without rebuilding the frontend.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## 3. Log in to Superset
|
## 3. Log in to Superset
|
||||||
|
|||||||
@@ -136,7 +136,17 @@ init:
|
|||||||
:::note
|
:::note
|
||||||
Superset uses [Scarf Gateway](https://about.scarf.sh/scarf-gateway) to collect telemetry data. Knowing the installation counts for different Superset versions informs the project's decisions about patching and long-term support. Scarf purges personally identifiable information (PII) and provides only aggregated statistics.
|
Superset uses [Scarf Gateway](https://about.scarf.sh/scarf-gateway) to collect telemetry data. Knowing the installation counts for different Superset versions informs the project's decisions about patching and long-term support. Scarf purges personally identifiable information (PII) and provides only aggregated statistics.
|
||||||
|
|
||||||
To opt-out of this data collection in your Helm-based installation, edit the `repository:` line in your `helm/superset/values.yaml` file, replacing `apachesuperset.docker.scarf.sh/apache/superset` with `apache/superset` to pull the image directly from Docker Hub.
|
There are two independent telemetry channels:
|
||||||
|
|
||||||
|
- **Image pulls** (Scarf Gateway): to opt out, edit the `repository:` line in your `helm/superset/values.yaml` file, replacing `apachesuperset.docker.scarf.sh/apache/superset` with `apache/superset` to pull the image directly from Docker Hub.
|
||||||
|
- **The analytics pixel** rendered in the UI: to opt out, set the `SCARF_ANALYTICS` environment variable to `false` on the Superset containers via `extraEnv` in your `values.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
extraEnv:
|
||||||
|
SCARF_ANALYTICS: "false"
|
||||||
|
```
|
||||||
|
|
||||||
|
This is read at runtime, so it takes effect on the pre-built images without rebuilding the frontend.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|||||||
@@ -321,8 +321,8 @@ This can be used, for example, to convert UTC time to local time.
|
|||||||
Superset uses [Scarf](https://about.scarf.sh/) by default to collect basic telemetry data upon installing and/or running Superset. This data helps the maintainers of Superset better understand which versions of Superset are being used, in order to prioritize patch/minor releases and security fixes.
|
Superset uses [Scarf](https://about.scarf.sh/) by default to collect basic telemetry data upon installing and/or running Superset. This data helps the maintainers of Superset better understand which versions of Superset are being used, in order to prioritize patch/minor releases and security fixes.
|
||||||
We use the [Scarf Gateway](https://docs.scarf.sh/gateway/) to sit in front of container registries, the [scarf-js](https://about.scarf.sh/package-sdks) package to track `npm` installations, and a Scarf pixel to gather anonymous analytics on Superset page views.
|
We use the [Scarf Gateway](https://docs.scarf.sh/gateway/) to sit in front of container registries, the [scarf-js](https://about.scarf.sh/package-sdks) package to track `npm` installations, and a Scarf pixel to gather anonymous analytics on Superset page views.
|
||||||
Scarf purges PII and provides aggregated statistics. Superset users can easily opt out of analytics in various ways documented [here](https://docs.scarf.sh/gateway/#do-not-track) and [here](https://docs.scarf.sh/package-analytics/#as-a-user-of-a-package-using-scarf-js-how-can-i-opt-out-of-analytics).
|
Scarf purges PII and provides aggregated statistics. Superset users can easily opt out of analytics in various ways documented [here](https://docs.scarf.sh/gateway/#do-not-track) and [here](https://docs.scarf.sh/package-analytics/#as-a-user-of-a-package-using-scarf-js-how-can-i-opt-out-of-analytics).
|
||||||
Superset maintainers can also opt out of telemetry data collection by setting the `SCARF_ANALYTICS` environment variable to `false` in the Superset container (or anywhere Superset/webpack are run).
|
You can also opt out of the analytics pixel by setting the `SCARF_ANALYTICS` environment variable to `false`. This is read at runtime, so setting it on the Superset container (for example via `extraEnv` in the Helm chart, or `docker/.env` for Docker Compose) disables the pixel on the pre-built images without rebuilding the frontend.
|
||||||
Additional opt-out instructions for Docker users are available on the [Docker Installation](/admin-docs/installation/docker-compose) page.
|
Additional opt-out instructions are available on the [Docker Compose](/admin-docs/installation/docker-compose) and [Kubernetes](/admin-docs/installation/kubernetes) installation pages.
|
||||||
|
|
||||||
## Does Superset have an archive panel or trash bin from which a user can recover deleted assets?
|
## Does Superset have an archive panel or trash bin from which a user can recover deleted assets?
|
||||||
|
|
||||||
|
|||||||
@@ -46,3 +46,19 @@ test('should NOT render the pixel link when FF is off', () => {
|
|||||||
const image = document.querySelector('img[src*="scarf.sh"]');
|
const image = document.querySelector('img[src*="scarf.sh"]');
|
||||||
expect(image).not.toBeInTheDocument();
|
expect(image).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should NOT render the pixel link when disabled at runtime', () => {
|
||||||
|
process.env.SCARF_ANALYTICS = 'true';
|
||||||
|
render(<TelemetryPixel enabled={false} />);
|
||||||
|
|
||||||
|
const image = document.querySelector('img[src*="scarf.sh"]');
|
||||||
|
expect(image).not.toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should render the pixel link when enabled at runtime', () => {
|
||||||
|
process.env.SCARF_ANALYTICS = 'true';
|
||||||
|
render(<TelemetryPixel enabled />);
|
||||||
|
|
||||||
|
const image = document.querySelector('img[src*="scarf.sh"]');
|
||||||
|
expect(image).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|||||||
@@ -23,17 +23,25 @@ interface TelemetryPixelProps {
|
|||||||
version?: string;
|
version?: string;
|
||||||
sha?: string;
|
sha?: string;
|
||||||
build?: string;
|
build?: string;
|
||||||
|
enabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders a telemetry pixel component to capture anonymous, aggregated telemetry via Scarf.
|
* Renders a telemetry pixel component to capture anonymous, aggregated telemetry via Scarf.
|
||||||
* This can be disabled by setting the SCARF_ANALYTICS environment variable to false.
|
*
|
||||||
|
* Telemetry can be disabled in two ways:
|
||||||
|
* - At build time, by setting the SCARF_ANALYTICS environment variable to `false`
|
||||||
|
* (inlined by webpack; only effective when building the frontend yourself).
|
||||||
|
* - At runtime, by passing `enabled={false}`, which the app derives from the
|
||||||
|
* `SCARF_ANALYTICS` backend config exposed via the bootstrap payload. This is
|
||||||
|
* what allows opting out in pre-built images, where the build-time flag is fixed.
|
||||||
*
|
*
|
||||||
* @component
|
* @component
|
||||||
* @param {TelemetryPixelProps} props - The props for the TelemetryPixel component.
|
* @param {TelemetryPixelProps} props - The props for the TelemetryPixel component.
|
||||||
* @param {string} props.version - The version of Superset that's currently in use.
|
* @param {string} props.version - The version of Superset that's currently in use.
|
||||||
* @param {string} props.sha - The SHA of Superset that's currently in use.
|
* @param {string} props.sha - The SHA of Superset that's currently in use.
|
||||||
* @param {string} props.build - The build of Superset that's currently in use.
|
* @param {string} props.build - The build of Superset that's currently in use.
|
||||||
|
* @param {boolean} props.enabled - Runtime opt-out switch; when false the pixel is not rendered.
|
||||||
* @returns {JSX.Element | null} The rendered TelemetryPixel component.
|
* @returns {JSX.Element | null} The rendered TelemetryPixel component.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -43,9 +51,11 @@ export const TelemetryPixel = ({
|
|||||||
version = 'unknownVersion',
|
version = 'unknownVersion',
|
||||||
sha = 'unknownSHA',
|
sha = 'unknownSHA',
|
||||||
build = 'unknownBuild',
|
build = 'unknownBuild',
|
||||||
|
enabled = true,
|
||||||
}: TelemetryPixelProps): ReactElement | null => {
|
}: TelemetryPixelProps): ReactElement | null => {
|
||||||
const pixelPath = `https://apachesuperset.gateway.scarf.sh/pixel/${PIXEL_ID}/${version}/${sha}/${build}`;
|
const pixelPath = `https://apachesuperset.gateway.scarf.sh/pixel/${PIXEL_ID}/${version}/${sha}/${build}`;
|
||||||
return process.env.SCARF_ANALYTICS === 'false' ? null : (
|
const disabled = !enabled || process.env.SCARF_ANALYTICS === 'false';
|
||||||
|
return disabled ? null : (
|
||||||
<img
|
<img
|
||||||
referrerPolicy="no-referrer-when-downgrade"
|
referrerPolicy="no-referrer-when-downgrade"
|
||||||
src={pixelPath}
|
src={pixelPath}
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ const RightMenu = ({
|
|||||||
EXCEL_EXTENSIONS,
|
EXCEL_EXTENSIONS,
|
||||||
ALLOWED_EXTENSIONS,
|
ALLOWED_EXTENSIONS,
|
||||||
HAS_GSHEETS_INSTALLED,
|
HAS_GSHEETS_INSTALLED,
|
||||||
|
SCARF_ANALYTICS,
|
||||||
} = useSelector<any, ExtensionConfigs>(state => state.common.conf);
|
} = useSelector<any, ExtensionConfigs>(state => state.common.conf);
|
||||||
const [showDatabaseModal, setShowDatabaseModal] = useState<boolean>(false);
|
const [showDatabaseModal, setShowDatabaseModal] = useState<boolean>(false);
|
||||||
const [showCSVUploadModal, setShowCSVUploadModal] = useState<boolean>(false);
|
const [showCSVUploadModal, setShowCSVUploadModal] = useState<boolean>(false);
|
||||||
@@ -769,6 +770,7 @@ const RightMenu = ({
|
|||||||
version={navbarRight.version_string}
|
version={navbarRight.version_string}
|
||||||
sha={navbarRight.version_sha}
|
sha={navbarRight.version_sha}
|
||||||
build={navbarRight.build_number}
|
build={navbarRight.build_number}
|
||||||
|
enabled={SCARF_ANALYTICS !== false}
|
||||||
/>
|
/>
|
||||||
</StyledDiv>
|
</StyledDiv>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export interface ExtensionConfigs {
|
|||||||
COLUMNAR_EXTENSIONS: Array<any>;
|
COLUMNAR_EXTENSIONS: Array<any>;
|
||||||
EXCEL_EXTENSIONS: Array<any>;
|
EXCEL_EXTENSIONS: Array<any>;
|
||||||
HAS_GSHEETS_INSTALLED: boolean;
|
HAS_GSHEETS_INSTALLED: boolean;
|
||||||
|
SCARF_ANALYTICS?: boolean;
|
||||||
}
|
}
|
||||||
export interface RightMenuProps {
|
export interface RightMenuProps {
|
||||||
align: 'flex-start' | 'flex-end';
|
align: 'flex-start' | 'flex-end';
|
||||||
|
|||||||
@@ -2257,6 +2257,13 @@ DATABASE_OAUTH2_TIMEOUT = timedelta(seconds=30)
|
|||||||
# Enable/disable CSP warning
|
# Enable/disable CSP warning
|
||||||
CONTENT_SECURITY_POLICY_WARNING = True
|
CONTENT_SECURITY_POLICY_WARNING = True
|
||||||
|
|
||||||
|
# Superset uses Scarf (https://about.scarf.sh/) to collect anonymous, aggregated
|
||||||
|
# telemetry via a pixel rendered in the UI. Set the SCARF_ANALYTICS environment
|
||||||
|
# variable to "false" to opt out. This value is exposed to the frontend through
|
||||||
|
# the bootstrap payload so it takes effect at runtime, including in pre-built
|
||||||
|
# images where the webpack build-time flag of the same name cannot be changed.
|
||||||
|
SCARF_ANALYTICS = utils.cast_to_boolean(os.environ.get("SCARF_ANALYTICS", True))
|
||||||
|
|
||||||
# Do you want Talisman enabled?
|
# Do you want Talisman enabled?
|
||||||
TALISMAN_ENABLED = utils.cast_to_boolean(os.environ.get("TALISMAN_ENABLED", True))
|
TALISMAN_ENABLED = utils.cast_to_boolean(os.environ.get("TALISMAN_ENABLED", True))
|
||||||
|
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ FRONTEND_CONF_KEYS = (
|
|||||||
"MAPBOX_API_KEY",
|
"MAPBOX_API_KEY",
|
||||||
"DEFAULT_MAP_RENDERER",
|
"DEFAULT_MAP_RENDERER",
|
||||||
"CSV_STREAMING_ROW_THRESHOLD",
|
"CSV_STREAMING_ROW_THRESHOLD",
|
||||||
|
"SCARF_ANALYTICS",
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -75,6 +75,15 @@ def test_default_map_renderer_is_exposed_to_frontend_config() -> None:
|
|||||||
assert "DEFAULT_MAP_RENDERER" in FRONTEND_CONF_KEYS
|
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
|
||||||
|
|
||||||
|
|
||||||
def _extract_language(
|
def _extract_language(
|
||||||
locale_str: str | None,
|
locale_str: str | None,
|
||||||
languages: dict[str, dict[str, object]] | None = None,
|
languages: dict[str, dict[str, object]] | None = None,
|
||||||
|
|||||||
Reference in New Issue
Block a user