derekjw/fyrie-redis

Metrics / Stats

Closed this issue · 3 comments

Would be nice to be able to get this data:

  • Number of messages and rate
  • Latency
  • of outstanding requests

For the first two, I'd like to be able to set up a callback or something so that I can pump data directly into the metrics library that we already use (https://github.com/codahale/metrics).

For the last one, I'd like a function to call to get that (if it is even useful...)

I added some simple hooks that will allow you to calculate the metrics you want. It is currently only in master:

83584dc

If this is something that you think will work for you, I can port it into the 'akka-1.2' and 'akka-1.1' branches.

A simple example of setting up some callbacks to print to the console every 10 requests/results:

    r onRequest { (id, ms) =>
      if (id % 10 == 0) println(id.toString + " requests")
    }
    r onResult { (id, ms) =>
      if (id % 10 == 0) println(id.toString + " results")
    }

I've merged this into 'akka-1.2' and 'akka-1.1'. Let me know if you need something a bit different.