[Enhancement] Add metric for last delayed message timestamp
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### Search before reporting
- [x] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Motivation
Without knowing when the last delayed message is scheduled to be delivered, we cannot easily:
1. **Monitor** how far in the future delayed messages extend (e.g. "last message is 7 days from now")
2. **Alert** when delayed messages are scheduled too far ahead (e.g. misconfigured producers)
3. **Debug** delayed delivery issues (e.g. why consumers are not receiving messages yet)
4. **Plan capacity** (e.g. understanding the time range of pending delayed messages)
### Solution
Add a new metric: **the delivery timestamp of the last delayed message** .
**Name**: `lastDelayedMessageTimestamp`
### Alternatives
_No response_
### Anything else?
_No response_
### Are you willing to submit a PR?
- [x] I'm willing to submit a PR!
Contributor guide
Research direction
The issue does not identify a file, test, or entry point. Start by locating the delayed-message metrics instrumentation in the Pulsar codebase and trace how delayed messages expose delivery timing. Done means the last delayed message's delivery timestamp is exposed as lastDelayedMessageTimestamp and is covered by the relevant metric test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems, observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100