Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the value of stat increment doesn't change #22

Open
hossamr77 opened this issue Jul 8, 2015 · 5 comments
Open

the value of stat increment doesn't change #22

hossamr77 opened this issue Jul 8, 2015 · 5 comments

Comments

@hossamr77
Copy link

i have created the following listener and registered it when the server is starting to listen to the event of stat.increment and log the value into the console but unfortunately the value is always 1

listener.js

var statMonitor = require('monitor').Stat;

exports.InitListeners = function() {
statMonitor.on('*', function myListenerFunction(module, name, value, type) {
console.log('module: ' + module + ' stat: ' + name + ' value: ' + value + ' type: '+type);

});
}

and here is calling of stat increment
var stat = require('monitor').getStatLogger('products');

function getProducts(opts, req, res, callback){
stat.increment('retriveProducts');
}

and here the log

module: products stat: retriveProducts value: 1 type: c

@lorenwest
Copy link
Owner

That looks right. Your console log is showing the amount that the counter is being incremented by.

@hossamr77
Copy link
Author

but i need to show the value of stat variable (retriveProducts ) not the amount that the counter is being incremented by.

@lorenwest
Copy link
Owner

Then you want a gauge, not a counter.

@hossamr77
Copy link
Author

let me describe what i want to do , i'd like to display how many times certain function has been invoked.

FYI:i used gauge and the same thing
module: promotion stat: retriveFeaturedProducts value: 1 type: g

@lorenwest
Copy link
Owner

It sounds like you want a counter, and a backend that keeps track of the counts. The only way I know how to do this is to connect it with graphite or another backend that aggregates your counts. If you're working with multiple servers, graphite is the backend to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants