diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod/map.js new file mode 100644 index 0000000..1f5217e --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod/map.js @@ -0,0 +1,34 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost/map.js new file mode 100644 index 0000000..6069de7 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.callerHost); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__consumerId/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__consumerId/map.js new file mode 100644 index 0000000..02e62ce --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__consumerId/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.consumerId); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__consumerId/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__consumerId/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__consumerId/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__host/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__host/map.js new file mode 100644 index 0000000..2ef846e --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__host/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.host); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__host/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__host/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__host/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__operationResult/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__operationResult/map.js new file mode 100644 index 0000000..dd6a75d --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__operationResult/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.operationResult); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__operationResult/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__operationResult/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__operationResult/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceClass/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceClass/map.js new file mode 100644 index 0000000..d08540c --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceClass/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.serviceClass); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceClass/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceClass/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceClass/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceName/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceName/map.js new file mode 100644 index 0000000..75a0873 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceName/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceName/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__callerHost__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId/map.js new file mode 100644 index 0000000..9d4f268 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.consumerId); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__host/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__host/map.js new file mode 100644 index 0000000..8b1df31 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__host/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.consumerId); + propertiesKey.push(doc.host); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__host/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__host/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__host/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__operationResult/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__operationResult/map.js new file mode 100644 index 0000000..3948a01 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__operationResult/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.consumerId); + propertiesKey.push(doc.operationResult); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__operationResult/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__operationResult/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__operationResult/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceClass/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceClass/map.js new file mode 100644 index 0000000..17e555b --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceClass/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.consumerId); + propertiesKey.push(doc.serviceClass); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceClass/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceClass/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceClass/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceName/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceName/map.js new file mode 100644 index 0000000..c55be5f --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceName/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.consumerId); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceName/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__consumerId__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__host/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__host/map.js new file mode 100644 index 0000000..db8c0a9 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__host/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.host); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__host/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__host/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__host/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__host__operationResult/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__operationResult/map.js new file mode 100644 index 0000000..6351462 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__operationResult/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.host); + propertiesKey.push(doc.operationResult); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__host__operationResult/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__operationResult/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__operationResult/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceClass/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceClass/map.js new file mode 100644 index 0000000..7d25df6 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceClass/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.host); + propertiesKey.push(doc.serviceClass); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceClass/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceClass/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceClass/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceName/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceName/map.js new file mode 100644 index 0000000..3e8e0ef --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceName/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.host); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceName/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__host__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult/map.js new file mode 100644 index 0000000..eb77d48 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.operationResult); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceClass/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceClass/map.js new file mode 100644 index 0000000..a83559a --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceClass/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.operationResult); + propertiesKey.push(doc.serviceClass); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceClass/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceClass/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceClass/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceName/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceName/map.js new file mode 100644 index 0000000..d97d385 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceName/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.operationResult); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceName/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__operationResult__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass/map.js new file mode 100644 index 0000000..247d749 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.serviceClass); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass__serviceName/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass__serviceName/map.js new file mode 100644 index 0000000..c531fd4 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass__serviceName/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.serviceClass); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass__serviceName/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceClass__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceName/map.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceName/map.js new file mode 100644 index 0000000..7ef77f2 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceName/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.calledMethod); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceName/reduce.js b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CalledMethod/calledMethod__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost/map.js b/src/main/resources/MapReduce/CallerHost/callerHost/map.js new file mode 100644 index 0000000..368b5d3 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost/map.js @@ -0,0 +1,34 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__consumerId/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId/map.js new file mode 100644 index 0000000..6d97fe0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.consumerId); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__consumerId/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__host/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__host/map.js new file mode 100644 index 0000000..522238e --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__host/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.consumerId); + propertiesKey.push(doc.host); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__host/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__host/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__host/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__operationResult/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__operationResult/map.js new file mode 100644 index 0000000..af04727 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__operationResult/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.consumerId); + propertiesKey.push(doc.operationResult); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__operationResult/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__operationResult/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__operationResult/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceClass/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceClass/map.js new file mode 100644 index 0000000..3054e5f --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceClass/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.consumerId); + propertiesKey.push(doc.serviceClass); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceClass/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceClass/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceClass/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceName/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceName/map.js new file mode 100644 index 0000000..6903ea9 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceName/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.consumerId); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceName/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__consumerId__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__host/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__host/map.js new file mode 100644 index 0000000..eb45993 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__host/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.host); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__host/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__host/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__host/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__host__operationResult/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__host__operationResult/map.js new file mode 100644 index 0000000..8815a16 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__host__operationResult/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.host); + propertiesKey.push(doc.operationResult); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__host__operationResult/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__host__operationResult/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__host__operationResult/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceClass/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceClass/map.js new file mode 100644 index 0000000..e3e4b53 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceClass/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.host); + propertiesKey.push(doc.serviceClass); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceClass/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceClass/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceClass/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceName/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceName/map.js new file mode 100644 index 0000000..c44ebd4 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceName/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.host); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceName/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__host__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__operationResult/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult/map.js new file mode 100644 index 0000000..626dd33 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.operationResult); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__operationResult/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceClass/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceClass/map.js new file mode 100644 index 0000000..252eb4a --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceClass/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.operationResult); + propertiesKey.push(doc.serviceClass); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceClass/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceClass/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceClass/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceName/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceName/map.js new file mode 100644 index 0000000..cb3fb44 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceName/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.operationResult); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceName/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__operationResult__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass/map.js new file mode 100644 index 0000000..cbf7063 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.serviceClass); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass__serviceName/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass__serviceName/map.js new file mode 100644 index 0000000..f098745 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass__serviceName/map.js @@ -0,0 +1,36 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.serviceClass); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass__serviceName/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__serviceClass__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__serviceName/map.js b/src/main/resources/MapReduce/CallerHost/callerHost__serviceName/map.js new file mode 100644 index 0000000..696c3cb --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__serviceName/map.js @@ -0,0 +1,35 @@ +function(doc,meta) { + if(doc.usageRecordType == "ServiceUsageRecord" || doc.recordType == "ServiceUsageRecord"){ + if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){ + emit([0, "Invalid Value", doc.id], doc); + return; + } + + var data = {}; + data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1; + data.duration = doc.duration ? Number(doc.duration) : 1; + data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration; + data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration; + + var propertiesKey = []; + propertiesKey.push(doc.callerHost); + propertiesKey.push(doc.serviceName); + + + var timestamp=Number(doc.creationTime); + var date = new Date(timestamp); + var dataKey = []; + dataKey.push(date.getUTCFullYear()); + dataKey.push(date.getUTCMonth()+1); + dataKey.push(date.getUTCDate()); + dataKey.push(date.getUTCHours()); + dataKey.push(date.getUTCMinutes()); +// dataKey.push(date.getUTCSeconds()); +// dataKey.push(date.getUTCMilliseconds()); + var finalKey = propertiesKey.concat(dataKey); + + finalKey.unshift(doc.scope); + + emit(finalKey, data); + } +} diff --git a/src/main/resources/MapReduce/CallerHost/callerHost__serviceName/reduce.js b/src/main/resources/MapReduce/CallerHost/callerHost__serviceName/reduce.js new file mode 100644 index 0000000..64dd2b0 --- /dev/null +++ b/src/main/resources/MapReduce/CallerHost/callerHost__serviceName/reduce.js @@ -0,0 +1,24 @@ +function(keys, values, rereduce){ + var maxInvocationTime = Number(values[0].maxInvocationTime); + var minInvocationTime = Number(values[0].minInvocationTime); + var total = 0; + var numerator = 0; + for(i=0; i=values[i].minInvocationTime){ + minInvocationTime = values[i].minInvocationTime; + } + } + + ret = {}; + ret.operationCount = Number(total); + ret.duration = Number(numerator)/Number(total); + ret.maxInvocationTime = Number(maxInvocationTime); + ret.minInvocationTime = Number(minInvocationTime); + + return ret; +} \ No newline at end of file