upgraded map reduce
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/GenerateMapReduceCouchbase@154904 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a59a83132c
commit
c02eeee604
|
@ -13,7 +13,7 @@ function(doc,meta) {
|
|||
|
||||
var propertiesKey = [];
|
||||
propertiesKey.push(doc.consumerId);
|
||||
propertiesKey.push(doc.jobId);
|
||||
propertiesKey.push(doc.jobName);
|
||||
|
||||
var timestamp=Number(doc.creationTime);
|
||||
|
|
@ -13,7 +13,7 @@ function(doc,meta) {
|
|||
|
||||
var propertiesKey = [];
|
||||
propertiesKey.push(doc.consumerId);
|
||||
propertiesKey.push(doc.jobId);
|
||||
propertiesKey.push(doc.jobName);
|
||||
propertiesKey.push(doc.operationResult);
|
||||
|
||||
var timestamp=Number(doc.creationTime);
|
|
@ -12,7 +12,7 @@ function(doc,meta) {
|
|||
data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration;
|
||||
|
||||
var propertiesKey = [];
|
||||
propertiesKey.push(doc.jobId);
|
||||
propertiesKey.push(doc.jobName);
|
||||
|
||||
var timestamp=Number(doc.creationTime);
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "TaskUsageRecord" || doc.recordType == "TaskUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc._wallDuration && isNaN(Number(doc._wallDuration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = {};
|
||||
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
data.duration = doc.duration ? Number(doc._wallDuration) : 1;
|
||||
data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration;
|
||||
data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration;
|
||||
|
||||
var propertiesKey = [];
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "TaskUsageRecord" || doc.recordType == "TaskUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc._wallDuration && isNaN(Number(doc._wallDuration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = {};
|
||||
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
data.duration = doc.duration ? Number(doc._wallDuration) : 1;
|
||||
data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration;
|
||||
data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration;
|
||||
|
||||
var propertiesKey = [];
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
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.length; i++){
|
||||
total += Number(values[i].operationCount);
|
||||
numerator += Number(values[i].operationCount) * Number(values[i].duration);
|
||||
if(maxInvocationTime<=values[i].maxInvocationTime){
|
||||
maxInvocationTime = values[i].maxInvocationTime;
|
||||
}
|
||||
if(minInvocationTime>=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;
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "TaskUsageRecord" || doc.recordType == "TaskUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc._wallDuration && isNaN(Number(doc._wallDuration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = {};
|
||||
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
data.duration = doc.duration ? Number(doc._wallDuration) : 1;
|
||||
data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration;
|
||||
data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration;
|
||||
|
||||
var propertiesKey = [];
|
||||
propertiesKey.push(doc.consumerId);
|
||||
propertiesKey.push(doc.operationResult);
|
||||
propertiesKey.push(doc.taskId);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
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.length; i++){
|
||||
total += Number(values[i].operationCount);
|
||||
numerator += Number(values[i].operationCount) * Number(values[i].duration);
|
||||
if(maxInvocationTime<=values[i].maxInvocationTime){
|
||||
maxInvocationTime = values[i].maxInvocationTime;
|
||||
}
|
||||
if(minInvocationTime>=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;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "TaskUsageRecord" || doc.recordType == "TaskUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc._wallDuration && isNaN(Number(doc._wallDuration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = {};
|
||||
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
data.duration = doc.duration ? Number(doc._wallDuration) : 1;
|
||||
data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration;
|
||||
data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration;
|
||||
|
||||
var propertiesKey = [];
|
||||
propertiesKey.push(doc.consumerId);
|
||||
propertiesKey.push(doc.taskId);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
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.length; i++){
|
||||
total += Number(values[i].operationCount);
|
||||
numerator += Number(values[i].operationCount) * Number(values[i].duration);
|
||||
if(maxInvocationTime<=values[i].maxInvocationTime){
|
||||
maxInvocationTime = values[i].maxInvocationTime;
|
||||
}
|
||||
if(minInvocationTime>=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;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "TaskUsageRecord" || doc.recordType == "TaskUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc._wallDuration && isNaN(Number(doc._wallDuration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = {};
|
||||
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
data.duration = doc.duration ? Number(doc._wallDuration) : 1;
|
||||
data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration;
|
||||
data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration;
|
||||
|
||||
var propertiesKey = [];
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
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.length; i++){
|
||||
total += Number(values[i].operationCount);
|
||||
numerator += Number(values[i].operationCount) * Number(values[i].duration);
|
||||
if(maxInvocationTime<=values[i].maxInvocationTime){
|
||||
maxInvocationTime = values[i].maxInvocationTime;
|
||||
}
|
||||
if(minInvocationTime>=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;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "TaskUsageRecord" || doc.recordType == "TaskUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc._wallDuration && isNaN(Number(doc._wallDuration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = {};
|
||||
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
data.duration = doc.duration ? Number(doc._wallDuration) : 1;
|
||||
data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration;
|
||||
data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration;
|
||||
|
||||
var propertiesKey = [];
|
||||
propertiesKey.push(doc.operationResult);
|
||||
propertiesKey.push(doc.taskId);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
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.length; i++){
|
||||
total += Number(values[i].operationCount);
|
||||
numerator += Number(values[i].operationCount) * Number(values[i].duration);
|
||||
if(maxInvocationTime<=values[i].maxInvocationTime){
|
||||
maxInvocationTime = values[i].maxInvocationTime;
|
||||
}
|
||||
if(minInvocationTime>=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;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "TaskUsageRecord" || doc.recordType == "TaskUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc._wallDuration && isNaN(Number(doc._wallDuration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
|
||||
var data = {};
|
||||
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
data.duration = doc.duration ? Number(doc._wallDuration) : 1;
|
||||
data.maxInvocationTime = doc.maxInvocationTime ? Number(doc.maxInvocationTime) : data.duration;
|
||||
data.minInvocationTime = doc.minInvocationTime ? Number(doc.minInvocationTime) : data.duration;
|
||||
|
||||
var propertiesKey = [];
|
||||
propertiesKey.push(doc.taskId);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
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.length; i++){
|
||||
total += Number(values[i].operationCount);
|
||||
numerator += Number(values[i].operationCount) * Number(values[i].duration);
|
||||
if(maxInvocationTime<=values[i].maxInvocationTime){
|
||||
maxInvocationTime = values[i].maxInvocationTime;
|
||||
}
|
||||
if(minInvocationTime>=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;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data.jobName = doc.jobName;
|
||||
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
data.serviceClass = doc.serviceClass;
|
||||
data.creationTime = doc.creationTime;
|
||||
|
||||
var callerQualifier=doc.callerQualifier ? (doc.callerQualifier) : "UNKNOWN";
|
||||
data.callerQualifier=callerQualifier;
|
||||
|
||||
data.recordType = doc.recordType;
|
||||
data.consumerId = doc.consumerId;
|
||||
data.aggregated = doc.aggregated;
|
||||
data.serviceName = doc.serviceName;
|
||||
data.duration = doc.duration ? Number(doc.duration) : 1;
|
||||
data.maxInvocationTime = doc.maxInvocationTime ? doc.maxInvocationTime : data.duration;
|
||||
data.scope = doc.scope;
|
||||
data.host = doc.host;
|
||||
data.startTime = doc.startTime;
|
||||
data.id = doc.id;
|
||||
data.endTime = doc.endTime;
|
||||
data.minInvocationTime = doc.minInvocationTime ? doc.minInvocationTime : data.duration;
|
||||
data.operationResult = doc.operationResult;
|
||||
|
||||
data._rev = doc._rev;
|
||||
data._id = doc._id;
|
||||
|
||||
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());
|
||||
emit(dataKey, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data.jobName = doc.jobName;
|
||||
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
data.serviceClass = doc.serviceClass;
|
||||
data.creationTime = doc.creationTime;
|
||||
|
||||
var callerQualifier=doc.callerQualifier ? (doc.callerQualifier) : "UNKNOWN";
|
||||
data.callerQualifier=callerQualifier;
|
||||
|
||||
data.recordType = doc.recordType;
|
||||
data.consumerId = doc.consumerId;
|
||||
data.aggregated = doc.aggregated;
|
||||
data.serviceName = doc.serviceName;
|
||||
data.duration = doc.duration ? Number(doc.duration) : 1;
|
||||
data.maxInvocationTime = doc.maxInvocationTime ? doc.maxInvocationTime : data.duration;
|
||||
data.scope = doc.scope;
|
||||
data.host = doc.host;
|
||||
data.startTime = doc.startTime;
|
||||
data.id = doc.id;
|
||||
data.endTime = doc.endTime;
|
||||
data.minInvocationTime = doc.minInvocationTime ? doc.minInvocationTime : data.duration;
|
||||
data.operationResult = doc.operationResult;
|
||||
|
||||
data._rev = doc._rev;
|
||||
data._id = doc._id;
|
||||
|
||||
var timestamp = Number(doc.creationTime);
|
||||
var date = new Date(timestamp);
|
||||
var dataKey = [];
|
||||
dataKey.push(doc.scope);
|
||||
dataKey.push(date.getUTCFullYear());
|
||||
dataKey.push(date.getUTCMonth()+1);
|
||||
dataKey.push(date.getUTCDate());
|
||||
dataKey.push(date.getUTCHours());
|
||||
dataKey.push(date.getUTCMinutes());
|
||||
emit(dataKey, data);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
function(doc,meta) {
|
||||
var emitKey = [];
|
||||
emitKey.push(doc.scope);
|
||||
emitKey.push(doc.jobName);
|
||||
emit(emitKey, doc.jobName);
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
function(keys, values, rereduce){
|
||||
return values[0];
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || 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 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.unshift(doc.scope);
|
||||
emit(dataKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
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 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());
|
||||
emit(dataKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
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.jobName);
|
||||
|
||||
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
var document=doc.callerQualifier ? doc.callerQualifier :"UNKNOWN"
|
||||
data[document] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data[doc.consumerId] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data[doc.consumerId] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.operationResult);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data[doc.consumerId] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.serviceClass);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data[doc.consumerId] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.serviceName);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data[doc.host] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data[doc.host] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.serviceClass);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data[doc.jobName] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data[doc.operationResult] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data[doc.serviceClass] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
function(doc,meta) {
|
||||
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
|
||||
if((doc.operationCount && isNaN(Number(doc.operationCount))) || (doc.duration && isNaN(Number(doc.duration)))){
|
||||
emit([0, "Invalid Value", doc.id], doc);
|
||||
return;
|
||||
}
|
||||
var data = {};
|
||||
data[doc.serviceName] = doc.operationCount ? Number(doc.operationCount) : 1;
|
||||
var propertiesKey = [];
|
||||
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());
|
||||
var finalKey = propertiesKey.concat(dataKey);
|
||||
finalKey.unshift(doc.scope);
|
||||
emit(finalKey, data);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
function(doc,meta) {
|
||||
var emitKey = [];
|
||||
emitKey.push(doc.scope);
|
||||
var callerQualifier=doc.callerQualifier ? (doc.callerQualifier) : "UNKNOWN";
|
||||
emitKey.push(callerQualifier);
|
||||
emit(emitKey, callerQualifier);
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
function(keys, values, rereduce){
|
||||
return values[0];
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
function(doc,meta) {
|
||||
var emitKey = [];
|
||||
emitKey.push(doc.scope);
|
||||
emitKey.push(doc.consumerId);
|
||||
emit(emitKey, doc.consumerId);
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
function(keys, values, rereduce){
|
||||
return values[0];
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
function(doc,meta) {
|
||||
var emitKey = [];
|
||||
emitKey.push(doc.scope);
|
||||
emitKey.push(doc.host);
|
||||
emit(emitKey, doc.host);
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
function(keys, values, rereduce){
|
||||
return values[0];
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
function(doc,meta) {
|
||||
var emitKey = [];
|
||||
emitKey.push(doc.scope);
|
||||
emitKey.push(doc.operationResult);
|
||||
emit(emitKey, doc.operationResult);
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
function(keys, values, rereduce){
|
||||
return values[0];
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
function(doc,meta) {
|
||||
var emitKey = [];
|
||||
emitKey.push(doc.scope);
|
||||
emitKey.push(doc.serviceClass);
|
||||
emit(emitKey, doc.serviceClass);
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
function(keys, values, rereduce){
|
||||
return values[0];
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
function(doc,meta) {
|
||||
var emitKey = [];
|
||||
emitKey.push(doc.scope);
|
||||
emitKey.push(doc.serviceName);
|
||||
emit(emitKey, doc.serviceName);
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
function(keys, values, rereduce){
|
||||
return values[0];
|
||||
|
||||
}
|
|
@ -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.length; i++){
|
||||
total += Number(values[i].operationCount);
|
||||
numerator += Number(values[i].operationCount) * Number(values[i].duration);
|
||||
if(maxInvocationTime<=values[i].maxInvocationTime){
|
||||
maxInvocationTime = values[i].maxInvocationTime;
|
||||
}
|
||||
if(minInvocationTime>=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;
|
||||
}
|
|
@ -19,6 +19,6 @@ function(keys, values, rereduce){
|
|||
ret.duration = Number(numerator)/Number(total);
|
||||
ret.maxInvocationTime = Number(maxInvocationTime);
|
||||
ret.minInvocationTime = Number(minInvocationTime);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -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.length; i++){
|
||||
total += Number(values[i].operationCount);
|
||||
numerator += Number(values[i].operationCount) * Number(values[i].duration);
|
||||
if(maxInvocationTime<=values[i].maxInvocationTime){
|
||||
maxInvocationTime = values[i].maxInvocationTime;
|
||||
}
|
||||
if(minInvocationTime>=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;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue