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

[improve] Add PulsarExceptionBase class that supports slf4j like parameterized string formatting #18968

Merged
merged 1 commit into from
Dec 22, 2022

Conversation

aahmed-se
Copy link
Contributor

@aahmed-se aahmed-se commented Dec 17, 2022

Motivation

We frequently have to pass strings to exceptions, similar to log4j , this allows us to use the same parameterized formatting in both.

Modifications

Verifying this change

  • Make sure that the change passes the CI checks.

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

Documentation

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

@aahmed-se aahmed-se self-assigned this Dec 17, 2022
@github-actions
Copy link

@aahmed-se 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 -->

@aahmed-se aahmed-se changed the title Add PulsarExceptionBase class that supports slf4j like parameterized … Add PulsarExceptionBase class that supports slf4j like slf4j like parameterized string formatting Dec 17, 2022
@aahmed-se aahmed-se added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Dec 17, 2022
@github-actions github-actions bot added doc-label-missing and removed doc-not-needed Your PR changes do not impact docs labels Dec 17, 2022
@aahmed-se aahmed-se added ready-to-test doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Dec 17, 2022
@github-actions github-actions bot added doc-label-missing and removed doc-not-needed Your PR changes do not impact docs labels Dec 17, 2022
@aahmed-se aahmed-se added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Dec 17, 2022
@github-actions github-actions bot added doc-label-missing doc-not-needed Your PR changes do not impact docs and removed doc-not-needed Your PR changes do not impact docs doc-label-missing labels Dec 17, 2022
@aahmed-se aahmed-se changed the title Add PulsarExceptionBase class that supports slf4j like slf4j like parameterized string formatting Add PulsarExceptionBase class that supports slf4j like parameterized string formatting Dec 17, 2022
@aahmed-se aahmed-se changed the title Add PulsarExceptionBase class that supports slf4j like parameterized string formatting [improvement] Add PulsarExceptionBase class that supports slf4j like parameterized string formatting Dec 17, 2022
@aahmed-se aahmed-se changed the title [improvement] Add PulsarExceptionBase class that supports slf4j like parameterized string formatting [improve] Add PulsarExceptionBase class that supports slf4j like parameterized string formatting Dec 17, 2022
@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2022

Codecov Report

Merging #18968 (a23bcba) into master (08591d9) will decrease coverage by 3.60%.
The diff coverage is 72.72%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #18968      +/-   ##
============================================
- Coverage     49.85%   46.24%   -3.61%     
- Complexity     8658    10170    +1512     
============================================
  Files           500      683     +183     
  Lines         54930    67107   +12177     
  Branches       5867     7196    +1329     
============================================
+ Hits          27386    31036    +3650     
- Misses        24464    32614    +8150     
- Partials       3080     3457     +377     
Flag Coverage Δ
unittests 46.24% <72.72%> (-3.61%) ⬇️

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

Impacted Files Coverage Δ
...g/apache/pulsar/broker/lookup/TopicLookupBase.java 55.17% <ø> (+4.33%) ⬆️
...rg/apache/pulsar/broker/web/PulsarWebResource.java 58.34% <ø> (+2.68%) ⬆️
...pulsar/broker/admin/impl/PersistentTopicsBase.java 59.22% <72.72%> (+0.50%) ⬆️
...rvice/schema/KeyValueSchemaCompatibilityCheck.java 21.62% <0.00%> (-45.95%) ⬇️
...apache/pulsar/broker/service/TopicListService.java 10.40% <0.00%> (-42.40%) ⬇️
...pulsar/broker/service/PulsarCommandSenderImpl.java 57.65% <0.00%> (-17.86%) ⬇️
.../apache/pulsar/broker/loadbalance/LoadManager.java 61.11% <0.00%> (-16.67%) ⬇️
...tent/NonPersistentDispatcherMultipleConsumers.java 40.74% <0.00%> (-12.35%) ⬇️
...ava/org/apache/pulsar/broker/service/Consumer.java 68.68% <0.00%> (-3.39%) ⬇️
.../service/SystemTopicBasedTopicPoliciesService.java 70.12% <0.00%> (-3.05%) ⬇️
... and 269 more

@congbobo184
Copy link
Contributor

It doesn't seem to be used anywhere in Pulsar, and I'm not sure if it should really be added. Is it just an abstract class for users?

@aahmed-se
Copy link
Contributor Author

@congbobo184 it will be used in future pull requests, we will extend existing pulsar exceptions with this class and replace all strings with append operations with formatters.

@congbobo184
Copy link
Contributor

thanks for your answer, it seems it can add a test. could you please add a test for it? to prevent other PRs from making incorrect changes

@aahmed-se
Copy link
Contributor Author

@congbobo184 @merlimat I have updated it and added test cases.

@aahmed-se aahmed-se merged commit 8990855 into apache:master Dec 22, 2022
@aahmed-se aahmed-se deleted the exception_base branch December 22, 2022 03:23
@Technoboy- Technoboy- added this to the 3.0.0 milestone Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test release/2.11.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants