Skip to content

feat(glean_usage): Generate schema.yaml files for events_stream ETLs/views (DENG-11586) - #9932

Merged
chelseatroy merged 3 commits into
mainfrom
DENG-11586-events-stream-schemas
Oct 1, 2026
Merged

chelseatroy merged 3 commits into
mainfrom
DENG-11586-events-stream-schemas

Conversation

@sean-rose

Copy link
Copy Markdown
Contributor

Description

With field descriptions, as part of our metadata completeness effort (DENG-10445).

Related Tickets & Documents

Reviewer, please follow this checklist

@sean-rose
sean-rose requested a review from a team as a code owner September 25, 2026 22:16

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adds schema.yaml templates for the generated events_stream_v1 tables, the per-app-ID events_stream views, and the cross-channel events_stream views. The schemas pull field descriptions from the upstream events views with !include-field(s). It also changes get_glean_app_event_extras_by_type to collect extra descriptions from the probe-info API, so the typed extras struct gets per-field descriptions. Where several events describe the same extra differently, the most common description is listed first. I checked the field order in events_stream_v1.schema.yaml against events_stream_v1.query.sql and it matches, including the metrics_as_struct/has_metrics, profile group ID and legacy client ID branches. I left one inline suggestion.

extra = extras_by_type[extra_type][extra_name]
extra["name"] = extra_name
extra["type"] = extra_type
extra["descriptions"].extend(app_id_extra["descriptions"])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This merge loop (set name/type, extend descriptions) repeats the one in get_glean_app_event_extras_by_type at lines 246-251, and the nested defaultdict(lambda: defaultdict(lambda: {...})) factory is also written out twice. Pulling both into small helpers (e.g. _new_extras_by_type() and _merge_extras_by_type(target, source)) would keep the two call sites from drifting apart.

Also, the name and type keys are never read: macros.yaml and macros.sql take the name and type from the dict keys and only use extra['descriptions']. If you drop them, the inner value can be a plain defaultdict(list) of descriptions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored some of the repeated logic into helper functions as suggested.

Regarding the technically unused name and type entries in the extras_by_type dicts, my thinking was that it's more intuitive for the innermost values in that nested dictionary setup to be full-fledged event extra dicts rather than just the descriptions. In an initial implementation I actually did just have lists of descriptions as the innermost values, but then I got hung up on having to explain that structure in comments or via cumbersome variable names like extra_descriptions_by_type_and_name. I find the current implementation to be simpler conceptually, and I don't think having those extra values really hurts anything.

@scholtzan

This comment has been minimized.

@scholtzan

Copy link
Copy Markdown
Contributor

Integration report

@chelseyklein chelseyklein left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

@chelseatroy
chelseatroy added this pull request to the merge queue Oct 1, 2026
Merged via the queue into main with commit 5be6904 Oct 1, 2026
27 checks passed
@chelseatroy
chelseatroy deleted the DENG-11586-events-stream-schemas branch October 1, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants