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.

@asafm
Copy link
Contributor Author

asafm commented Jan 4, 2024

@codelipenghui I addressed all your comments.
Can you please recheck the code, resolve the comments, and approve the workflow?

@asafm
Copy link
Contributor Author

asafm commented Jan 9, 2024

@codelipenghui Found a different, better, less flaky way to test if cache was used.

@asafm
Copy link
Contributor Author

asafm commented Jan 9, 2024

@lhotari Can you open the permissions to run the workflows?

@asafm
Copy link
Contributor Author

asafm commented Jan 11, 2024

/pulsarbot rerun-failure-checks

@codelipenghui codelipenghui merged commit 59782b3 into apache:master Jan 17, 2024
46 of 47 checks passed
@asafm asafm deleted the pip-323-implementation branch January 17, 2024 15:03
@asafm
Copy link
Contributor Author

asafm commented Jan 17, 2024

Added docs at apache/pulsar-site#773

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 doc-required Your PR changes impact docs and you will update later. ready-to-test release/2.11.5 release/3.0.5 release/3.2.3 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.

None yet

7 participants