Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation for rollingCountBadRequests #830

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -86,6 +86,9 @@
* e.g Get Averages from sums, do rate calculation etc.
*/
function preProcessData(data) {
// set defaults for values that may be missing from older streams
setIfMissing(data, "rollingCountBadRequests", 0);
// assert all the values we need
validateData(data);
// escape string used in jQuery & d3 selectors
data.escapedName = data.name.replace(/([ !"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g,'\\$1');
Expand All @@ -94,6 +97,12 @@
calcRatePerSecond(data);
}

function setIfMissing(data, key, defaultValue) {
if(data[key] == undefined) {
data[key] = defaultValue;
}
}

/**
* Since the stream of data can be aggregated from multiple hosts in a tiered manner
* the aggregation just sums everything together and provides us the denominator (reportingHosts)
Expand Down Expand Up @@ -159,6 +168,7 @@
assertNotNull(data,"rollingCountSuccess");
assertNotNull(data,"rollingCountThreadPoolRejected");
assertNotNull(data,"rollingCountTimeout");
assertNotNull(data,"rollingCountBadRequests");
assertNotNull(data,"currentConcurrentExecutionCount");
assertNotNull(data,"latencyExecute_mean");
assertNotNull(data,"latencyExecute");
Expand Down