<@U078Y59KC3B> pulsar admin topics partitioned sta...
# ask-ai
s
@RunLLM pulsar admin topics partitioned stats shows backlog size as 0 even when the msgbacklog >0
r
The
pulsar-admin topics partitioned-stats
command can show
backlogSize
as 0 even when
msgBacklog
is greater than 0. This is a known issue and can occur because the backlog size is an estimate based on ledger data, while
msgBacklog
counts the number of unacknowledged messages. If the backlog is small or the cursor is at the end of the ledger, the size calculation may return 0 even though there are still unacknowledged messages, especially for partitioned topics or after certain operations like resets or skips. This behavior is documented and has been discussed in detail in the Pulsar community (see here). For more accurate results, you can use the
--get-precise-backlog
flag with the
stats
or
partitioned-stats
command, but note that this may have a performance impact (see docs). Would you like more detail on how backlog size is calculated or how to get precise values? Sources: - Incorrect msgBacklog value - see docs 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
s
@RunLLM which is the best command to get the msgbacklog on the subscription
r
The best command to get the
msgBacklog
(number of unacknowledged messages) for a subscription is:
Copy code
pulsar-admin topics stats <topic-name>
This command displays detailed stats, including
msgBacklog
for each subscription on the topic (see docs). For partitioned topics, use:
Copy code
pulsar-admin topics partitioned-stats <topic-name>
Would you like more detail on filtering or scripting this output? Sources: - Pulsar Admin API: partitioned-stats 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
s
@RunLLM what is the difference between --precise-backlog and just partitioned stats
r
The
--get-precise-backlog
flag (or
-gpb
) with
partitioned-stats
or
stats
forces Pulsar to calculate the exact number of unacknowledged messages by scanning the ledger, while the default
partitioned-stats
command returns an estimated backlog using counters, which is faster but may be inaccurate in some edge cases (see docs, see also). Using
--get-precise-backlog
is more accurate but can impact performance, especially on large topics, because it requires locking and scanning the ledger. The default is more efficient but may show incorrect values after certain operations like cursor resets. Would you like more detail on when to use each option? Sources: - Pulsar Admin CLI reference - Incorrect msgBacklog value 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
s
@RunLLM subscription creation time
r
It seems likely that Pulsar does not directly expose the subscription creation time in the standard topic or subscription stats output. The available stats include metrics like last consumed, last acked, and last mark delete timestamps, but not the initial creation time of the subscription (see metrics reference, see stats output). Would you like more detail on which timestamps are available for subscriptions or how to track creation time externally? Sources: - see metrics reference - see stats output 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
s
@RunLLM Would you like more detail on which timestamps are available for subscriptions or how to track creation time externally?
r
Available subscription timestamps in Pulsar include: - `lastExpireTimestamp`: last message expiration - `lastAckedTimestamp`: last acknowledged message - `lastConsumedTimestamp`: last consumed message - `lastConsumedFlowTimestamp`: last received consume flow command - `lastMarkDeleteAdvancedTimestamp`: last MarkDelete position advanced (see metrics reference). To track subscription creation time externally, you must record it yourself (e.g., log the time when you create the subscription via admin tools or your application), as Pulsar does not expose this timestamp natively. Would you like a code example or more detail on external tracking? Sources: - see metrics reference 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
s
@RunLLM weather we can see log messages in broker to get the subscription time ?
r
Pulsar broker logs do record subscription creation events, but they do not explicitly log the subscription creation time as a dedicated field. You can, however, infer the creation time by searching broker logs for lines like "Created subscription on topic ... / sub" or similar messages, which are timestamped (see example log). The timestamp in the log entry indicates when the subscription was created. Would you like more detail on how to search for these log entries or automate extraction? Sources: - Broker stuck to create subscription and client fails to create consumer 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
s
@RunLLM Would you like a code example or more detail on external tracking?
r
Sure thing! I'm looking through the available data to answer your question. Hold on a second... ⏳
s
@RunLLM how to track the subscription creation time
r
It seems likely that Pulsar does not natively expose subscription creation time in its stats or metrics. The most reliable way is to log the timestamp externally when you create the subscription, either in your application code or via admin scripts (see metrics reference). Alternatively, you can infer creation time by searching broker logs for subscription creation events, as these log entries are timestamped (see example log). Would you like a code example for logging creation time or guidance on searching broker logs? Sources: - Broker stuck to create subscription and client fails to create consumer - see metrics reference 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.
s
Can we add the subscription creation time as property for subscriptions