Bug 1703092: Don't provide cpu_brand in telemetry if None r=sheehan

Glean is throwing an error if a string metric is `None`.
Since `get_cpu_brand()` can return `None`, only update telemetry if it's
set.

Depends on D110847

Differential Revision: https://phabricator.services.mozilla.com/D110858
This commit is contained in:
Mitchell Hentges 2021-04-19 23:17:06 +00:00
parent 0cdb31f286
commit 8c5acba80f

View File

@ -418,7 +418,9 @@ def _finalize_telemetry_glean(telemetry, is_bootstrap, success):
mach_metrics.mach.duration.stop()
mach_metrics.mach.success.set(success)
system_metrics = mach_metrics.mach.system
system_metrics.cpu_brand.set(get_cpu_brand())
cpu_brand = get_cpu_brand()
if cpu_brand:
system_metrics.cpu_brand.set(cpu_brand)
distro, version = get_distro_and_version()
system_metrics.distro.set(distro)
system_metrics.distro_version.set(version)