Bug 1529696 - Rename DATASET_RELEASE_CHANNEL_OPTOUT/OPTIN to DATASET_ALL/PRERELEASE_CHANNELS in Telemetry code r=chutten

Differential Revision: https://phabricator.services.mozilla.com/D25934

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Georg Fritzsche 2019-04-03 16:30:00 +00:00
parent 86ddad7766
commit 4ba158ce96
20 changed files with 86 additions and 87 deletions

View File

@ -316,9 +316,9 @@ class EventData:
"""
rcc = self.dataset_short
if rcc == 'opt-out':
return 'nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT'
return 'nsITelemetry::DATASET_ALL_CHANNELS'
else:
return 'nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN'
return 'nsITelemetry::DATASET_PRERELEASE_CHANNELS'
@property
def dataset_short(self):

View File

@ -663,8 +663,8 @@ the histogram."""
def set_dataset(self, definition):
datasets = {
'opt-in': 'DATASET_RELEASE_CHANNEL_OPTIN',
'opt-out': 'DATASET_RELEASE_CHANNEL_OPTOUT'
'opt-in': 'DATASET_PRERELEASE_CHANNELS',
'opt-out': 'DATASET_ALL_CHANNELS'
}
value = definition.get('releaseChannelCollection', 'opt-in')

View File

@ -316,10 +316,10 @@ class ScalarType:
"""
rcc = self.dataset_short
table = {
'opt-in': 'OPTIN',
'opt-out': 'OPTOUT',
'opt-in': 'DATASET_PRERELEASE_CHANNELS',
'opt-out': 'DATASET_ALL_CHANNELS',
}
return 'nsITelemetry::DATASET_RELEASE_CHANNEL_' + table[rcc]
return 'nsITelemetry::' + table[rcc]
@property
def dataset_short(self):

View File

@ -602,8 +602,8 @@ TelemetryImpl::GetSnapshotForHistograms(const nsACString& aStoreName,
JS::MutableHandleValue aResult) {
NS_NAMED_LITERAL_CSTRING(defaultStore, "main");
unsigned int dataset = mCanRecordExtended
? nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN
: nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT;
? nsITelemetry::DATASET_PRERELEASE_CHANNELS
: nsITelemetry::DATASET_ALL_CHANNELS;
return TelemetryHistogram::CreateHistogramSnapshots(
aCx, aResult, aStoreName.IsVoid() ? defaultStore : aStoreName, dataset,
aClearStore, aFilterTest);
@ -616,8 +616,8 @@ TelemetryImpl::GetSnapshotForKeyedHistograms(const nsACString& aStoreName,
JS::MutableHandleValue aResult) {
NS_NAMED_LITERAL_CSTRING(defaultStore, "main");
unsigned int dataset = mCanRecordExtended
? nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN
: nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT;
? nsITelemetry::DATASET_PRERELEASE_CHANNELS
: nsITelemetry::DATASET_ALL_CHANNELS;
return TelemetryHistogram::GetKeyedHistogramSnapshots(
aCx, aResult, aStoreName.IsVoid() ? defaultStore : aStoreName, dataset,
aClearStore, aFilterTest);
@ -630,8 +630,8 @@ TelemetryImpl::GetSnapshotForScalars(const nsACString& aStoreName,
JS::MutableHandleValue aResult) {
NS_NAMED_LITERAL_CSTRING(defaultStore, "main");
unsigned int dataset = mCanRecordExtended
? nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN
: nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT;
? nsITelemetry::DATASET_PRERELEASE_CHANNELS
: nsITelemetry::DATASET_ALL_CHANNELS;
return TelemetryScalar::CreateSnapshots(
dataset, aClearStore, aCx, 1, aResult, aFilterTest,
aStoreName.IsVoid() ? defaultStore : aStoreName);
@ -644,8 +644,8 @@ TelemetryImpl::GetSnapshotForKeyedScalars(const nsACString& aStoreName,
JS::MutableHandleValue aResult) {
NS_NAMED_LITERAL_CSTRING(defaultStore, "main");
unsigned int dataset = mCanRecordExtended
? nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN
: nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT;
? nsITelemetry::DATASET_PRERELEASE_CHANNELS
: nsITelemetry::DATASET_ALL_CHANNELS;
return TelemetryScalar::CreateKeyedSnapshots(
dataset, aClearStore, aCx, 1, aResult, aFilterTest,
aStoreName.IsVoid() ? defaultStore : aStoreName);

View File

@ -35,8 +35,8 @@ bool IsInDataset(uint32_t aDataset, uint32_t aContainingDataset) {
// The "optin on release channel" dataset is a superset of the
// "optout on release channel one".
if (aContainingDataset == nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN &&
aDataset == nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT) {
if (aContainingDataset == nsITelemetry::DATASET_PRERELEASE_CHANNELS &&
aDataset == nsITelemetry::DATASET_ALL_CHANNELS) {
return true;
}
@ -54,7 +54,7 @@ bool CanRecordDataset(uint32_t aDataset, bool aCanRecordBase,
// If base telemetry data is enabled and we're trying to record base
// telemetry, allow it.
if (aCanRecordBase &&
IsInDataset(aDataset, nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT)) {
IsInDataset(aDataset, nsITelemetry::DATASET_ALL_CHANNELS)) {
return true;
}

View File

@ -320,12 +320,12 @@ unsigned int GetDataset(const StaticMutexAutoLock& lock,
}
if (!gDynamicEventInfo) {
return nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN;
return nsITelemetry::DATASET_PRERELEASE_CHANNELS;
}
return (*gDynamicEventInfo)[eventKey.id].recordOnRelease
? nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT
: nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN;
? nsITelemetry::DATASET_ALL_CHANNELS
: nsITelemetry::DATASET_PRERELEASE_CHANNELS;
}
nsCString GetCategory(const StaticMutexAutoLock& lock,

View File

@ -3157,7 +3157,7 @@ nsresult TelemetryHistogram::SerializeHistograms(mozilla::JSONWriter& aWriter) {
// it was recorded.
if (NS_FAILED(internal_GetHistogramsSnapshot(
locker, NS_LITERAL_CSTRING("main"),
nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN,
nsITelemetry::DATASET_PRERELEASE_CHANNELS,
false /* aClearSubsession */, includeGPUProcess,
false /* aFilterTest */, processHistArray))) {
return NS_ERROR_FAILURE;
@ -3202,7 +3202,7 @@ nsresult TelemetryHistogram::SerializeKeyedHistograms(
// it was recorded.
if (NS_FAILED(internal_GetKeyedHistogramsSnapshot(
locker, NS_LITERAL_CSTRING("main"),
nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN,
nsITelemetry::DATASET_PRERELEASE_CHANNELS,
false /* aClearSubsession */, includeGPUProcess,
false /* aFilterTest */, processHistArray))) {
return NS_ERROR_FAILURE;

View File

@ -169,8 +169,8 @@ struct DynamicScalarInfo : BaseScalarInfo {
const nsTArray<nsCString>& aStores)
: BaseScalarInfo(
aKind,
aRecordOnRelease ? nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT
: nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN,
aRecordOnRelease ? nsITelemetry::DATASET_ALL_CHANNELS
: nsITelemetry::DATASET_PRERELEASE_CHANNELS,
RecordedProcessType::All, aKeyed, GetCurrentProduct(), aBuiltin),
mDynamicName(aName),
mDynamicExpiration(aExpired) {
@ -3672,8 +3672,7 @@ void TelemetryScalar::AddDynamicScalarDefinitions(
// Populate the definitions array before acquiring the lock.
for (auto def : aDefs) {
bool recordOnRelease =
def.dataset == nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT;
bool recordOnRelease = def.dataset == nsITelemetry::DATASET_ALL_CHANNELS;
dynamicStubs.AppendElement(DynamicScalarInfo{def.type,
recordOnRelease,
def.expired,
@ -3733,7 +3732,7 @@ nsresult TelemetryScalar::SerializeScalars(mozilla::JSONWriter& aWriter) {
// For persistence, we care about all the datasets. Worst case, they
// will be empty.
nsresult rv = internal_GetScalarSnapshot(
locker, scalarsToReflect, nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN,
locker, scalarsToReflect, nsITelemetry::DATASET_PRERELEASE_CHANNELS,
false, /*aClearScalars*/
NS_LITERAL_CSTRING("main"));
if (NS_FAILED(rv)) {
@ -3784,7 +3783,7 @@ nsresult TelemetryScalar::SerializeKeyedScalars(mozilla::JSONWriter& aWriter) {
// will be empty.
nsresult rv = internal_GetKeyedScalarSnapshot(
locker, keyedScalarsToReflect,
nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN, false, /*aClearScalars*/
nsITelemetry::DATASET_PRERELEASE_CHANNELS, false, /*aClearScalars*/
NS_LITERAL_CSTRING("main"));
if (NS_FAILED(rv)) {
return rv;

View File

@ -43,12 +43,12 @@ interface nsITelemetry : nsISupports
/**
* Dataset types:
* DATASET_RELEASE_CHANNEL_OPTOUT - the basic dataset that is on-by-default on all channels
* DATASET_RELEASE_CHANNEL_OPTIN - the extended dataset that is opt-in on release,
* DATASET_ALL_CHANNELS - the basic dataset that is on-by-default on all channels
* DATASET_PRERELEASE_CHANNELS - the extended dataset that is opt-in on release,
* opt-out on pre-release channels.
*/
const unsigned long DATASET_RELEASE_CHANNEL_OPTOUT = 0;
const unsigned long DATASET_RELEASE_CHANNEL_OPTIN = 1;
const unsigned long DATASET_ALL_CHANNELS = 0;
const unsigned long DATASET_PRERELEASE_CHANNELS = 1;
/**
@ -516,7 +516,7 @@ interface nsITelemetry : nsISupports
* ...
* ]
*
* @param aDataset DATASET_RELEASE_CHANNEL_OPTOUT or DATASET_RELEASE_CHANNEL_OPTIN.
* @param aDataset DATASET_ALL_CHANNELS or DATASET_PRERELEASE_CHANNELS.
* @param [aClear=false] Whether to clear out the events after snapshotting.
* @param aEventLimit How many events per process to limit the snapshot to contain, all if unspecified.
* Even if aClear, the leftover event records are not cleared.

View File

@ -68,8 +68,8 @@ var TelemetryEventPing = {
_processStartTimestamp: 0,
get dataset() {
return Telemetry.canRecordPrereleaseData ? Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN
: Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT;
return Telemetry.canRecordPrereleaseData ? Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS
: Ci.nsITelemetry.DATASET_ALL_CHANNELS;
},
startup() {

View File

@ -14,7 +14,7 @@ async function waitForProcessesEvents(aProcesses,
aAdditionalCondition = data => true) {
await ContentTaskUtils.waitForCondition(() => {
const events =
Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN);
Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS);
return aProcesses.every(p => Object.keys(events).includes(p))
&& aAdditionalCondition(events);
});
@ -318,7 +318,7 @@ add_task(async function test_hybrid_content_recording() {
// Wait for the data to be in the snapshot, then get the Telemetry data.
await waitForProcessesEvents(["dynamic"]);
let snapshot =
Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN);
Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS);
// Check that the dynamically register events made it to the snapshot.
ok("dynamic" in snapshot,

View File

@ -255,7 +255,7 @@ void GetEventSnapshot(JSContext* aCx, JS::MutableHandle<JS::Value> aResult,
JS::RootedValue eventSnapshot(aCx);
nsresult rv;
rv = telemetry->SnapshotEvents(1 /* OPTIN */, false /* clear */,
rv = telemetry->SnapshotEvents(1 /* PRERELEASE_CHANNELS */, false /* clear */,
0 /* eventLimit */, aCx, 1 /* argc */,
&eventSnapshot);
ASSERT_EQ(rv, NS_OK) << "Snapshotting events must not fail.";

View File

@ -34,7 +34,7 @@ class TestParser(unittest.TestCase):
strict_type_checks=True)
ParserError.exit_func()
self.assertEquals(hist.dataset(), "nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT")
self.assertEquals(hist.dataset(), "nsITelemetry::DATASET_ALL_CHANNELS")
def test_usecounter_histogram(self):
SAMPLE_HISTOGRAM = {

View File

@ -57,7 +57,7 @@ function run_child_test() {
async function waitForContentEvents() {
await ContentTaskUtils.waitForCondition(() => {
const snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
return Object.keys(snapshot).includes("content") &&
Object.keys(snapshot).includes("dynamic");
});
@ -114,7 +114,7 @@ add_task(async function() {
UNRECORDED_PARENT_EVENTS.forEach(e => Telemetry.recordEvent(...e));
let snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
Assert.ok("parent" in snapshot, "Should have main process section");
Assert.ok(snapshot.parent.length > 0, "Main process section should have events.");
@ -156,9 +156,9 @@ add_task(async function() {
// Make sure all events are cleared from storage properly.
snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, true);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, true);
Assert.greaterOrEqual(Object.keys(snapshot).length, 2, "Should have events from at least two processes.");
snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, true);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, true);
Assert.equal(Object.keys(snapshot).length, 0, "Should have cleared all events from storage.");
});

View File

@ -14,7 +14,7 @@ ChromeUtils.import("resource://testing-common/TelemetryArchiveTesting.jsm", this
ChromeUtils.defineModuleGetter(this, "TelemetryEventPing",
"resource://gre/modules/EventPing.jsm");
const OPTIN = Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN;
const PRERELEASE_CHANNELS = Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS;
add_task(async function setup() {
Services.prefs.setBoolPref(TelemetryUtils.Preferences.EventPingEnabled, false);
@ -30,6 +30,6 @@ add_task(async function setup() {
add_task(async function test_EventsNotRecorded() {
Telemetry.recordEvent("telemetry.test", "test1", "object1");
let snapshot = Telemetry.snapshotEvents(OPTIN, true);
let snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(Object.keys(snapshot).length, 0, "Should not have recorded any events.");
});

View File

@ -27,7 +27,7 @@ function run_child_test() {
async function waitForContentEvents() {
await ContentTaskUtils.waitForCondition(() => {
const snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
return Object.keys(snapshot).includes("content");
});
}
@ -81,7 +81,7 @@ add_task(async function test_setup() {
await waitForContentEvents();
let snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
Assert.ok(("parent" in snapshot), "Should have parent events in the snapshot.");
Assert.ok(("content" in snapshot), "Should have content events in the snapshot.");

View File

@ -5,8 +5,8 @@
ChromeUtils.defineModuleGetter(this, "TestUtils", "resource://testing-common/TestUtils.jsm");
const { TelemetryTestUtils } = ChromeUtils.import("resource://testing-common/TelemetryTestUtils.jsm");
const OPTIN = Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN;
const OPTOUT = Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTOUT;
const PRERELEASE_CHANNELS = Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS;
const ALL_CHANNELS = Ci.nsITelemetry.DATASET_ALL_CHANNELS;
function checkEventFormat(events) {
Assert.ok(Array.isArray(events), "Events should be serialized to an array.");
@ -234,12 +234,12 @@ add_task(async function test_recording() {
};
// Check that the expected events were recorded.
let snapshot = Telemetry.snapshotEvents(OPTIN, false);
let snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, false);
Assert.ok(("parent" in snapshot), "Should have entry for main process.");
checkEvents(snapshot.parent, expected);
// Check serializing only opt-out events.
snapshot = Telemetry.snapshotEvents(OPTOUT, false);
snapshot = Telemetry.snapshotEvents(ALL_CHANNELS, false);
Assert.ok(("parent" in snapshot), "Should have entry for main process.");
let filtered = expected.filter(e => !!e.optout);
checkEvents(snapshot.parent, filtered);
@ -256,30 +256,30 @@ add_task(async function test_clear() {
// Check that events were recorded.
// The events are cleared by passing the respective flag.
let snapshot = Telemetry.snapshotEvents(OPTIN, true);
let snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.ok(("parent" in snapshot), "Should have entry for main process.");
Assert.equal(snapshot.parent.length, 2 * COUNT, `Should have recorded ${2 * COUNT} events.`);
// Now the events should be cleared.
snapshot = Telemetry.snapshotEvents(OPTIN, false);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, false);
Assert.equal(Object.keys(snapshot).length, 0, `Should have cleared the events.`);
for (let i = 0; i < COUNT; ++i) {
Telemetry.recordEvent("telemetry.test", "test1", "object1");
Telemetry.recordEvent("telemetry.test.second", "test", "object1");
}
snapshot = Telemetry.snapshotEvents(OPTIN, true, 5);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true, 5);
Assert.ok(("parent" in snapshot), "Should have entry for main process.");
Assert.equal(snapshot.parent.length, 5, "Should have returned 5 events");
snapshot = Telemetry.snapshotEvents(OPTIN, false);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, false);
Assert.ok(("parent" in snapshot), "Should have entry for main process.");
Assert.equal(snapshot.parent.length, (2 * COUNT) - 5, `Should have returned ${(2 * COUNT) - 5} events`);
Telemetry.recordEvent("telemetry.test", "test1", "object1");
snapshot = Telemetry.snapshotEvents(OPTIN, false, 5);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, false, 5);
Assert.ok(("parent" in snapshot), "Should have entry for main process.");
Assert.equal(snapshot.parent.length, 5, "Should have returned 5 events");
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.ok(("parent" in snapshot), "Should have entry for main process.");
Assert.equal(snapshot.parent.length, (2 * COUNT) - 5 + 1, `Should have returned ${(2 * COUNT) - 5 + 1} events`);
});
@ -290,7 +290,7 @@ add_task(async function test_expiry() {
// Recording call with event that is expired by version.
Telemetry.recordEvent("telemetry.test", "expired_version", "object1");
checkRecordingFailure(1 /* Expired */);
let snapshot = Telemetry.snapshotEvents(OPTIN, true);
let snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(Object.keys(snapshot).length, 0, "Should not record event with expired version.");
// Recording call with event that has expiry_version set into the future.
@ -303,25 +303,25 @@ add_task(async function test_invalidParams() {
// Recording call with wrong type for value argument.
Telemetry.recordEvent("telemetry.test", "test1", "object1", 1);
let snapshot = Telemetry.snapshotEvents(OPTIN, true);
let snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(Object.keys(snapshot).length, 0, "Should not record event when value argument with invalid type is passed.");
checkRecordingFailure(3 /* Value */);
// Recording call with wrong type for extra argument.
Telemetry.recordEvent("telemetry.test", "test1", "object1", null, "invalid");
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(Object.keys(snapshot).length, 0, "Should not record event when extra argument with invalid type is passed.");
checkRecordingFailure(4 /* Extra */);
// Recording call with unknown extra key.
Telemetry.recordEvent("telemetry.test", "test1", "object1", null, {"key3": "x"});
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(Object.keys(snapshot).length, 0, "Should not record event when extra argument with invalid key is passed.");
checkRecordingFailure(2 /* ExtraKey */);
// Recording call with invalid value type.
Telemetry.recordEvent("telemetry.test", "test1", "object1", null, {"key3": 1});
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(Object.keys(snapshot).length, 0, "Should not record event when extra argument with invalid value type is passed.");
checkRecordingFailure(4 /* Extra */);
});
@ -341,7 +341,7 @@ add_task(async function test_storageLimit() {
Assert.ok(true, "Topic was notified when event limit was reached");
// Check that the right events were recorded.
let snapshot = Telemetry.snapshotEvents(OPTIN, true);
let snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.ok(("parent" in snapshot), "Should have entry for main process.");
let events = snapshot.parent;
Assert.equal(events.length, COUNT, `Should have only recorded all ${COUNT} events`);
@ -449,7 +449,7 @@ add_task(async function test_dynamicEvents() {
checkRecordingFailure(0 /* UnknownEvent */);
// Now check that the snapshot contains the expected data.
let snapshot = Telemetry.snapshotEvents(OPTIN, false);
let snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, false);
Assert.ok(("dynamic" in snapshot), "Should have dynamic events in the snapshot.");
let expected = [
@ -470,7 +470,7 @@ add_task(async function test_dynamicEvents() {
checkEventSummary(expected.map(ev => ["dynamic", ev, 1]), true);
// Check that the opt-out snapshot contains only the one expected event.
snapshot = Telemetry.snapshotEvents(OPTOUT, false);
snapshot = Telemetry.snapshotEvents(ALL_CHANNELS, false);
Assert.ok(("dynamic" in snapshot), "Should have dynamic events in the snapshot.");
Assert.equal(snapshot.dynamic.length, 1, "Should have one opt-out event in the snapshot.");
expected = ["telemetry.test.dynamic", "test4", "object1"];
@ -480,12 +480,12 @@ add_task(async function test_dynamicEvents() {
Telemetry.clearEvents();
Telemetry.recordEvent("telemetry.test.dynamic", "test1", "object1", null, {"key1": "foo"});
Telemetry.recordEvent("telemetry.test.dynamic", "test2", "object1", null, {"key1": "foo", "unknown": "bar"});
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.ok(!("dynamic" in snapshot), "Should have not recorded dynamic events with unknown extra keys.");
// Other built-in events should not show up in the "dynamic" bucket of the snapshot.
Telemetry.recordEvent("telemetry.test", "test1", "object1");
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.ok(!("dynamic" in snapshot), "Should have not recorded built-in event into dynamic bucket.");
// Test that recording opt-in and opt-out events works as expected.
@ -499,7 +499,7 @@ add_task(async function test_dynamicEvents() {
// Only "test4" should have been recorded.
["telemetry.test.dynamic", "test4", "object1"],
];
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(snapshot.dynamic.length, 1, "Should have one opt-out event in the snapshot.");
Assert.deepEqual(snapshot.dynamic.map(e => e.slice(1)), expected);
});
@ -661,7 +661,7 @@ add_task(async function test_dynamicEventRegisterAgain() {
];
expected.forEach(e => Telemetry.recordEvent(...e));
let snapshot = Telemetry.snapshotEvents(OPTIN, true);
let snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(snapshot.dynamic.length, expected.length,
"Should have right number of events in the snapshot.");
Assert.deepEqual(snapshot.dynamic.map(e => e.slice(1)), expected);
@ -670,7 +670,7 @@ add_task(async function test_dynamicEventRegisterAgain() {
Telemetry.registerEvents(category, events);
Telemetry.recordEvent(category, "test1", "object1");
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(snapshot.dynamic.length, expected.length,
"Should have right number of events in the snapshot.");
Assert.deepEqual(snapshot.dynamic.map(e => e.slice(1)), expected);
@ -688,7 +688,7 @@ add_task(async function test_dynamicEventRegisterAgain() {
];
expected.forEach(e => Telemetry.recordEvent(...e));
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(snapshot.dynamic.length, expected.length,
"Should have right number of events in the snapshot.");
Assert.deepEqual(snapshot.dynamic.map(e => e.slice(1)), expected);
@ -706,7 +706,7 @@ add_task(async function test_dynamicEventRegisterAgain() {
];
expected.forEach(e => Telemetry.recordEvent(...e));
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(snapshot.dynamic.length, expected.length,
"Should have right number of events in the snapshot.");
Assert.deepEqual(snapshot.dynamic.map(e => e.slice(1)), expected);
@ -720,7 +720,7 @@ add_task(async function test_dynamicEventRegisterAgain() {
];
expected.forEach(e => Telemetry.recordEvent(...e));
snapshot = Telemetry.snapshotEvents(OPTIN, true);
snapshot = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true);
Assert.equal(snapshot.dynamic.length, expected.length,
"Should have right number of events in the snapshot.");
Assert.deepEqual(snapshot.dynamic.map(e => e.slice(1)), expected);
@ -746,7 +746,7 @@ async function test_productSpecificEvents() {
// Try to record the mobile-only event
Telemetry.recordEvent(EVENT_CATEGORY, MOBILE_ONLY_EVENT, "object1");
let events = Telemetry.snapshotEvents(OPTIN, true).parent;
let events = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true).parent;
let expected = [
[EVENT_CATEGORY, DEFAULT_PRODUCTS_EVENT, "object1"],
@ -780,7 +780,7 @@ async function test_mobileSpecificEvents() {
// Try to record the mobile-only event
Telemetry.recordEvent(EVENT_CATEGORY, DESKTOP_ONLY_EVENT, "object1");
let events = Telemetry.snapshotEvents(OPTIN, true).parent;
let events = Telemetry.snapshotEvents(PRERELEASE_CHANNELS, true).parent;
let expected = [
[EVENT_CATEGORY, DEFAULT_PRODUCTS_EVENT, "object1"],

View File

@ -118,7 +118,7 @@ add_task({
// Check the values we tried to store.
const snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
Assert.ok(("parent" in snapshot), "Should have parent events in the snapshot.");
let expected = [
@ -169,7 +169,7 @@ add_task(async function test_dynamicBuiltinEvents() {
{"key2": "bar"});
// Now check that the snapshot contains the expected data.
let snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
Assert.ok(("parent" in snapshot), "Should have parent events in the snapshot.");
let expected = [
@ -206,7 +206,7 @@ add_task(async function test_dynamicBuiltinEventsDisabledByDefault() {
// Now check that the snapshot contains the expected data.
let snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
Assert.ok(!("parent" in snapshot), "Should not have parent events in the snapshot.");
// Now enable the category and record again
@ -214,7 +214,7 @@ add_task(async function test_dynamicBuiltinEventsDisabledByDefault() {
Telemetry.recordEvent(TEST_EVENT_NAME, "test1", "object1");
snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
Assert.ok(("parent" in snapshot), "Should have parent events in the snapshot.");
let expected = [
@ -253,7 +253,7 @@ add_task(async function test_dynamicBuiltinDontOverwriteStaticData() {
Telemetry.recordEvent(TEST_EVENT_NAME, "dynamic", "anotherone");
let snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
Assert.ok(("parent" in snapshot), "Should have parent events in the snapshot.");
// All events should now be recorded in the right order
@ -303,7 +303,7 @@ add_task(async function test_dynamicBuiltinEventsOverridingStatic() {
{"key1": "foo"});
// Now check that the snapshot contains the expected data.
let snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
Assert.ok(("parent" in snapshot), "Should have parent events in the snapshot.");
let expected = [
@ -356,7 +356,7 @@ add_task(async function test_realDynamicDontOverwrite() {
{"key1": "foo"});
// Now check that the snapshot contains the expected data.
let snapshot =
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
Telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, false);
Assert.ok(("parent" in snapshot), "Should have parent events in the snapshot.");
let expected = [

View File

@ -60,8 +60,8 @@ var TelemetryTestUtils = {
* @returns {Object} The snapshotted scalars from the parent process.
*/
getProcessScalars(aProcessName, aKeyed = false, aClear = false,
aChannel = Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN) {
const extended = aChannel == Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN;
aChannel = Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS) {
const extended = aChannel == Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS;
const currentExtended = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = extended;
const scalars = aKeyed ?
@ -110,7 +110,7 @@ var TelemetryTestUtils = {
*/
assertEvents(expectedEvents, filter = {}, {clear = true, process = "parent"} = {}) {
// Step 0: Snapshot and clear.
let snapshots = Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, clear);
let snapshots = Services.telemetry.snapshotEvents(Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS, clear);
if (expectedEvents.length === 0 && !(process in snapshots)) {
// Job's done!
return;

View File

@ -416,7 +416,7 @@ var PingPicker = {
delete ping.payload.keyedHistograms;
// augment ping payload with event telemetry
let eventSnapshot = Telemetry.snapshotEvents(Telemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
let eventSnapshot = Telemetry.snapshotEvents(Telemetry.DATASET_PRERELEASE_CHANNELS, false);
for (let process of Object.keys(eventSnapshot)) {
if (process in ping.payload.processes) {
ping.payload.processes[process].events = eventSnapshot[process].filter(e => !e[1].startsWith("telemetry.test"));