activemq icon indicating copy to clipboard operation
activemq copied to clipboard

WIP: AMQ-9552: Add metric lastMessageTimestamp to StatisticsBroker based o…

Open ggkochanski opened this issue 1 year ago • 2 comments

Add metric lastMessageTimestamp to StatisticsBroker based on modification time of metric enqueues:

// NOTICE: Client-side, you may get the broker "now" Timestamp by msg.getJMSTimestamp()
// This allows for calculating inactivity.
statsMessage.setLong("lastMessageTimestamp", stats.getEnqueues().getLastSampleTime()); 

ggkochanski avatar Aug 20 '24 07:08 ggkochanski

Some examples per threshold of this metric from real life implementation:

image

ggkochanski avatar Aug 20 '24 07:08 ggkochanski

I have started a capability to put additional statistics behind a config flag, so adding new metrics such as lastMessageTimestamp, lastMessageId, etc.. do not add computation overhead to all queues by default to all users.

The statistics broker update should wait to follow the work done for the core capability.

The field names should be consistent across all APIs and functions. There are other requests to add deeper observability fields -- firstEnqueue, lastEnqueue, firstDequeue, etc.. so 'lastMessageTimestamp' as a field name is not specific enough to meet all the requests.

ref: [AMQ-9426]

The initial work for the feature is here: https://github.com/apache/activemq/pull/1156

mattrpav avatar Aug 23 '24 17:08 mattrpav

The advancedMessageFlow statistics are implemented and released in 5.19.x (and soon 6.2.0)

Please review the added metrics: https://github.com/apache/activemq/blob/main/activemq-client/src/main/java/org/apache/activemq/management/MessageFlowStatsImpl.java#L21

I believe this PR is addressed with the enqueuedMessageBrokerInTime or enqueuedMessageTimestamp value.

mattrpav avatar Apr 14 '25 21:04 mattrpav

yup, thank you, closing

ggkochanski avatar Apr 15 '25 13:04 ggkochanski