Permalink
Browse files

Add create_time as a queue stat and document age_msec.

  • Loading branch information...
1 parent 3e6c0d6 commit 5e4a681db70e8018152f68604a5302c8a99a952a @gphat gphat committed Feb 17, 2012
Showing with 5 additions and 2 deletions.
  1. +3 −2 docs/guide.md
  2. +2 −0 src/main/scala/net/lag/kestrel/PersistentQueue.scala
View
5 docs/guide.md
@@ -385,8 +385,9 @@ For each queue, the following stats are also reported:
- `waiters` - number of clients waiting for an item from this queue (using
`GET/t`)
- `open_transactions` - items read with `/open` but not yet confirmed
-- `total_flushes` total number of times this queue has been flushed
-
+- `total_flushes` - total number of times this queue has been flushed
+- `age_msec` - age of the last item read from the queue
+- `create_time` - the time that the queue was created (in milliseconds since epoch)
Kestrel as a library
--------------------
View
2 src/main/scala/net/lag/kestrel/PersistentQueue.scala
@@ -95,6 +95,7 @@ class PersistentQueue(val name: String, persistencePath: String, @volatile var c
def currentAge: Duration = synchronized { if (queueSize == 0) 0.milliseconds else _currentAge }
def waiterCount: Long = synchronized { waiters.size }
def isClosed: Boolean = synchronized { closed || paused }
+ def createTime: Long = synchronized { _createTime }
// mostly for unit tests.
def memoryLength: Long = synchronized { queue.size }
@@ -132,6 +133,7 @@ class PersistentQueue(val name: String, persistencePath: String, @volatile var c
gauge("age_msec", currentAge.inMilliseconds)
gauge("waiters", waiterCount)
gauge("open_transactions", openTransactionCount)
+ gauge("create_time", createTime)
private final def adjustExpiry(startingTime: Time, expiry: Option[Time]): Option[Time] = {
if (config.maxAge.isDefined) {

0 comments on commit 5e4a681

Please sign in to comment.