activemq icon indicating copy to clipboard operation
activemq copied to clipboard

Add FirstMessageAge and FirstMessageTimestamp JMX metrics for queues.

Open NikitaShupletsov opened this issue 2 years ago • 5 comments

This change is meant to match the piece of functionality from Artemis: https://github.com/apache/activemq-artemis/commit/00837c120d131cd6db706aed5f549db06cd7b1e7

Add two new JMX attributes for queues: FirstMessageAge and FirstMessageTimestamp. First one shows the diff between current time and the message timestamp of the first message in the queue. Second one shows the message timestamp of the first message in the queue.

NikitaShupletsov avatar May 10 '22 18:05 NikitaShupletsov

ref: https://issues.apache.org/jira/browse/AMQ-8463

I'd like to review the naming here, given the plans to add additional metrics. We should have it all align.

Metrics:

nextMessageEnqueuedTimestamp (from the message’s brokerInTime)
nextMessageTimestamp
nextMessageID

(‘last’ aka the most recent message to be ack’d — processed in-flight)
lastEnqueuedMessageTimestamp (from brokerInTime on the message)
lastDequeuedTimestamp (clock timestamp of when the message was dequeued)
lastDequeuedMessageTimestamp (from brokerInTime on the message)
lastDequeuedMessageID

(‘First’ aka first all time in the life of the destination since boot — processed in-flight)
firstEnqueuedMessageTimestamp (from brokerInTime)
firstEnqueuedMessageID
firstDequeuedTimestamp (wall clock time when the message was dequeued)
firstDequeuedMessageID
firstDequeuedMessageTimestamp (from brokerInTime)

mattrpav avatar May 10 '22 18:05 mattrpav

Initially the idea was to call it oldestMessageAge or ageOfOldestMessage, but then I came across the artemis metric and decided to use the same name for the sake of consistency. So, what do you think? does oldest instead of first sound better?

NikitaShupletsov avatar May 10 '22 19:05 NikitaShupletsov

The change looks good to me. I think using firstMessageTimestamp is good. However, I would also add lastMessageTimestamp.

I will resume my work on this one (spinning another one).

jbonofre avatar Oct 20 '23 06:10 jbonofre

I think this approach is incorrect, and we should revisit the approach in 6.1.0

mattrpav avatar Oct 20 '23 20:10 mattrpav

We will see later but I will probably close this PR with a new one for 6.1.0 with a different impl.

jbonofre avatar Oct 21 '23 04:10 jbonofre