Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ AS
SELECT
*,
CASE
WHEN app_version_major >= 144
AND normalized_channel = "esr"
AND policies_count > 1
AND distribution_id IS NULL
THEN "enterprise_esr"
WHEN normalized_channel = "release"
AND ((policies_count > 1) OR (policies_is_enterprise = TRUE))
THEN "enterprise_release"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
CREATE OR REPLACE VIEW
`moz-fx-data-shared-prod.firefox_desktop.enterprise_metrics_clients_legacy`
AS
SELECT
*,
CASE
WHEN `mozfun.norm.browser_version_info`(app_version).major_version >= 144
AND normalized_channel = "esr"
AND policies_count > 1
AND distribution_id IS NULL
THEN "enterprise_esr"
WHEN normalized_channel = "release"
AND ((policies_count > 1) OR (policies_is_enterprise = TRUE))
THEN "enterprise_release"
WHEN normalized_channel = "release"
AND (
(distribution_id IS NOT NULL)
OR (policies_count = 0)
OR (policies_is_enterprise = FALSE)
)
THEN "consumer_release"
WHEN normalized_channel = "esr"
AND ((policies_count > 1) AND (distribution_id IS NULL))
THEN "enterprise_esr"
WHEN normalized_channel = "esr"
AND (
(distribution_id IS NOT NULL)
OR (policies_count = 0)
OR (policies_is_enterprise = FALSE)
)
THEN "consumer_esr"
WHEN normalized_channel = "release"
THEN "unknown_release"
WHEN normalized_channel = "esr"
THEN "unknown_esr"
ELSE "unexpected_classification" -- TODO: we should set up an alert for this, but not fail the query.
END AS enterprise_classification,
FROM
`moz-fx-data-shared-prod.firefox_desktop_derived.enterprise_metrics_clients_legacy_v1`
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
friendly_name: Enterprise Metrics (clients) - Legacy
description: |-
Enterprise Metrics (clients) based on our legacy telemetry.
owners:
- [email protected]
- [email protected]
labels:
incremental: true
table_type: client_level
schedule: daily
scheduling:
dag_name: bqetl_firefox_enterprise
bigquery:
time_partitioning:
type: day
field: submission_date
require_partition_filter: false
expiration_days: 775
clustering:
fields:
- normalized_channel
- is_dau
deprecated: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
WITH daily_users AS (
SELECT
submission_date,
client_id,
sample_id,
normalized_channel,
app_version,
is_desktop,
is_dau,
FROM
`moz-fx-data-shared-prod.telemetry.desktop_active_users`
WHERE
submission_date = @submission_date
-- enterprise is always only "esr" or "release" channels
AND normalized_channel IN ("release", "esr")
AND is_daily_user
),
most_recent_client_distribution_and_policy_metrics AS (
SELECT
client_id,
normalized_channel,
ARRAY_AGG(
payload.processes.parent.scalars.policies_count IGNORE NULLS
ORDER BY
submission_timestamp DESC
)[SAFE_OFFSET(0)] AS policies_count,
ARRAY_AGG(
payload.processes.parent.scalars.policies_is_enterprise IGNORE NULLS
ORDER BY
submission_timestamp DESC
)[SAFE_OFFSET(0)] AS policies_is_enterprise,
ARRAY_AGG(environment.partner.distribution_id IGNORE NULLS ORDER BY submission_timestamp DESC)[
SAFE_OFFSET(0)
] AS distribution_id,
FROM
`moz-fx-data-shared-prod.telemetry.main`
WHERE
DATE(submission_timestamp)
BETWEEN DATE_SUB(@submission_date, INTERVAL 27 DAY)
AND @submission_date
-- enterprise is always only "esr" or "release" channels
AND normalized_channel IN ("release", "esr")
GROUP BY
ALL
)
SELECT
@submission_date AS submission_date,
client_id,
sample_id,
normalized_channel,
app_version,
distribution_id,
is_dau,
is_desktop,
policies_count,
policies_is_enterprise,
FROM
daily_users
INNER JOIN
most_recent_client_distribution_and_policy_metrics
USING (client_id, normalized_channel)
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
fields:
- mode: NULLABLE
name: submission_date
type: DATE
description: |
Logical date corresponding to the partition (date when our server received the ping)
that was processed for generating the metrics.

- mode: NULLABLE
name: client_id
type: STRING
description: |
A UUID uniquely identifying the client.

- mode: NULLABLE
name: sample_id
type: INTEGER
description: |
Hashed version of client_id (if present) useful for partitioning; ranges from 0 to 99

- mode: NULLABLE
name: normalized_channel
type: STRING
description: |
Normalized channel the application is being distributed on. For example, release, beta, etc.

- mode: NULLABLE
name: app_version
type: STRING
description: |
User visible version string (e.g. "1.0.3") for the browser.

- mode: NULLABLE
name: distribution_id
type: STRING
description: |
The distribution id associated with the install of Firefox.

- mode: NULLABLE
name: is_dau
type: BOOLEAN
description: |
Indicates whether the client met our definition of dau on the day.

- mode: NULLABLE
name: is_desktop
type: BOOLEAN
description: |
Indicates whether the client met conditions to be counted as Desktop DAU on the day.

- mode: NULLABLE
name: policies_count
type: INTEGER
description: |
A uint with the number of active enterprise policies, collected once at startup.
This metric was generated to correspond to the Legacy Telemetry scalar policies.count.

- mode: NULLABLE
name: policies_is_enterprise
type: BOOLEAN
description: |
Attempt to determine if the user is an enterprise user based on various signals.
This metric was generated to correspond to the Legacy Telemetry scalar policies.is_enterprise
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
friendly_name: Enterprise Metrics (clients)
friendly_name: Enterprise Metrics (clients) - Glean
description: |-
Enterprise Metrics (clients).
Enterprise Metrics (clients) based on Glean telemetry.
owners:
- [email protected]
- [email protected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ WITH client_baseline AS (
submission_date,
client_id,
sample_id,
legacy_telemetry_client_id,
channel,
distribution_id,
is_daily_user,
is_dau,
is_desktop,
app_version,
app_version_major,
app_version_minor,
app_version_patch_revision,
FROM
`moz-fx-data-shared-prod.firefox_desktop.baseline_active_users`
WHERE
Expand All @@ -32,8 +38,14 @@ WITH client_baseline AS (
SELECT
client_id,
sample_id,
legacy_telemetry_client_id,
channel,
is_dau,
is_desktop,
app_version,
app_version_major,
app_version_minor,
app_version_patch_revision,
FROM
active_users_base
WHERE
Expand All @@ -43,9 +55,15 @@ WITH client_baseline AS (
SELECT
client_id,
sample_id,
legacy_telemetry_client_id,
channel AS normalized_channel,
distribution_id,
is_dau,
is_desktop,
app_version,
app_version_major,
app_version_minor,
app_version_patch_revision,
FROM
daily_users
LEFT JOIN
Expand Down Expand Up @@ -79,9 +97,15 @@ SELECT
sample_id,
normalized_channel,
distribution_id,
app_version,
app_version_major,
app_version_minor,
app_version_patch_revision,
is_dau,
is_desktop,
policies_count,
policies_is_enterprise,
legacy_telemetry_client_id,
FROM
client_baseline
LEFT JOIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,42 @@ fields:
description: |
The distribution id associated with the install of Firefox.

- mode: NULLABLE
name: app_version
type: STRING
description: |
User visible version string (e.g. "1.0.3") for the browser.

- mode: NULLABLE
name: app_version_major
type: NUMERIC
description: |
Major version of the application (Firefox).

- mode: NULLABLE
name: app_version_minor
type: NUMERIC
description: |
Minor version of the application (Firefox).

- mode: NULLABLE
name: app_version_patch_revision
type: NUMERIC
description: |
Patch version of the application (Firefox).

- mode: NULLABLE
name: is_dau
type: BOOLEAN
description: |
Indicates whether the client met our definition of dau on the day.

- mode: NULLABLE
name: is_desktop
type: BOOLEAN
description: |
Indicates whether the client met conditions to be counted as Desktop DAU on the day.

- mode: NULLABLE
name: policies_count
type: INTEGER
Expand All @@ -49,3 +79,9 @@ fields:
description: |
Attempt to determine if the user is an enterprise user based on various signals.
This metric was generated to correspond to the Legacy Telemetry scalar policies.is_enterprise

- mode: NULLABLE
name: legacy_telemetry_client_id
type: STRING
description: |
A unique identifier (UUID) for the client in legacy telemetry.