update with metrics types that were added to etsy/statsd #4

wants to merge 1 commit into


None yet
5 participants

mrtazz commented Apr 8, 2013

I added some information about metric types that were added in the newest release of etsy/statsd. Let me know if anything should be rephrased or adapted.

b commented on 6172d39 Apr 9, 2013

Increment and decrement are for counters. The purpose of gauges is that only their instantaneous value is transferred. Why was this added?

Sets look useful, but I am unclear on exactly how they are supposed to work from that documentation.

garthk replied Jul 29, 2016 edited

I'd expect:

client.set('ip', '');
client.set('ip', '');

ip:2|s at flush time, but the clients and servers say otherwise:

I think the explanation for set is wrong. Copy-pasting myself from msiebuhr/node-statsd-client#61 (comment):

I think you've got it wrong. The point of sets is that they count uniques across several clients reporting to the same statsd-server. Example:

Client one sends A and B, while client two sends B and C. The total set has size 3, which only the server can deduce. (It can't if it only gets 2 and 2 sent....)


b commented Aug 2, 2013


mrtazz commented Aug 11, 2013

ugh sorry for the delay. You're absolutely right about the gauges delta. However we had some requests for it and a lively discussion on the pull request after which we decided to add this functionality. And now there is also a request for absolute counters. I would love to hear your opinion on that if you feel like joining the discussion.

Sets (as I tried to explain in the docs) are used for distributed counting of events that are unique in some form. The canonical use case is counting logged in users, where the user ID is unique across application servers and can just be sent to StatsD. In that case you don't need to maintain and calculate gauges on every machine. The original Pull Request mentions that this has been expanded to more use cases, maybe @VivienBarousse can give more insight into this.

The first use case we had for adding sets was to count unique logged in users. The idea is that you can send values identifying a unique event to statsd, and statsd will count the event only if its value hasn't been encountered before. In our case, by sending the user ID as a value, we can count the number of unique logged in users visiting our web site.

However, you can use this system to count any sort of "unique" events:

  • By sending an IP address, you can get the number of unique visitors to your website.
  • By sending API keys, we can count how many clients are using the API.
  • ...

Basically, this can be used to count "unique" events for any definition of "unique". The only constraint is you have to send distinct values for distinct events, and statsd does the disambiguation and reports only unique occurrences of those events.

Hope that helps.

mrtazz closed this Dec 20, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment