Skip to content

Commit

Permalink
Merge pull request #107 from jpwhite4/error_messages
Browse files Browse the repository at this point in the history
Improve error handling for catastrophe metric
  • Loading branch information
jpwhite4 authored Jul 12, 2018
2 parents 0f882a8 + 9ea1869 commit 6305ff5
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions etl/js/config/supremm/dataset_maps/pcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,39 @@ module.exports = function(config) {
return this.getcov.call(this, job, "cpuperf.cpiref");
}
},
"catastrophe": {
ref: "catastrophe.value"
catastrophe: {
formula: function (job) {
var result = {
value: null,
error: this.metricErrors.codes.metricMissingNotAvailOnThisHost.value
};

if (job.catastrophe) {
if (job.catastrophe.error) {
switch (job.catastrophe.error) {
case 1:
result.error = this.metricErrors.codes.metricDisabledByUser.value;
break;
case 2:
result.error = this.metricErrors.codes.metricInsufficientData.value;
break;
case 6:
result.error = this.metricErrors.codes.metricCounterRollover.value;
break;
default:
result.error = this.metricErrors.codes.metricMissingUnknownReason.value;
break;
}
} else if (Number.isNaN(job.catastrophe.value)) {
result.error = this.metricErrors.codes.metricSummarizationError.value;
} else {
result.value = job.catastrophe.value;
result.error = 0;
}
}

return result;
}
},
"cpldref": {
ref: "cpuperf.cpldref.avg"
Expand Down

0 comments on commit 6305ff5

Please sign in to comment.