Fixed project to publish map reduce

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/private/luca.frosini/GenerateMapReduceCouchbase@152520 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-08-28 13:39:55 +00:00
parent 175bde198c
commit 26653dae9c
948 changed files with 23465 additions and 35 deletions

View File

@ -17,63 +17,70 @@ import com.couchbase.client.java.env.CouchbaseEnvironment;
import com.couchbase.client.java.env.DefaultCouchbaseEnvironment;
import com.couchbase.client.java.view.DefaultView;
import com.couchbase.client.java.view.DesignDocument;
import com.couchbase.client.java.view.View;
public class dbtest {
protected static final String DEFAULT_DB = "accounting";
protected static final String DEFAULT_DB_SERVICE = "accounting_service";
protected static final String DEFAULT_DB_SERVICE = "ServiceUsageRecord";
protected static final String DEFAULT_DB_STORAGE = "accounting_storage";
protected static final String MAP_REDUCE_PATH_IMPORT = "/home/pieve/Documents/AccountingAnalyticsListMapReduceCouchbase/couchbase/2.0.0/_design/ServiceUsageRecord";
protected static final String URL="http://couchbase01-d-d4s.d4science.org";
protected static final String PASSWORD="accounting";
protected static final String URL = "http://couchbase01.d4science.org";
protected static final String PASSWORD = "accounting";
/* The environment configuration */
protected static final CouchbaseEnvironment ENV = DefaultCouchbaseEnvironment
.builder().queryEnabled(true).build();
public static void main(String[] args) throws Exception{
protected static final CouchbaseEnvironment ENV = DefaultCouchbaseEnvironment.builder().queryEnabled(true).build();
public static void main(String[] args) throws Exception {
createMapReduceCouchBase();
}
private static void createMapReduceCouchBase() throws Exception{
private static void createMapReduceCouchBase() throws Exception {
Cluster cluster = CouchbaseCluster.create(ENV, URL);
Bucket bucket = cluster.openBucket(DEFAULT_DB_SERVICE,PASSWORD);
Bucket bucket = cluster.openBucket(DEFAULT_DB_SERVICE, PASSWORD);
BucketManager bucketManager = bucket.bucketManager();
File file = new File(MAP_REDUCE_PATH_IMPORT);
File currentDirectory = new File(".");
File srcDirectory = new File(currentDirectory, "src");
File mainDirectory = new File(srcDirectory, "main");
File resourcesDirectory = new File(mainDirectory, "resources");
File mapReduceDirectory = new File(resourcesDirectory, "MapReduce");
File file = new File(mapReduceDirectory, "ServiceUsageRecord");
System.out.println(file.getAbsolutePath());
File[] filesInDir = file.listFiles();
Arrays.sort(filesInDir);
Map<String, List> mappe = new HashMap<String, List>();
for(File fs : filesInDir)
{
String nameMapReduce=fs.getName();
String nameViewCustom=fs.getName().split("__")[0];
if (!fs.getName().equals("Invalid")){
Map<String, List<View>> maps = new HashMap<String, List<View>>();
String stringMap= new String (Files.readAllBytes(Paths.get(fs.toString()+"/map.js")));
String stringReduce= new String (Files.readAllBytes(Paths.get(fs.toString()+"/reduce.js")));
if (!mappe.containsKey(nameViewCustom))
mappe.put(nameViewCustom, new ArrayList());
System.out.println("add view:"+nameViewCustom+" and map:"+nameMapReduce);
mappe.get(nameViewCustom).add(DefaultView.create(nameMapReduce,stringMap,stringReduce));
for (File fs : filesInDir) {
String nameMapReduce = fs.getName();
String nameViewCustom = fs.getName().split("__")[0];
if (!fs.getName().equals("Invalid")) {
String stringMap = new String(Files.readAllBytes(Paths.get(fs.toString() + "/map.js")));
String stringReduce = new String(Files.readAllBytes(Paths.get(fs.toString() + "/reduce.js")));
if (!maps.containsKey(nameViewCustom)){
maps.put(nameViewCustom, new ArrayList<View>());
}
}
for(Map.Entry<String, List> entry : mappe.entrySet()) {
String key = entry.getKey();
System.out.println("key"+key);
DesignDocument designDoc = DesignDocument.create(key,entry.getValue());
bucketManager.insertDesignDocument(designDoc);
System.out.println("add view:" + nameViewCustom + " and map:" + nameMapReduce);
View view = DefaultView.create(nameMapReduce, stringMap, stringReduce);
maps.get(nameViewCustom).add(view);
}
}
for (Map.Entry<String, List<View>> entry : maps.entrySet()) {
String key = entry.getKey();
System.out.println("key" + key);
DesignDocument designDoc = DesignDocument.create(key, entry.getValue());
bucketManager.insertDesignDocument(designDoc);
}
cluster.disconnect();
}

View File

@ -0,0 +1,6 @@
function(doc,meta) {
if(!doc.usageRecordType && !doc.recordType){
emit([0, "No Record Type", doc.id], doc);
return;
}
}

View File

@ -0,0 +1,36 @@
function(doc,meta) {
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
function(doc,meta) {
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
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.jobId);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,38 @@
function(doc,meta) {
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
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.jobId);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
function(doc,meta) {
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,36 @@
function(doc,meta) {
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
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.jobId);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
function(doc,meta) {
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
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.jobId);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,36 @@
function(doc,meta) {
if(doc.usageRecordType == "JobUsageRecord" || doc.recordType == "JobUsageRecord"){
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,31 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,32 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.consumerId);
propertiesKey.push(doc.operationId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,33 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.consumerId);
propertiesKey.push(doc.operationId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,34 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.consumerId);
propertiesKey.push(doc.operationId);
propertiesKey.push(doc.operationResult);
propertiesKey.push(doc.portletId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,33 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.consumerId);
propertiesKey.push(doc.operationId);
propertiesKey.push(doc.portletId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,32 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,33 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.consumerId);
propertiesKey.push(doc.operationResult);
propertiesKey.push(doc.portletId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,32 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.consumerId);
propertiesKey.push(doc.portletId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,31 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.operationId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,32 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.operationId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,33 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.operationId);
propertiesKey.push(doc.operationResult);
propertiesKey.push(doc.portletId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,32 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.operationId);
propertiesKey.push(doc.portletId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,31 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,32 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.operationResult);
propertiesKey.push(doc.portletId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -0,0 +1,31 @@
function(doc,meta) {
if(doc.usageRecordType == "PortletUsageRecord" || doc.recordType == "PortletUsageRecord"){
if((doc.duration && isNaN(Number(doc.duration))) || (doc.operationCount && isNaN(Number(doc.operationCount)))){
emit([0, "Invalid Value", doc.id], doc);
return;
}
var data = {};
data.operationCount = doc.operationCount ? Number(doc.operationCount) : 1;
var propertiesKey = [];
propertiesKey.push(doc.portletId);
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);
}
}

View File

@ -0,0 +1,11 @@
function(keys, values, rereduce){
var total = 0;
for(i=0; i<values.length; i++){
total = Number(total) + Number(values[i].operationCount);
}
ret = {};
ret.operationCount = Number(total);
return ret;
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,38 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,39 @@
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);
propertiesKey.push(doc.host);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,40 @@
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);
propertiesKey.push(doc.host);
propertiesKey.push(doc.operationResult);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,39 @@
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);
propertiesKey.push(doc.host);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,38 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,39 @@
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);
propertiesKey.push(doc.host);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,38 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,38 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,39 @@
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);
propertiesKey.push(doc.operationResult);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,38 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,38 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,38 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,39 @@
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);
propertiesKey.push(doc.operationResult);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,38 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,38 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
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);
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);
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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