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

[feat][broker] Implementation of PIP-323: Complete Backlog Quota Telemetry #21816

Merged
merged 11 commits into from
Jan 17, 2024

Conversation

asafm
Copy link
Contributor

@asafm asafm commented Dec 28, 2023

PIP: #21709

Motivation

As explained in the PIP, the motivation is to allow users of Pulsar to set an alert when the actual age of the oldest unacknowledged message for a topic is nearing its defined backlog quota time limit.

Modifications

  • Four fields related to backlog telemetry were added to TopicStats per the PIP
  • Four metrics related to backlog telemetry added per the PIP
  • Cleaned up roughly 25 IntelliJ warnings
  • A new auxiliary class named PrometheusMetricsClient was introduced, making retrieving and querying Prometheus metrics easier. The primary parsing method was refactored out of PrometheusMetricsTest as at least 7 test classes used this parse method directly, which didn't seem appropriate.
  • Javadoc of Consumer.seek() was enhanced as it lacked an important distinction to the effect of it. Added test to verify.
  • Added log4j.xml to pulsar-broker/src/test/resources, making it easy for developers to change the log level when running unit tests. Before they copy-paste a file into it and delete it.

Verifying this change

  • Make sure that the change passes the CI checks.

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: asafm#4

Copy link

@asafm Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions bot added doc-required Your PR changes impact docs and you will update later. and removed doc-label-missing labels Dec 28, 2023
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM. Impressive work @asafm!

Copy link
Contributor

@dragosvictor dragosvictor left a comment

Choose a reason for hiding this comment

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

Looks good, noted a couple of ideas below.

@asafm
Copy link
Contributor Author

asafm commented Jan 2, 2024

Thanks for the comments, @dragosvictor, very helpful! I replied to all. Can you re-review and resolve if it is solved?

Copy link
Contributor

@dragosvictor dragosvictor left a comment

Choose a reason for hiding this comment

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

Thanks for following up @asafm, looks good to me!

@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2024

Codecov Report

Attention: 34 lines in your changes are missing coverage. Please review.

Comparison is base (529e1ab) 73.69% compared to head (8953ffa) 73.59%.
Report is 26 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #21816      +/-   ##
============================================
- Coverage     73.69%   73.59%   -0.11%     
+ Complexity    32352    32343       -9     
============================================
  Files          1858     1860       +2     
  Lines        138144   138396     +252     
  Branches      15141    15175      +34     
============================================
+ Hits         101812   101855      +43     
- Misses        28490    28646     +156     
- Partials       7842     7895      +53     
Flag Coverage Δ
inttests 24.15% <19.14%> (-0.11%) ⬇️
systests 23.96% <19.14%> (+0.19%) ⬆️
unittests 72.86% <85.53%> (-0.13%) ⬇️

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

Files Coverage Δ
...che/bookkeeper/mledger/impl/ManagedLedgerImpl.java 80.49% <100.00%> (-0.68%) ⬇️
...ookkeeper/mledger/impl/ManagedLedgerMBeanImpl.java 89.70% <100.00%> (+0.39%) ⬆️
...rg/apache/pulsar/broker/service/BrokerService.java 81.14% <100.00%> (-0.01%) ⬇️
...n/java/org/apache/pulsar/broker/service/Topic.java 36.36% <ø> (ø)
...ker/service/persistent/PersistentTopicMetrics.java 100.00% <100.00%> (ø)
...broker/stats/prometheus/AggregatedBrokerStats.java 100.00% <100.00%> (ø)
...ker/stats/prometheus/AggregatedNamespaceStats.java 100.00% <100.00%> (ø)
...ker/stats/prometheus/NamespaceStatsAggregator.java 90.40% <100.00%> (+0.62%) ⬆️
...che/pulsar/broker/stats/prometheus/TopicStats.java 94.19% <100.00%> (+0.21%) ⬆️
...oker/service/nonpersistent/NonPersistentTopic.java 71.14% <50.00%> (-0.12%) ⬇️
... and 5 more

... and 81 files with indirect coverage changes

Copy link
Contributor

@codelipenghui codelipenghui left a comment

Choose a reason for hiding this comment

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

I will continue to review the remaining 2 classes.

  • PersistentTopic.java
  • BacklogQuotaManagerTest.java

Copy link
Contributor

@codelipenghui codelipenghui left a comment

Choose a reason for hiding this comment

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

Sorry, which test covers the cached timeBasedBacklogQuotaCheckResult really works?

@codelipenghui codelipenghui added this to the 3.3.0 milestone Jan 3, 2024
@codelipenghui codelipenghui added type/feature The PR added a new feature or issue requested a new feature area/broker labels Jan 3, 2024
@asafm
Copy link
Contributor Author

asafm commented Jan 3, 2024

@dragosvictor Can I resolve your comments?

@dragosvictor
Copy link
Contributor

@asafm Yes, for some reason I don't have access to resolve my own comments.

@lhotari
Copy link
Member

lhotari commented May 14, 2024

@codelipenghui This is a large change and causes a lot of merge conflicts. Do we really want this in maintenance branches?

@codelipenghui
Copy link
Contributor

@lhotari Yes, so I choose to create PR to cherry-pick it. So that I can get more eyes for review. The reason is the feature is existing for long time, but users don't have way to move it production due to the missed metrics(alerts).

codelipenghui pushed a commit to codelipenghui/incubator-pulsar that referenced this pull request May 17, 2024
Technoboy- pushed a commit that referenced this pull request May 18, 2024
…metry (#21816) (#22740)

Co-authored-by: Asaf Mesika <asaf.mesika@gmail.com>
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request May 31, 2024
…metry (apache#21816) (apache#22740)

Co-authored-by: Asaf Mesika <asaf.mesika@gmail.com>
(cherry picked from commit ce7a07b)
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2024
…metry (apache#21816) (apache#22740)

Co-authored-by: Asaf Mesika <asaf.mesika@gmail.com>
(cherry picked from commit ce7a07b)
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 4, 2024
…metry (apache#21816) (apache#22740)

Co-authored-by: Asaf Mesika <asaf.mesika@gmail.com>
(cherry picked from commit ce7a07b)
@lhotari
Copy link
Member

lhotari commented Jun 4, 2024

@codelipenghui Do you also have a chance to cherry-pick this to branch-3.2 ? there are quite a few merge conflicts.

srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Jun 7, 2024
…metry (apache#21816) (apache#22740)

Co-authored-by: Asaf Mesika <asaf.mesika@gmail.com>
(cherry picked from commit ce7a07b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker cherry-picked/branch-2.11 cherry-picked/branch-3.0 doc-required Your PR changes impact docs and you will update later. ready-to-test release/2.11.5 release/3.0.6 release/3.2.5 type/feature The PR added a new feature or issue requested a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants