Skip to content

glean

Functions for working with Glean data.

legacy_compatible_experiments (UDF)

Formats a Glean experiments field into a Legacy Telemetry experiments field by dropping the extra information that Glean collects

This UDF transforms the ping_info.experiments field from Glean pings into the format for experiments used by Legacy Telemetry pings. In particular, it drops the exta information that Glean pings collect.

If you need to combine Glean data with Legacy Telemetry data, then you can use this UDF to transform a Glean experiments field into the structure of a Legacy Telemetry one.

Parameters

INPUTS

ping_info__experiments ARRAY<STRUCT<key STRING, value STRUCT<branch STRING, extra STRUCT<type STRING, enrollment_id STRING>>>>

OUTPUTS

ARRAY<STRUCT<key STRING, value STRING>>

Source | Edit

parse_datetime (UDF)

Parses a Glean datetime metric string value as a BigQuery timestamp.

See https://mozilla.github.io/glean/book/reference/metrics/datetime.html

Parameters

INPUTS

datetime_string STRING

OUTPUTS

TIMESTAMP

Source | Edit

timespan_nanos (UDF)

Returns the number of nanoseconds represented by a Glean timespan struct.

See https://mozilla.github.io/glean/book/user/metrics/timespan.html

Parameters

INPUTS

timespan STRUCT<time_unit STRING, value INT64>

OUTPUTS

INT64

Source | Edit

timespan_seconds (UDF)

Returns the number of seconds represented by a Glean timespan struct, rounded down to full seconds.

See https://mozilla.github.io/glean/book/user/metrics/timespan.html

Parameters

INPUTS

timespan STRUCT<time_unit STRING, value INT64>

OUTPUTS

INT64

Source | Edit