-
Notifications
You must be signed in to change notification settings - Fork 124
[DENG-9376] Publish DOH adoption and usage rates #8238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4164f19
[DENG-9376] Publish DOH adoption and usage rates
scholtzan 12406eb
Add schema and use events_stream table
scholtzan ed3f64e
Merge branch 'main' into publish-doh-aggregates
scholtzan 9861060
Update sql/moz-fx-data-shared-prod/telemetry_derived/doh_adoption_rat…
scholtzan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
sql/moz-fx-data-shared-prod/telemetry/doh_adoption_rate/view.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| CREATE OR REPLACE VIEW | ||
| `moz-fx-data-shared-prod.telemetry.doh_adoption_rate` | ||
| AS | ||
| SELECT | ||
| * | ||
| FROM | ||
| `moz-fx-data-shared-prod.telemetry_derived.doh_adoption_rate_v1` |
22 changes: 22 additions & 0 deletions
22
sql/moz-fx-data-shared-prod/telemetry_derived/doh_adoption_rate_v1/metadata.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| friendly_name: DOH Adoption Rate | ||
| description: |- | ||
| A distinct client count of a combination of metrics to measure | ||
| the adoption of DOH (DNS over HTTPS) in Firefox. | ||
| owners: | ||
| - [email protected] | ||
| labels: | ||
| incremental: true | ||
| owner1: ascholtz | ||
| public_bigquery: true | ||
| public_json: true | ||
| review_bugs: | ||
| - '1982897' | ||
| scheduling: | ||
| dag_name: bqetl_ech_adoption_rate | ||
| bigquery: | ||
| time_partitioning: | ||
| type: day | ||
| field: 'submission_date' | ||
| require_partition_filter: true | ||
| expiration_days: null | ||
| range_partitioning: null |
253 changes: 253 additions & 0 deletions
253
sql/moz-fx-data-shared-prod/telemetry_derived/doh_adoption_rate_v1/query.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,253 @@ | ||
| WITH unioned AS ( | ||
| /* ---------- doh.evaluate_v2_heuristics ---------- */ | ||
| SELECT | ||
| DATE(submission_timestamp) AS submission_date, | ||
| 'doh.evaluate_v2_heuristics' AS metric, | ||
| "value" AS key, | ||
| COALESCE(STRING(event_extra.value), '') AS value, | ||
| CASE | ||
| WHEN COUNT(DISTINCT client_id) >= 5000 | ||
| THEN normalized_country_code | ||
| ELSE 'OTHER' | ||
| END AS country_code, | ||
| COUNT(DISTINCT client_id) AS client_count | ||
| FROM | ||
| `moz-fx-data-shared-prod.firefox_desktop.events_stream` | ||
| WHERE | ||
| DATE(submission_timestamp) = @submission_date | ||
| AND client_id IS NOT NULL | ||
| AND client_info.app_channel = 'release' | ||
| AND event_category = 'doh' | ||
| AND event_name = 'evaluate_v2_heuristics' | ||
| GROUP BY | ||
| submission_date, | ||
| key, | ||
| value, | ||
| normalized_country_code | ||
| UNION ALL | ||
| /* ---------- doh.state_disabled ---------- */ | ||
| SELECT | ||
| DATE(submission_timestamp) AS submission_date, | ||
| 'doh.state_disabled' AS metric, | ||
| '' AS key, | ||
| '' AS value, | ||
| CASE | ||
| WHEN COUNT(DISTINCT client_id) >= 5000 | ||
| THEN normalized_country_code | ||
| ELSE 'OTHER' | ||
| END AS country_code, | ||
| COUNT(DISTINCT client_id) AS client_count | ||
| FROM | ||
| `moz-fx-data-shared-prod.firefox_desktop.events_stream` | ||
| WHERE | ||
| DATE(submission_timestamp) = @submission_date | ||
| AND client_id IS NOT NULL | ||
| AND client_info.app_channel = 'release' | ||
| AND event_category = 'doh' | ||
| AND event_name = 'state_disabled' | ||
| GROUP BY | ||
| submission_date, | ||
| key, | ||
| value, | ||
| normalized_country_code | ||
| UNION ALL | ||
| /* ---------- doh.state_enabled ---------- */ | ||
| SELECT | ||
| DATE(submission_timestamp) AS submission_date, | ||
| 'doh.state_enabled' AS metric, | ||
| '' AS key, | ||
| '' AS value, | ||
| CASE | ||
| WHEN COUNT(DISTINCT client_id) >= 5000 | ||
| THEN normalized_country_code | ||
| ELSE 'OTHER' | ||
| END AS country_code, | ||
| COUNT(DISTINCT client_id) AS client_count | ||
| FROM | ||
| `moz-fx-data-shared-prod.firefox_desktop.events_stream` | ||
| WHERE | ||
| DATE(submission_timestamp) = @submission_date | ||
| AND client_id IS NOT NULL | ||
| AND client_info.app_channel = 'release' | ||
| AND event_category = 'doh' | ||
| AND event_name = 'state_enabled' | ||
| GROUP BY | ||
| submission_date, | ||
| key, | ||
| value, | ||
| normalized_country_code | ||
| UNION ALL | ||
| /* ---------- doh.state_manually_disabled ---------- */ | ||
| SELECT | ||
| DATE(submission_timestamp) AS submission_date, | ||
| 'doh.state_manually_disabled' AS metric, | ||
| '' AS key, | ||
| '' AS value, | ||
| CASE | ||
| WHEN COUNT(DISTINCT client_id) >= 5000 | ||
| THEN normalized_country_code | ||
| ELSE 'OTHER' | ||
| END AS country_code, | ||
| COUNT(DISTINCT client_id) AS client_count | ||
| FROM | ||
| `moz-fx-data-shared-prod.firefox_desktop.events_stream` | ||
| WHERE | ||
| DATE(submission_timestamp) = @submission_date | ||
| AND client_id IS NOT NULL | ||
| AND client_info.app_channel = 'release' | ||
| AND event_category = 'doh' | ||
| AND event_name = 'state_manually_disabled' | ||
| GROUP BY | ||
| submission_date, | ||
| key, | ||
| value, | ||
| normalized_country_code | ||
| UNION ALL | ||
| /* ---------- doh.state_policy_disabled ---------- */ | ||
| SELECT | ||
| DATE(submission_timestamp) AS submission_date, | ||
| 'doh.state_policy_disabled' AS metric, | ||
| '' AS key, | ||
| '' AS value, | ||
| CASE | ||
| WHEN COUNT(DISTINCT client_id) >= 5000 | ||
| THEN normalized_country_code | ||
| ELSE 'OTHER' | ||
| END AS country_code, | ||
| COUNT(DISTINCT client_id) AS client_count | ||
| FROM | ||
| `moz-fx-data-shared-prod.firefox_desktop.events_stream` | ||
| WHERE | ||
| DATE(submission_timestamp) = @submission_date | ||
| AND client_id IS NOT NULL | ||
| AND client_info.app_channel = 'release' | ||
| AND event_category = 'doh' | ||
| AND event_name = 'state_policy_disabled' | ||
| GROUP BY | ||
| submission_date, | ||
| key, | ||
| value, | ||
| normalized_country_code | ||
| UNION ALL | ||
| /* ---------- networking.doh_heuristics_attempts ---------- */ | ||
| SELECT | ||
| DATE(submission_timestamp) AS submission_date, | ||
| 'networking.doh_heuristics_attempts' AS metric, | ||
| 'networking.doh_heuristics_attempts' AS key, | ||
| CAST(metrics.counter.networking_doh_heuristics_attempts AS STRING) AS value, | ||
| CASE | ||
| WHEN COUNT(DISTINCT client_info.client_id) >= 5000 | ||
| THEN metadata.geo.country | ||
| ELSE 'OTHER' | ||
| END AS country_code, | ||
| COUNT(DISTINCT client_info.client_id) AS client_count | ||
| FROM | ||
| `moz-fx-data-shared-prod.firefox_desktop.metrics` | ||
| WHERE | ||
| DATE(submission_timestamp) = @submission_date | ||
| AND client_info.client_id IS NOT NULL | ||
| AND client_info.app_channel = 'release' | ||
| AND metrics.counter.networking_doh_heuristics_attempts IS NOT NULL | ||
| GROUP BY | ||
| submission_date, | ||
| key, | ||
| value, | ||
| metadata.geo.country | ||
| UNION ALL | ||
| /* ---------- networking.doh_heuristics_pass_count ---------- */ | ||
| SELECT | ||
| DATE(submission_timestamp) AS submission_date, | ||
| 'networking.doh_heuristics_pass_count' AS metric, | ||
| 'networking.doh_heuristics_attempts' AS key, | ||
| CAST(metrics.counter.networking_doh_heuristics_pass_count AS STRING) AS value, | ||
| CASE | ||
| WHEN COUNT(DISTINCT client_info.client_id) >= 5000 | ||
| THEN metadata.geo.country | ||
| ELSE 'OTHER' | ||
| END AS country_code, | ||
| COUNT(DISTINCT client_info.client_id) AS client_count | ||
| FROM | ||
| `moz-fx-data-shared-prod.firefox_desktop.metrics` | ||
| WHERE | ||
| DATE(submission_timestamp) = @submission_date | ||
| AND client_info.client_id IS NOT NULL | ||
| AND client_info.app_channel = 'release' | ||
| AND metrics.counter.networking_doh_heuristics_pass_count IS NOT NULL | ||
| GROUP BY | ||
| submission_date, | ||
| key, | ||
| value, | ||
| metadata.geo.country | ||
| UNION ALL | ||
| /* ---------- networking.doh_heuristics_result ---------- */ | ||
| SELECT | ||
| DATE(submission_timestamp) AS submission_date, | ||
| 'networking.doh_heuristics_result' AS metric, | ||
| 'networking.doh_heuristics_result' AS key, | ||
| CAST(metrics.quantity.networking_doh_heuristics_result AS STRING) AS value, | ||
| CASE | ||
| WHEN COUNT(DISTINCT client_info.client_id) >= 5000 | ||
| THEN metadata.geo.country | ||
| ELSE 'OTHER' | ||
| END AS country_code, | ||
| COUNT(DISTINCT client_info.client_id) AS client_count | ||
| FROM | ||
| `moz-fx-data-shared-prod.firefox_desktop.metrics` | ||
| WHERE | ||
| DATE(submission_timestamp) = @submission_date | ||
| AND client_info.client_id IS NOT NULL | ||
| AND client_info.app_channel = 'release' | ||
| AND metrics.quantity.networking_doh_heuristics_result IS NOT NULL | ||
| GROUP BY | ||
| submission_date, | ||
| key, | ||
| value, | ||
| metadata.geo.country | ||
| UNION ALL | ||
| /* ---------- security.doh.settings.provider_choice_value ---------- */ | ||
| SELECT | ||
| DATE(submission_timestamp) AS submission_date, | ||
| 'security.doh.settings.provider_choice_value' AS metric, | ||
| "value" AS key, | ||
| COALESCE(STRING(event_extra.value), '') AS value, | ||
| CASE | ||
| WHEN COUNT(DISTINCT client_id) >= 5000 | ||
| THEN normalized_country_code | ||
| ELSE 'OTHER' | ||
| END AS country_code, | ||
| COUNT(DISTINCT client_id) AS client_count | ||
| FROM | ||
| `moz-fx-data-shared-prod.firefox_desktop.events_stream` | ||
| WHERE | ||
| DATE(submission_timestamp) = @submission_date | ||
| AND client_id IS NOT NULL | ||
| AND client_info.app_channel = 'release' | ||
| AND event_category = 'security.doh.settings' | ||
| AND event_name = 'provider_choice_value' | ||
| GROUP BY | ||
| submission_date, | ||
| key, | ||
| value, | ||
| normalized_country_code | ||
| ) | ||
| SELECT | ||
| submission_date, | ||
| metric, | ||
| key, | ||
| value, | ||
| country_code, | ||
| SUM(client_count) AS total_client_count | ||
| FROM | ||
| unioned | ||
| GROUP BY | ||
| submission_date, | ||
| metric, | ||
| key, | ||
| value, | ||
| country_code | ||
| ORDER BY | ||
| submission_date DESC, | ||
| metric, | ||
| country_code, | ||
| key, | ||
| value |
39 changes: 39 additions & 0 deletions
39
sql/moz-fx-data-shared-prod/telemetry_derived/doh_adoption_rate_v1/schema.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| fields: | ||
| - mode: NULLABLE | ||
| name: submission_date | ||
| type: DATE | ||
| description: The date when the telemetry data was submitted to the server. | ||
| - mode: NULLABLE | ||
| name: metric | ||
| type: STRING | ||
| description: The specific DOH (DNS-over-HTTPS) metric being measured. Can be one | ||
| of doh.evaluate_v2_heuristics (DOH heuristics evaluation), doh.state_disabled | ||
| (DOH disabled state), doh.state_enabled (DOH enabled state), doh.state_manually_disabled | ||
| (DOH manually disabled by user), doh.state_policy_disabled (DOH disabled by policy), | ||
| networking.doh_heuristics_attempts (count of heuristics attempts), networking.doh_heuristics_pass_count | ||
| (count of heuristics that passed), networking.doh_heuristics_result (result code | ||
| of heuristics evaluation), or security.doh.settings.provider_choice_value (selected | ||
| DOH provider). | ||
| - mode: NULLABLE | ||
| name: key | ||
| type: STRING | ||
| description: The key or dimension associated with the metric value. For event-based | ||
| metrics with extra fields, this represents the field name (e.g., 'value'). For | ||
| counter/quantity metrics, this is typically the metric name itself. | ||
| - mode: NULLABLE | ||
| name: value | ||
| type: STRING | ||
| description: The value associated with the metric. For event extra fields, this | ||
| contains the extra field value. For counters and quantities, this contains the | ||
| stringified numeric value. May be empty for events without extra fields. | ||
| - mode: NULLABLE | ||
| name: country_code | ||
| type: STRING | ||
| description: The ISO country code where the client is located, normalized by geolocation. | ||
| Countries with fewer than 5000 distinct clients are aggregated into 'OTHER' for | ||
| privacy reasons. | ||
| - mode: NULLABLE | ||
| name: total_client_count | ||
| type: INTEGER | ||
| description: The total count of distinct clients (by client_id) that reported this | ||
| metric, key, value, and country combination on the submission date. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.