зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1566352 - Support 'geckoview_streaming' product for Telemetry r=janerik
This introduces a pref "toolkit.telemetry.isGeckoViewStreaming" to control whether gecko view products (those with "toolkit.telemetry.isGeckoViewMode" set) are of the variety that use the upcoming streaming Telemetry API. Differential Revision: https://phabricator.services.mozilla.com/D38738 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
bdacdef95b
Коммит
a12921a1dd
|
@ -5847,6 +5847,16 @@
|
|||
value: 2000
|
||||
mirror: always
|
||||
|
||||
- name: toolkit.telemetry.isGeckoViewMode
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
- name: toolkit.telemetry.geckoview.streaming
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Prefs starting with "ui."
|
||||
#---------------------------------------------------------------------------
|
||||
|
|
|
@ -28,6 +28,7 @@ SUPPORTED_PRODUCTS = {
|
|||
'firefox': 'Firefox',
|
||||
'fennec': 'Fennec',
|
||||
'geckoview': 'Geckoview',
|
||||
'geckoview_streaming': 'GeckoviewStreaming',
|
||||
}
|
||||
|
||||
SUPPORTED_OPERATING_SYSTEMS = [
|
||||
|
|
|
@ -108,7 +108,6 @@ using mozilla::Telemetry::EventExtraEntry;
|
|||
using mozilla::Telemetry::TelemetryIOInterposeObserver;
|
||||
using Telemetry::Common::AutoHashtable;
|
||||
using Telemetry::Common::GetCurrentProduct;
|
||||
using Telemetry::Common::SetCurrentProduct;
|
||||
using Telemetry::Common::StringHashSet;
|
||||
using Telemetry::Common::SupportedProduct;
|
||||
using Telemetry::Common::ToJSString;
|
||||
|
@ -1193,9 +1192,6 @@ already_AddRefed<nsITelemetry> TelemetryImpl::CreateTelemetryInstance() {
|
|||
}
|
||||
#endif
|
||||
|
||||
// Set current product (determines Fennec/GeckoView at runtime).
|
||||
SetCurrentProduct();
|
||||
|
||||
// First, initialize the TelemetryHistogram and TelemetryScalar global states.
|
||||
TelemetryHistogram::InitializeGlobalState(useTelemetry, useTelemetry);
|
||||
TelemetryScalar::InitializeGlobalState(useTelemetry, useTelemetry);
|
||||
|
@ -1692,16 +1688,6 @@ TelemetryImpl::ClearEvents() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelemetryImpl::ResetCurrentProduct() {
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
SetCurrentProduct();
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_ERROR_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TelemetryImpl::ClearProbes() {
|
||||
#if defined(MOZ_TELEMETRY_GECKOVIEW)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <cstring>
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/StaticPrefs_toolkit.h"
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsITelemetry.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
@ -179,26 +179,20 @@ JSString* ToJSString(JSContext* cx, const nsAString& aStr) {
|
|||
return JS_NewUCStringCopyN(cx, aStr.Data(), aStr.Length());
|
||||
}
|
||||
|
||||
// Keep knowledge about the current running product.
|
||||
// Defaults to Firefox and is reset on Android on Telemetry initialization.
|
||||
SupportedProduct gCurrentProduct = SupportedProduct::Firefox;
|
||||
|
||||
void SetCurrentProduct() {
|
||||
SupportedProduct GetCurrentProduct() {
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
bool isGeckoview =
|
||||
Preferences::GetBool("toolkit.telemetry.isGeckoViewMode", false);
|
||||
if (isGeckoview) {
|
||||
gCurrentProduct = SupportedProduct::Geckoview;
|
||||
if (mozilla::StaticPrefs::toolkit_telemetry_geckoview_streaming()) {
|
||||
return SupportedProduct::GeckoviewStreaming;
|
||||
} else if (mozilla::StaticPrefs::toolkit_telemetry_isGeckoViewMode()) {
|
||||
return SupportedProduct::Geckoview;
|
||||
} else {
|
||||
gCurrentProduct = SupportedProduct::Fennec;
|
||||
return SupportedProduct::Fennec;
|
||||
}
|
||||
#else
|
||||
gCurrentProduct = SupportedProduct::Firefox;
|
||||
return SupportedProduct::Firefox;
|
||||
#endif
|
||||
}
|
||||
|
||||
SupportedProduct GetCurrentProduct() { return gCurrentProduct; }
|
||||
|
||||
} // namespace Common
|
||||
} // namespace Telemetry
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -38,6 +38,7 @@ enum class SupportedProduct : uint8_t {
|
|||
Firefox = (1 << 0),
|
||||
Fennec = (1 << 1),
|
||||
Geckoview = (1 << 2),
|
||||
GeckoviewStreaming = (1 << 3),
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(SupportedProduct);
|
||||
|
||||
|
@ -154,15 +155,8 @@ JSString* ToJSString(JSContext* cx, const nsACString& aStr);
|
|||
JSString* ToJSString(JSContext* cx, const nsAString& aStr);
|
||||
|
||||
/**
|
||||
* Set the current product.
|
||||
*
|
||||
* On Firefox desktop, this method has no effect.
|
||||
* On Android it will determine if it is running Fennec or GeckoView
|
||||
*/
|
||||
void SetCurrentProduct();
|
||||
|
||||
/**
|
||||
* Get an identifier for the current running product.
|
||||
* Get an identifier for the currently-running product.
|
||||
* This is not stable over time and may change.
|
||||
*
|
||||
* @returns the product identifier
|
||||
*/
|
||||
|
|
|
@ -2484,9 +2484,7 @@ void TelemetryHistogram::InitHistogramRecordingEnabled() {
|
|||
mozilla::Telemetry::HistogramID id = mozilla::Telemetry::HistogramID(i);
|
||||
bool canRecordInProcess =
|
||||
CanRecordInProcess(h.record_in_processes, processType);
|
||||
bool canRecordProduct = CanRecordProduct(h.products);
|
||||
internal_SetHistogramRecordingEnabled(
|
||||
locker, id, canRecordInProcess && canRecordProduct);
|
||||
internal_SetHistogramRecordingEnabled(locker, id, canRecordInProcess);
|
||||
}
|
||||
|
||||
for (auto recordingInitiallyDisabledID : kRecordingInitiallyDisabledIDs) {
|
||||
|
|
|
@ -606,12 +606,6 @@ interface nsITelemetry : nsISupports
|
|||
*/
|
||||
void clearEvents();
|
||||
|
||||
/**
|
||||
* Reset the current product. This is intended to be only used in Android tests.
|
||||
* It will fail on Desktop.
|
||||
*/
|
||||
void resetCurrentProduct();
|
||||
|
||||
/**
|
||||
* Get a list of all registered stores.
|
||||
*
|
||||
|
|
|
@ -1104,7 +1104,6 @@ add_task(
|
|||
|
||||
// Fake a geckoview-like environment
|
||||
Services.prefs.setBoolPref("toolkit.telemetry.isGeckoViewMode", true);
|
||||
Telemetry.resetCurrentProduct();
|
||||
|
||||
// Try to set the mobile and multiproduct scalars
|
||||
let expectedValue = 11714;
|
||||
|
@ -1149,6 +1148,5 @@ add_task(
|
|||
|
||||
// Reset to original environment
|
||||
Services.prefs.clearUserPref("toolkit.telemetry.isGeckoViewMode");
|
||||
Telemetry.resetCurrentProduct();
|
||||
}
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче