Skip to content

Pull country from metrics in quick_suggest ping #7508

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1628fb0
Pull country from metrics in quick_suggest ping
curtismorales May 23, 2025
68e8fc9
Fix queries
curtismorales Jul 1, 2025
c2a1c8a
Fix tests
curtismorales Jul 1, 2025
b5c8597
Merge branch 'main' into AD-869-update-suggest-derived-tables
curtismorales Jul 1, 2025
61fad86
Merge branch 'main' into AD-869-update-suggest-derived-tables
curtismorales Jul 9, 2025
8bb47a9
Update suggest_impression_sanitized_v3 test
curtismorales Jul 9, 2025
00cc357
Merge branch 'AD-869-update-suggest-derived-tables' of github.com:moz…
curtismorales Jul 9, 2025
06f8a94
Merge branch 'main' into AD-869-update-suggest-derived-tables
curtismorales Jul 9, 2025
d171488
update CODEOWNERS
curtismorales Jul 9, 2025
01f5dc3
Fix cast
curtismorales Jul 9, 2025
66e4d14
Merge branch 'main' into AD-869-update-suggest-derived-tables
curtismorales Jul 9, 2025
6d2d8ad
Update codeowners
curtismorales Jul 9, 2025
e3a72cd
Merge branch 'AD-869-update-suggest-derived-tables' of github.com:moz…
curtismorales Jul 9, 2025
c883dba
Undo changes to CODEOWNERS
curtismorales Jul 9, 2025
2ac9381
Test CI codeowners check
curtismorales Jul 9, 2025
95c218b
Merge branch 'main' into AD-869-update-suggest-derived-tables
curtismorales Jul 11, 2025
bccfc94
Undo change
curtismorales Jul 11, 2025
c513324
Merge branch 'AD-869-update-suggest-derived-tables' of github.com:moz…
curtismorales Jul 11, 2025
1779e5c
Merge branch 'main' into AD-869-update-suggest-derived-tables
curtismorales Jul 14, 2025
8f1fd4c
Merge branch 'main' into AD-869-update-suggest-derived-tables
curtismorales Jul 14, 2025
7c5c81f
Merge branch 'main' into AD-869-update-suggest-derived-tables
curtismorales Aug 7, 2025
ee2e3a5
Merge branch 'main' into AD-869-update-suggest-derived-tables
curtismorales Aug 19, 2025
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 @@ -14,7 +14,14 @@ combined AS (
metrics.uuid.quick_suggest_context_id AS context_id,
DATE(submission_timestamp) AS submission_date,
'desktop' AS form_factor,
normalized_country_code AS country,
-- As of Firefox 140, the quick_suggest ping is sent via OHTTP and now
-- receives geo information from the client rather than from Glean ingestion's
-- IP geolocation. We no longer send subdivision, only country.
IF(
SAFE_CAST(metadata.user_agent.version AS INT64) >= 140,
metrics.string.quick_suggest_country,
normalized_country_code
) AS country,
LOWER(metrics.string.quick_suggest_advertiser) AS advertiser,
SPLIT(metadata.user_agent.os, ' ')[SAFE_OFFSET(0)] AS normalized_os,
client_info.app_channel AS release_channel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ combined AS (
"impression"
) AS event_type,
'desktop' AS form_factor,
normalized_country_code AS country,
metadata.geo.subdivision1 AS subdivision1,
-- As of Firefox 140, the quick_suggest ping is sent via OHTTP and now
-- receives geo information from the client rather than from Glean ingestion's
-- IP geolocation. We no longer send subdivision, only country.
IF(
SAFE_CAST(metadata.user_agent.version AS INT64) >= 140,
metrics.string.quick_suggest_country,
normalized_country_code
) AS country,
IF(
SAFE_CAST(metadata.user_agent.version AS INT64) >= 140,
CAST(NULL AS STRING),
metadata.geo.subdivision1
) AS subdivision1,
metrics.string.quick_suggest_advertiser AS advertiser,
client_info.app_channel AS release_channel,
metrics.quantity.quick_suggest_position AS position,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@ ping_data AS (
"click",
"impression"
) AS interaction_type,
metadata.geo.country AS country_code,
metadata.geo.subdivision1 AS region_code,
-- As of Firefox 140, the quick_suggest ping is sent via OHTTP and now
-- receives geo information from the client rather than from Glean ingestion's
-- IP geolocation. We no longer send subdivision, only country.
IF(
SAFE_CAST(metadata.user_agent.version AS INT64) >= 140,
metrics.string.quick_suggest_country,
metadata.geo.country
) AS country_code,
IF(
SAFE_CAST(metadata.user_agent.version AS INT64) >= 140,
CAST(NULL AS STRING),
metadata.geo.subdivision1
) AS region_code,
metadata.user_agent.os AS os_family,
metadata.user_agent.version AS product_version,
FROM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ WITH impressions AS (
sample_id,
metrics.boolean.quick_suggest_is_clicked AS is_clicked,
client_info.locale AS locale,
metadata.geo.country,
metadata.geo.subdivision1 AS region,
IF(
SAFE_CAST(metadata.user_agent.version AS INT64) >= 140,
metrics.string.quick_suggest_country,
metadata.geo.country
) AS country,
IF(
SAFE_CAST(metadata.user_agent.version AS INT64) >= 140,
CAST(NULL AS STRING),
metadata.geo.subdivision1
) AS region,
normalized_os,
normalized_os_version,
normalized_channel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
submission_date: "2030-01-01"
source: suggest
provider: merino
event_type: impression
event_type: click
form_factor: desktop
country: US
subdivision1: AZ
country: DE
advertiser: ad1
release_channel: release
match_type: "firefox-suggest"
Expand All @@ -17,7 +16,12 @@
user_count: 1
query_type: branded
- <<: *suggest_base
event_type: click
event_type: impression
country: US
subdivision1: AZ
- <<: *suggest_base
country: US
subdivision1: AZ
- &suggest_mobile
submission_date: "2030-01-01"
source: suggest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
subdivision1: AZ
user_agent:
os: "Windows 11"
version: "130"
metrics: &click_metrics
boolean:
quick_suggest_improve_suggest_experience: true
Expand All @@ -28,3 +29,13 @@
string:
<<: *click_strings
quick_suggest_ping_type: quicksuggest-impression
- <<: *click
metadata:
user_agent:
os: "Windows 11"
version: "141"
metrics:
<<: *click_metrics
string:
<<: *click_strings
quick_suggest_country: DE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
subdivision1: AZ
user_agent:
os: "Windows 11"
version: 130
metrics: &click_metrics
boolean:
quick_suggest_improve_suggest_experience: true
Expand All @@ -19,6 +20,7 @@
quick_suggest_match_type: firefox-suggest
quick_suggest_ping_type: quicksuggest-click
quick_suggest_request_id: HASH123
quick_suggest_country: null
uuid:
quick_suggest_context_id: a
normalized_country_code: US
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,24 @@
reporting_url: https://example.com/duff-beer
submission_timestamp: "2021-01-01T13:03:00+00:00"
version: "134"
- advertiser: omni consumer products
block_id: 205
browser: firefox(141)
context_id: cid15
country: US
form_factor: desktop
is_clicked: false
locale: en-US
normalized_channel: release
normalized_os: windows
normalized_os_version: 15.2
os_family: windows
position: 15
query: robot police
reporting_url: https://example.com/ocp
request_id: rid15
sequence_no: 15
session_id: sid15
submission_timestamp: "2021-01-01T13:05:00+00:00"
timestamp: "2021-01-01T13:05:00+00:00"
version: "141"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
geo:
country: US
subdivision1: CA
user_agent:
version: "134"
metrics:
boolean:
quick_suggest_is_clicked: false
Expand All @@ -32,6 +34,8 @@
geo:
country: US
subdivision1: PA
user_agent:
version: "134"
metrics:
boolean:
quick_suggest_is_clicked: true
Expand All @@ -58,6 +62,8 @@
geo:
country: US
subdivision1: OR
user_agent:
version: "134"
metrics:
boolean:
quick_suggest_is_clicked: false
Expand All @@ -84,6 +90,8 @@
geo:
country: US
subdivision1: WA
user_agent:
version: "134"
metrics:
boolean:
quick_suggest_is_clicked: true
Expand All @@ -102,3 +110,32 @@
normalized_os: Windows
normalized_os_version: "11.0"
sample_id: null
- submission_timestamp: "2021-01-01 13:05:00"
client_info:
app_display_version: "141.0.1"
locale: en-US
metadata:
geo:
country: null
subdivision1: null
user_agent:
version: "141"
metrics:
boolean:
quick_suggest_is_clicked: false
quantity:
quick_suggest_position: 15
string:
quick_suggest_advertiser: omni consumer products
quick_suggest_block_id: 205
quick_suggest_ping_type: "quicksuggest-impression"
quick_suggest_request_id: rid15
quick_suggest_country: US
url2:
quick_suggest_reporting_url: "https://example.com/ocp"
uuid:
quick_suggest_context_id: cid15
normalized_channel: release
normalized_os: windows
normalized_os_version: "15.2"
sample_id: null
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,14 @@
form_factor: desktop
browser: firefox(134)
os_family: windows
- timestamp: "2021-01-01 13:05:00.000000"
request_id: rid15
session_id: sid15
sequence_no: 15
query: "robot police"
country: null
region: null
dma: null
form_factor: desktop
browser: firefox(141)
os_family: windows