Skip to content

Commit 5e4a681

Browse files
committed
Add create_time as a queue stat and document age_msec.
1 parent 3e6c0d6 commit 5e4a681

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

docs/guide.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,9 @@ For each queue, the following stats are also reported:
385385
- `waiters` - number of clients waiting for an item from this queue (using
386386
`GET/t`)
387387
- `open_transactions` - items read with `/open` but not yet confirmed
388-
- `total_flushes` total number of times this queue has been flushed
389-
388+
- `total_flushes` - total number of times this queue has been flushed
389+
- `age_msec` - age of the last item read from the queue
390+
- `create_time` - the time that the queue was created (in milliseconds since epoch)
390391

391392
Kestrel as a library
392393
--------------------

src/main/scala/net/lag/kestrel/PersistentQueue.scala

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class PersistentQueue(val name: String, persistencePath: String, @volatile var c
9595
def currentAge: Duration = synchronized { if (queueSize == 0) 0.milliseconds else _currentAge }
9696
def waiterCount: Long = synchronized { waiters.size }
9797
def isClosed: Boolean = synchronized { closed || paused }
98+
def createTime: Long = synchronized { _createTime }
9899

99100
// mostly for unit tests.
100101
def memoryLength: Long = synchronized { queue.size }
@@ -132,6 +133,7 @@ class PersistentQueue(val name: String, persistencePath: String, @volatile var c
132133
gauge("age_msec", currentAge.inMilliseconds)
133134
gauge("waiters", waiterCount)
134135
gauge("open_transactions", openTransactionCount)
136+
gauge("create_time", createTime)
135137

136138
private final def adjustExpiry(startingTime: Time, expiry: Option[Time]): Option[Time] = {
137139
if (config.maxAge.isDefined) {

0 commit comments

Comments
 (0)