Bug 1820241 - Use MOZ_ARTIFACT_BUILDS to determine if FOG needs JOG r=glandium,janerik

FOG needs to trigger JOG (artifact build support for runtime-defined metrics.
Allows changes and additions to metrics.yamls to be usable from JS without a
compile step) when running an Artifact Build.

So we take `MOZ_ARTIFACT_BUILDS` and pop it into a pref for FOG's use in C++.

Differential Revision: https://phabricator.services.mozilla.com/D173211
This commit is contained in:
Chris H-C 2023-03-28 17:06:26 +00:00
Родитель ec36de1b56
Коммит 8b3cea7b3d
5 изменённых файлов: 24 добавлений и 13 удалений

Просмотреть файл

@ -2837,3 +2837,8 @@ pref("cookiebanners.ui.desktop.cfrVariant", 0);
pref("browser.swipe.navigation-icon-min-radius", 12);
pref("browser.swipe.navigation-icon-max-radius", 20);
#endif
// Trigger FOG's Artifact Build support on artifact builds.
#ifdef MOZ_ARTIFACT_BUILDS
pref("telemetry.fog.artifact_build", true);
#endif

Просмотреть файл

@ -51,6 +51,9 @@ if CONFIG["MOZ_GPSD"]:
if CONFIG["MOZ_UPDATE_AGENT"]:
DEFINES["MOZ_UPDATE_AGENT"] = True
if CONFIG["MOZ_ARTIFACT_BUILDS"]:
DEFINES["MOZ_ARTIFACT_BUILDS"] = True
# These files are specified in this moz.build to pick up DIST_SUBDIR as set in
# this directory, which is un-set in browser/app.
JS_PREFERENCE_PP_FILES += [

Просмотреть файл

@ -14167,6 +14167,11 @@
mirror: always
rust: true
- name: telemetry.fog.artifact_build
type: RelaxedAtomicBool
value: false
mirror: always
#---------------------------------------------------------------------------
# Prefs starting with "test."
#---------------------------------------------------------------------------

Просмотреть файл

@ -13,7 +13,7 @@
#include "mozilla/glean/bindings/jog/jog_ffi_generated.h"
#include "mozilla/Logging.h"
#include "mozilla/Omnijar.h"
#include "mozilla/StaticPrefs_telemetry.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
#include "nsThreadUtils.h"
@ -44,13 +44,6 @@ static Maybe<bool> sFoundAndLoadedJogfile;
bool JOG::EnsureRuntimeMetricsRegistered(bool aForce) {
MOZ_ASSERT(NS_IsMainThread());
#ifdef MOZILLA_OFFICIAL
// In the event we're an official build we want there to be no chance we might
// accidentally perform I/O on the main thread.
MOZ_LOG(sLog, LogLevel::Verbose, ("MOZILLA_OFFICIAL build. No JOG for you."));
return false;
#endif
if (sFoundAndLoadedJogfile) {
return sFoundAndLoadedJogfile.value();
}
@ -58,11 +51,12 @@ bool JOG::EnsureRuntimeMetricsRegistered(bool aForce) {
MOZ_LOG(sLog, LogLevel::Debug, ("Determining whether there's JOG for you."));
if (mozilla::IsPackagedBuild()) {
if (!mozilla::StaticPrefs::telemetry_fog_artifact_build()) {
// Supporting Artifact Builds is a developer-only thing.
// We're on the main thread here.
// Let's not spend any more time than we need to.
MOZ_LOG(sLog, LogLevel::Debug, ("IsPackagedBuild. No JOG for you."));
MOZ_LOG(sLog, LogLevel::Debug,
("!telemetry.fog.artifact_build. No JOG for you."));
return false;
}
// The metrics we need to process were placed in GreD in jogfile.json

Просмотреть файл

@ -38,6 +38,13 @@ Present to allow testing without figuring out how to mock Rust's clock.
Their values are integer seconds.
Defaults to 120 (activity), 1200 (inactivity).
## Internal Preferences
`telemetry.fog.artifact_build`
Read-only. This pref is `true` only if `MOZ_ARTIFACT_BUILDS` was set during configure.
If true, [JOG](./jog) is enabled so that artifact builds will exhibit changes to their Glean metrics.
## Defines
`MOZ_AUTOMATION`
@ -72,9 +79,6 @@ This mode can be overridden at runtime in two ways:
then pings are sent to a server operating locally at that port
(even if the ping has a Debug Tag), to enable testing.
Also, if set, [JOG](./jog) is disabled.
Artifact builds will not exhibit changes to their Glean metrics.
`MOZILLA_OFFICIAL` tends to be set on most builds released to users,
including builds distributed by Linux distributions.
It tends to not be set on local developer builds.