tonyskn / node-redis-timeseries Goto Github PK
View Code? Open in Web Editor NEWRedis time series statistics with Node.js
License: MIT License
Redis time series statistics with Node.js
License: MIT License
Not an issue more of a question really: there are some time ranges that really make sense only from the beginning of the unit, e.g. "month" range should calculate from 1st of month, "week" from Sunday, etc. How can this module be modified or what would be the approach to handle such cases?
Cheers,
Thanos
When creating the TimeSeries client, you can override the default granularities with your own. How?
Since you are defining the timeseries granularities as '1second' : { ttl: this.minutes(5), duration: 1 }, if i define a new one... '10seconds' : { ttl: this.days(1), duration: 10 } will not work because days is not defined. is there a simple/clean way to do this? Currently I just added the 10seconds to the source file, I know its a horrible thing, but i could not find out a clean way to do it and still remain with the this.days() syntax.
Note an issue; but, a user question.
I will have two sources of data that publish at an arbitrary rate. I would like to merge these time series into a third one by taking a 1 minute slice of the other two time series. How do I do this with node-redis-timeseries ?
I am writing a piece of code to increase/store counters and hitting it with average load. In some cases I get the strange behaviour that a specific counter is increased by an extra digit - 2-3 every 250. This is in a transactional multithreaded environment and node app is being hit by at least 3-10 concurrent hits.
I've checked MONITOR output and in all my cases, situation is similar to the below:
1390991605.597054 "MULTI"
1390991605.597119 "hget" "cmp:2_11223300050:w:1389830400" "1389830400"
1390991605.597149 "hget" "cmp:2_11223300050:w:1389830400" "1390435200"
1390991605.597158 "EXEC"
1390991605.597315 "MULTI"
1390991605.597383 "hincrby" "cmp:2_11223300055:d:1390867200" "1390953600" "1"
1390991605.597395 "expireat" "cmp:2_11223300055:d:1390867200" "1391212800"
1390991605.597405 "EXEC"
1390991605.597632 "MULTI"
1390991605.597739 "hincrby" "cmp:2_11223300055:d:1390867200" "1390953600" "1"
1390991605.597754 "expireat" "cmp:2_11223300055:d:1390867200" "1391212800"
1390991605.597766 "hincrby" "cmp:2_11223300053:d:1390867200" "1390953600" "1"
1390991605.597777 "expireat" "cmp:2_11223300053:d:1390867200" "1391212800"
1390991605.597789 "EXEC"
Problematic behaviour (additional +1) comes at the point marked with timestamps 1390991605.597383 and 1390991605.597739. It seems that the "pendingMulti" variable is picked up by the next event without it being cleared by the previous caller, due to high concurrency.
Code used to create the issue is part of an express() application, function to record the hit is as below:
// this POST request records 1 hit for (now)
// on all granularities defined
app.post('/hit/:rule/:type/:id', function(req,res) {
var tsKey = req.params.id ;
var dataMap = { ver : PROTO, tp: req.params.rule };
ts = getTS(req.params.rule,req.params.type);
if (ts == null) { // not found or invalid rule given
dataMap['error'] = 'not a correct rule/type:'+req.params.rule+','+req.params.type;
res.json(404,dataMap);
return;
}
//console.log("selected = "+ts.keyBase);
ts.recordHit(tsKey).exec(function(err,result) {
if (err != null) {
console.log("ERROR writing redis "+err);
res.json(404, err);
}
//console.log("Recorded hit ", ++hitCounter, new Date());
res.json(200, dataMap);
});
});
Hey,
Is it possible to just have the number of hits (sum) for a timespan?
Example for the last 30 seconds:
ts.getsHits('this_one', ts.seconds(30), callback);
Thanks,
Philmod
Hi
would like for various reasons (e.g. rollback) to be able to decrement a counter or set of counters - can you please add this api call to your library?
thanks
Thanos
redis is now at 2.2.3. Any issues with updating the peer dependency?
I am using redis version redis_version:3.0.7 and getting error in redis-timeseries that redis.multi() Cannot read property 'multi' of undefined
Does redis-timeseries doesn't support with redis 3.0
Hi.
I faced a difficult situation. I can record and remove a hit, because recordHit and removeHit functions require timestamp in function parameter. But there is no option in getHits(). getCurrentTime() return timestamp with UTC timezone always. But i need KST timezone. How can i get hits with other timezone??
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.