mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Bug 1855312 - Check against all possible 'Mach' sites when activating telemetry, rather than just the mach
site r=sheehan
Changes in Bug 1695312 made it so the actual command site is activated much sooner, as such, at this point in the program execution, any of the 'Mach' sites can be active, so we should check against all of them. In the past, the 'mach' site was the only one that could be active at this time, so it was the only one that was needed to be checked for. Differential Revision: https://phabricator.services.mozilla.com/D189290
This commit is contained in:
parent
90952a1cc2
commit
8ab1c0738b
@ -23,6 +23,7 @@ from mach.telemetry_interface import GleanTelemetry, NoopTelemetry
|
||||
from mach.util import get_state_dir
|
||||
|
||||
MACH_METRICS_PATH = (Path(__file__) / ".." / ".." / "metrics.yaml").resolve()
|
||||
SITE_DIR = (Path(__file__) / ".." / ".." / ".." / "sites").resolve()
|
||||
|
||||
|
||||
def create_telemetry_from_environment(settings):
|
||||
@ -36,16 +37,17 @@ def create_telemetry_from_environment(settings):
|
||||
"""
|
||||
|
||||
active_metadata = MozSiteMetadata.from_runtime()
|
||||
is_mach_virtualenv = active_metadata and active_metadata.site_name == "mach"
|
||||
mach_sites = [site_path.stem for site_path in SITE_DIR.glob("*.txt")]
|
||||
is_a_mach_virtualenv = active_metadata and active_metadata.site_name in mach_sites
|
||||
|
||||
if not (
|
||||
is_applicable_telemetry_environment()
|
||||
# Glean is not compatible with Python 2
|
||||
and sys.version_info >= (3, 0)
|
||||
# If not using the mach virtualenv (e.g.: bootstrap uses native python)
|
||||
# If not using a mach virtualenv (e.g.: bootstrap uses native python)
|
||||
# then we can't guarantee that the glean package that we import is a
|
||||
# compatible version. Therefore, don't use glean.
|
||||
and is_mach_virtualenv
|
||||
and is_a_mach_virtualenv
|
||||
):
|
||||
return NoopTelemetry(False)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user