Skip to content

Conversation

@massakam
Copy link
Contributor

@massakam massakam commented Aug 17, 2022

Motivation

Add a new field named ownerBroker to topic stats. This is the hostname and port of the broker owning the topic, separated by a colon. This is the same name as the ephemeral node registered under /loadbalance/brokers/ on ZooKeeper.

{
  "msgRateIn" : 0.0,
  "msgThroughputIn" : 0.0,
  "msgRateOut" : 0.0,
  "msgThroughputOut" : 0.0,
  ...
  "compaction" : {
    "lastCompactionRemovedEventCount" : 0,
    "lastCompactionSucceedTimestamp" : 0,
    "lastCompactionFailedTimestamp" : 0,
    "lastCompactionDurationTimeInMills" : 0
  },
  "ownerBroker" : "localhost:8080"
}

This is useful to know which broker owns the topic.

Modifications

Added a method getLookupServiceAddress() to the PulsarService class. This method returns a string consisting of the advertised address and web service port separated by a colon. The asyncGetStats() method of PersistentTopic and NonPersistentTopic sets the string returned from PulsarService#getLookupServiceAddress() to stats.

Verifying this change

  • Make sure that the change passes the CI checks.

Documentation

  • doc

@massakam massakam added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. component/stats labels Aug 17, 2022
@massakam massakam added this to the 2.11.0 milestone Aug 17, 2022
@massakam massakam self-assigned this Aug 17, 2022
@massakam massakam changed the title [improvement][stats] Add ownerBroker field to topic stats [improve][stats] Add ownerBroker field to topic stats Aug 18, 2022
@massakam massakam force-pushed the owner-broker branch 5 times, most recently from 5b08eb9 to 2924305 Compare August 22, 2022 04:44
Copy link
Contributor

@nkurihar nkurihar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nkurihar nkurihar merged commit eab2bb5 into apache:master Sep 7, 2022
@massakam massakam deleted the owner-broker branch September 8, 2022 01:34
nodece pushed a commit to nodece/pulsar that referenced this pull request Jul 23, 2024
(cherry picked from commit eab2bb5)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
nodece pushed a commit to ascentstream/pulsar that referenced this pull request Jul 24, 2024
(cherry picked from commit eab2bb5)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants