Skip to content

[fix][broker] Unregister non-static metrics collectors registered in Prometheus default registry #24257

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

Conversation

lhotari
Copy link
Member

@lhotari lhotari commented May 6, 2025

Motivation

For upgrading Mockito to 5.17, it's necessary that already shutdown Pulsar broker test instances don't get referenced later. This is due to the way how Mockito mocks are cleaned up after each test. In newer Mockito versions, an exception will be thrown if such accesses happen.
Most metric collectors are static in Pulsar, but there are 2 instances in the broker where the collector dynamically gets the value. These should be unregistered at shutdown.

Modifications

  • add unregister logic to ObserverGauge class
  • unregister pendingTopicLoadRequests and pendingLookupRequests at shutdown

Documentation

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

@lhotari lhotari added this to the 4.1.0 milestone May 6, 2025
@lhotari lhotari self-assigned this May 6, 2025
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label May 6, 2025
@codecov-commenter
Copy link

codecov-commenter commented May 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.18%. Comparing base (bbc6224) to head (d34afbc).
Report is 1073 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24257      +/-   ##
============================================
+ Coverage     73.57%   74.18%   +0.61%     
+ Complexity    32624    32202     -422     
============================================
  Files          1877     1866      -11     
  Lines        139502   144978    +5476     
  Branches      15299    16561    +1262     
============================================
+ Hits         102638   107552    +4914     
- Misses        28908    28922      +14     
- Partials       7956     8504     +548     
Flag Coverage Δ
inttests 26.72% <45.45%> (+2.14%) ⬆️
systests 23.27% <45.45%> (-1.06%) ⬇️
unittests 73.65% <100.00%> (+0.81%) ⬆️

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

Files with missing lines Coverage Δ
...rg/apache/pulsar/broker/service/BrokerService.java 83.86% <100.00%> (+3.08%) ⬆️
...broker/stats/prometheus/metrics/ObserverGauge.java 100.00% <100.00%> (ø)

... and 1080 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lhotari lhotari merged commit 9cf821d into apache:master May 6, 2025
54 checks passed
lhotari added a commit that referenced this pull request May 9, 2025
…Prometheus default registry (#24257)

(cherry picked from commit 9cf821d)
lhotari added a commit that referenced this pull request May 9, 2025
…Prometheus default registry (#24257)

(cherry picked from commit 9cf821d)
lhotari added a commit that referenced this pull request May 9, 2025
…Prometheus default registry (#24257)

(cherry picked from commit 9cf821d)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 14, 2025
…Prometheus default registry (apache#24257)

(cherry picked from commit 9cf821d)
(cherry picked from commit 218c9c5)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 14, 2025
…Prometheus default registry (apache#24257)

(cherry picked from commit 9cf821d)
(cherry picked from commit b44db02)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 14, 2025
…Prometheus default registry (apache#24257)

(cherry picked from commit 9cf821d)
(cherry picked from commit 218c9c5)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 14, 2025
…Prometheus default registry (apache#24257)

(cherry picked from commit 9cf821d)
(cherry picked from commit b44db02)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 15, 2025
…Prometheus default registry (apache#24257)

(cherry picked from commit 9cf821d)
(cherry picked from commit b44db02)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 15, 2025
…Prometheus default registry (apache#24257)

(cherry picked from commit 9cf821d)
(cherry picked from commit b44db02)
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 15, 2025
…Prometheus default registry (apache#24257)

(cherry picked from commit 9cf821d)
(cherry picked from commit b44db02)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request May 16, 2025
…Prometheus default registry (apache#24257)

(cherry picked from commit 9cf821d)
(cherry picked from commit b44db02)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request May 18, 2025
…Prometheus default registry (apache#24257)

(cherry picked from commit 9cf821d)
(cherry picked from commit 218c9c5)
nodece pushed a commit to ascentstream/pulsar that referenced this pull request May 28, 2025
…Prometheus default registry (apache#24257)

(cherry picked from commit 9cf821d)
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.

5 participants