+1
It looks great to have these topic attributes.

Thanks,
Haiting

On Fri, Jun 27, 2025 at 3:03 AM PengHui Li <peng...@apache.org> wrote:
>
> Hi All,
>
> I have drafted a propoal to enhance topic observability by adding
> topicCreationTimeStamp and lastPublishTimeStamp to the topic stats API.
>
> *Motivation:* Currently, it is difficult to programmatically determine a
> topic's age or its most recent message activity. This hinders essential
> operational tasks such as identifying and cleaning up stale topics,
> performing compliance audits, and gaining quick troubleshooting insights.
> Existing metrics like lastLedgerCreatedTimestamp or rate-based metrics are
> not suitable for these lifecycle management use cases.
>
> *Proposed Solution:* This PIP proposes adding two new fields to the
> TopicStats object:
>
>    1.
>
>    *topicCreationTimeStamp*: This value will be retrieved directly from the
>    ctime attribute of the topic's underlying metadata node (
>    org.apache.pulsar.metadata.api.Stat). This approach is efficient and
>    provides an accurate creation timestamp for all topics, including those
>    created before this feature's deployment.
>    2.
>
>    *lastPublishTimeStamp*: This will be maintained as a high-performance,
>    in-memory long value on the owning broker, updated on every successful
>    message publish. To ensure durability across broker restarts or topic
>    reloads, the value will be recovered from the last entry in the managed
>    ledger when the user gets topic internal stats.
>
> These changes are designed to be fully backward-compatible and have a
> negligible performance impact on the message-publishing path.
>
> The full proposal is available for review here:
> https://github.com/apache/pulsar/pull/24469
>
> I welcome any feedback, questions, or suggestions you may have.
>
> Thanks,
>
> Penghui

Reply via email to