mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1309774 - Part 2. Add version number to validation data in sync ping. r=markh
MozReview-Commit-ID: FlDSEsT1ah9 --HG-- extra : rebase_source : 327bcac18dba5c685092e311e2be880b6d616e07
This commit is contained in:
parent
c392f4a9b5
commit
b9e92c7821
@ -22,6 +22,7 @@ function isNodeIgnored(treeNode) {
|
||||
return treeNode.annos && treeNode.annos.some(anno => anno.name == LEFT_PANE_ROOT_ANNO ||
|
||||
anno.name == LEFT_PANE_QUERY_ANNO);
|
||||
}
|
||||
const BOOKMARK_VALIDATOR_VERSION = 1;
|
||||
|
||||
/**
|
||||
* Result of bookmark validation. Contains the following fields which describe
|
||||
@ -763,6 +764,7 @@ class BookmarkValidator {
|
||||
let duration = end-start;
|
||||
return {
|
||||
duration,
|
||||
version: self.version,
|
||||
problems: result.problemData,
|
||||
recordCount: serverRecordCount
|
||||
};
|
||||
@ -771,5 +773,5 @@ class BookmarkValidator {
|
||||
|
||||
};
|
||||
|
||||
|
||||
BookmarkValidator.prototype.version = BOOKMARK_VALIDATOR_VERSION;
|
||||
|
||||
|
@ -199,3 +199,6 @@ class CollectionValidator {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Default to 0, some engines may override.
|
||||
CollectionValidator.prototype.version = 0;
|
||||
|
@ -177,8 +177,9 @@ class EngineRecord {
|
||||
log.error(`Multiple validations occurred for engine ${this.name}!`);
|
||||
return;
|
||||
}
|
||||
let { problems, duration, recordCount } = validationResult;
|
||||
let { problems, version, duration, recordCount } = validationResult;
|
||||
let validation = {
|
||||
version: version || 0,
|
||||
checked: recordCount || 0,
|
||||
};
|
||||
if (duration > 0) {
|
||||
|
@ -106,6 +106,7 @@
|
||||
"checked": { "type": "integer", "minimum": 0 },
|
||||
"failureReason": { "$ref": "#/definitions/error" },
|
||||
"took": { "type": "integer" },
|
||||
"version": { "type": "integer" },
|
||||
"problems": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
|
@ -305,10 +305,13 @@ function validationPing(server, client, duration) {
|
||||
Svc.Obs.notify("weave:service:sync:start");
|
||||
Svc.Obs.notify("weave:engine:sync:start", null, "bookmarks");
|
||||
Svc.Obs.notify("weave:engine:sync:finish", null, "bookmarks");
|
||||
let validator = new BookmarkValidator();
|
||||
let data = {
|
||||
duration, // We fake this just so that we can verify it's passed through.
|
||||
// We fake duration and version just so that we can verify they're passed through.
|
||||
duration,
|
||||
version: validator.version,
|
||||
recordCount: server.length,
|
||||
problems: new BookmarkValidator().compareServerWithClient(server, client).problemData,
|
||||
problems: validator.compareServerWithClient(server, client).problemData,
|
||||
};
|
||||
Svc.Obs.notify("weave:engine:validate:finish", data, "bookmarks");
|
||||
Svc.Obs.notify("weave:service:sync:finish");
|
||||
@ -330,6 +333,7 @@ add_task(function *test_telemetry_integration() {
|
||||
equal(bme.validation.checked, server.length);
|
||||
equal(bme.validation.took, duration);
|
||||
bme.validation.problems.sort((a, b) => String.localeCompare(a.name, b.name));
|
||||
equal(bme.validation.version, new BookmarkValidator().version);
|
||||
deepEqual(bme.validation.problems, [
|
||||
{ name: "badClientRoots", count: 3 },
|
||||
{ name: "sdiff:childGUIDs", count: 1 },
|
||||
|
@ -80,6 +80,8 @@ Structure:
|
||||
// Optional, excluded if it would be empty or if the engine cannot
|
||||
// or did not run validation on itself.
|
||||
validation: {
|
||||
// Optional validator version, default of 0.
|
||||
version: <integer>,
|
||||
checked: <integer>,
|
||||
took: <non-monotonic integer duration in milliseconds>,
|
||||
// Entries with a count of 0 are excluded, the array is excluded if no problems are found.
|
||||
|
Loading…
Reference in New Issue
Block a user