Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] [broker] Add consumer name for subscription stats #23671

Conversation

hangc0276
Copy link
Contributor

Fixes #xyz

Main Issue: #xyz

PIP: #xyz

Motivation

When getting topic stats, the consumer name is missing in each subscription's consumer information
With this change, the topic stats will show consumer name

 "abortedTxnCount" : 0,
  "committedTxnCount" : 0,
  "publishers" : [ ],
  "waitingPublishers" : 0,
  "subscriptions" : {
    "test_sub_v1" : {
      "msgRateOut" : 303.3964745694218,
      "msgThroughputOut" : 14215.002259022087,
      "bytesOutCounter" : 140137,
      "msgOutCounter" : 2991,
      "msgRateRedeliver" : 0.0,
      "messageAckRate" : 0.0,
      "chunkedMessageRate" : 0.0,
      "msgBacklog" : 7183,
      "backlogSize" : 75322327,
      "earliestMsgPublishTimeInBacklog" : 0,
      "msgBacklogNoDelayed" : 7183,
      "blockedSubscriptionOnUnackedMsgs" : false,
      "msgDelayed" : 0,
      "msgInReplay" : 0,
      "unackedMessages" : 0,
      "type" : "Failover",
      "activeConsumerName" : "5ce36",
      "msgRateExpired" : 0.0,
      "totalMsgExpired" : 0,
      "lastExpireTimestamp" : 0,
      "lastConsumedFlowTimestamp" : 1733206320792,
      "lastConsumedTimestamp" : 1733206321845,
      "lastAckedTimestamp" : 0,
      "lastMarkDeleteAdvancedTimestamp" : 0,
      "consumers" : [ {
        "msgRateOut" : 303.3964745694218,
        "msgThroughputOut" : 14215.002259022087,
        "bytesOutCounter" : 140137,
        "msgOutCounter" : 2991,
        "msgRateRedeliver" : 0.0,
        "messageAckRate" : 0.0,
        "chunkedMessageRate" : 0.0,
        **"consumerName" : "5ce36",**. <----- This one
        "availablePermits" : -1991,
        "unackedMessages" : 0,
        "avgMessagesPerEntry" : 4,
        "blockedConsumerOnUnackedMsgs" : false,
        "drainingHashesCount" : 0,
        "drainingHashesClearedTotal" : 0,
        "drainingHashesUnackedMessages" : 0,
        "address" : "/127.0.0.1:52700",
        "connectedSince" : "2024-12-02T22:12:00.783795-08:00",
        "clientVersion" : "2.9.2",
        "lastAckedTimestamp" : 0,
        "lastConsumedTimestamp" : 1733206321845,

Modifications

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@hangc0276 hangc0276 self-assigned this Dec 3, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 3, 2024
@hangc0276 hangc0276 added area/broker type/bug The PR fixed a bug or issue reported a bug release/3.0.9 release/3.3.4 release/4.0.2 and removed doc-not-needed Your PR changes do not impact docs labels Dec 3, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 3, 2024
Copy link
Member

@horizonzy horizonzy left a comment

Choose a reason for hiding this comment

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

LGTM.

@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.37%. Comparing base (bbc6224) to head (49ea4f4).
Report is 774 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23671      +/-   ##
============================================
+ Coverage     73.57%   74.37%   +0.79%     
- Complexity    32624    35034    +2410     
============================================
  Files          1877     1944      +67     
  Lines        139502   147332    +7830     
  Branches      15299    16258     +959     
============================================
+ Hits         102638   109577    +6939     
- Misses        28908    29291     +383     
- Partials       7956     8464     +508     
Flag Coverage Δ
inttests 27.31% <100.00%> (+2.72%) ⬆️
systests 24.39% <100.00%> (+0.07%) ⬆️
unittests 73.74% <100.00%> (+0.90%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ava/org/apache/pulsar/broker/service/Consumer.java 85.14% <100.00%> (-1.53%) ⬇️

... and 662 files with indirect coverage changes

@Technoboy- Technoboy- merged commit 59d4588 into apache:master Dec 4, 2024
60 of 62 checks passed
@Technoboy- Technoboy- added this to the 4.1.0 milestone Dec 4, 2024
lhotari pushed a commit that referenced this pull request Dec 6, 2024
lhotari pushed a commit that referenced this pull request Dec 6, 2024
lhotari pushed a commit that referenced this pull request Dec 6, 2024
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 9, 2024
(cherry picked from commit 59d4588)
(cherry picked from commit 8168df1)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 10, 2024
(cherry picked from commit 59d4588)
(cherry picked from commit 8168df1)
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants