diff --git a/bin/generator-config.js b/bin/generator-config.js index d4640bc..0af9bb7 100644 --- a/bin/generator-config.js +++ b/bin/generator-config.js @@ -1,5 +1,5 @@ module.exports = { - "packetsInInterval": 150000, + "packetsInInterval": 1500, "intervalInMS": 60000, "sampleRateInMS": 100, "data": { diff --git a/examples/event-stream/event-get.html b/examples/event-stream/event-get.html index 5805f66..8bc875b 100644 --- a/examples/event-stream/event-get.html +++ b/examples/event-stream/event-get.html @@ -24,13 +24,12 @@

Streaming Events

} } if (type) { - socket = new WebSocket("ws://localhost:1081/1.0/event/get"); socket.onopen = function () { console.log("connected!"); socket.send(JSON.stringify({ type: type, - start: new Date().getTime()-60*1000 + start: new Date().getTime()-1*1000 })); }; @@ -38,12 +37,12 @@

Streaming Events

var event; if (message) { console.log(index++); - //console.log(message); + console.log(message); if (message.data) { event = JSON.parse(message.data); - //console.log("received", message.data); + console.log("received", message.data); if (event && event.data) { - //console.log("received", event.data); + console.log("received", event.data); } } } diff --git a/examples/event-stream/event-put.html b/examples/event-stream/event-put.html index 962cbd7..2c92b78 100644 --- a/examples/event-stream/event-put.html +++ b/examples/event-stream/event-put.html @@ -44,10 +44,10 @@

Streaming Events - Put

} })); index++; - if (index % 100 === 0) { + if (index % 10 === 0) { console.log("sent", index); } - }, 5); + }, 100); }; socket.onmessage = function (message) { diff --git a/lib/analytics/event.js b/lib/analytics/event.js index bde0879..5fcbb60 100644 --- a/lib/analytics/event.js +++ b/lib/analytics/event.js @@ -75,6 +75,7 @@ exports.putterInit = function (db, options) { // then append this events to the queue for later save. if (eventsCollectionCreated === 0.5) { eventsToSave = eventsToSave.concat(events); + return; } eventsCollectionCreated = 0.5; diff --git a/lib/analytics/genericCounter.js b/lib/analytics/genericCounter.js index 8d627e5..3eff100 100644 --- a/lib/analytics/genericCounter.js +++ b/lib/analytics/genericCounter.js @@ -50,8 +50,8 @@ function customQuery(collectionObj, filter, limit, streamified, messageSender) { //move filter to cover just the last 5 seconds temp = new Date().getTime(); temp = temp - temp % 1000 - 5000; - filter._id.$gte= myutils.objectIdFromDate(temp); - filter._id.$lt= myutils.objectIdFromDate(temp+1000); + filter._id.$gte = myutils.objectIdFromDate(temp); + filter._id.$lt = myutils.objectIdFromDate(temp + 1000); customQuery(collectionObj, filter, limit, streamified, messageSender); }, 1000 diff --git a/public/js/analytics.js b/public/js/analytics.js index 71a62cd..2d407b0 100644 --- a/public/js/analytics.js +++ b/public/js/analytics.js @@ -131,7 +131,7 @@ function Chart(config) { this.resume = function () { setTimeout(function () { that.intervalHandle = setInterval(function () { - that.refreshAll(); + dc.redrawAll(); }, config.refreshFrequency); }, 1e3); }; @@ -213,7 +213,7 @@ function Chart(config) { }); this.crossfilter.remove(); this.dimensionTime.filterAll(); - this.refreshAll(); + // this.refreshAll(); } }; @@ -349,50 +349,50 @@ function AggregatedChart(config) { AggregatedChart.prototype = Chart; var chartsConfig = [ - // { - // name: "T1 Aggregations", - // chartType: "AggregatedChart", //can be "EventsChart" or "AggregatedChart" - meaning one or multiple dimensions - // renderingType: "xxx", //choose a style - // chartParams: { - // length: 3600 * 1e3, //1 hour - // wsAddress: "ws://localhost:1081/1.0/aggregation/get", - // query: {name: "agg1_1m"}, - // start: new Date(new Date().getTime() - 3600 * 1e3), //miliseconds ago - // stop: null, //null for a streaming chart - // dimensionsNames: { - // "v1": "Gender", - // "v2": "Platform", - // "v3": "Country" - // }, - // metricsNames: { - // c: "Count", - // rt: "Response time" - // } - // }, - // refreshFrequency: 10 * 1e3 - // } - { - name: "T1 Events", - chartType: "EventsChart", //can be "EventsChart" or "AggregatedChart" - meaning one or multiple dimensions - renderingType: "xxx", //choose a style - chartParams: { - length: 1e3, - wsAddress: "ws://localhost:1081/1.0/event/get", - query: {type: "t1"}, - start: new Date(new Date().getTime() - 60 * 1e3), //miliseconds ago - stop: null, //null for a streaming chart - dimensionsNames: { - "v1": "Gender", - "v2": "Platform", - "v3": "Country" - }, - metricsNames: { - c: "Count", - rt: "Response time" +// { +// name: "T1 Aggregations", +// chartType: "AggregatedChart", //can be "EventsChart" or "AggregatedChart" - meaning one or multiple dimensions +// renderingType: "xxx", //choose a style +// chartParams: { +// length: 3600 * 1e3, //1 hour +// wsAddress: "ws://localhost:1081/1.0/aggregation/get", +// query: {name: "agg1_1m"}, +// start: new Date(new Date().getTime() - 3600 * 1e3), //miliseconds ago +// stop: null, //null for a streaming chart +// dimensionsNames: { +// "v1": "Gender", +// "v2": "Platform", +// "v3": "Country" +// }, +// metricsNames: { +// c: "Count", +// rt: "Response time" +// } +// }, +// refreshFrequency: 10 * 1e3 +// } + { + name: "T1 Events", + chartType: "EventsChart", //can be "EventsChart" or "AggregatedChart" - meaning one or multiple dimensions + renderingType: "xxx", //choose a style + chartParams: { + length: 60 * 1e3, + wsAddress: "ws://localhost:1081/1.0/event/get", + query: {type: "t1"}, + start: new Date(new Date().getTime() - 60 * 1e3), //miliseconds ago + stop: null, //null for a streaming chart + dimensionsNames: { + "v1": "Gender", + "v2": "Platform", + "v3": "Country" + }, + metricsNames: { + c: "Count", + rt: "Response time" + } + }, + refreshFrequency: 1e3 } - }, - refreshFrequency: 1e3 - } ], charts = [], i;