Skip to content

Conversation

@nodece
Copy link
Member

@nodece nodece commented Sep 11, 2025

Motivation

PIP-254 only improved the pulsar-client. The pulsar-admin was not covered. This PR extends that work to also support the pulsar-admin. While not explicitly included in PIP-254, this can be considered a natural part of it.

Modifications

  • Update the user agent construction to append the client description if provided.
  • Add description(String) to the PulsarAdminBuilder and PulsarAdminBuilderImpl

Documentation

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

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Sep 11, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR extends the User-Agent header customization feature (originally implemented for pulsar-client in PIP-254) to the pulsar-admin component, allowing users to add custom descriptions to identify their applications.

  • Updates User-Agent construction in both pulsar-client and pulsar-admin to append client description when provided
  • Modifies the User-Agent format from "Pulsar-Java-v{version}" to "Pulsar-Java-v{version}-{description}" when description is set

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpClient.java Updates User-Agent construction to include optional client description
pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/http/AsyncHttpConnector.java Updates User-Agent construction to include optional client description

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@nodece nodece closed this Sep 11, 2025
@nodece nodece reopened this Sep 11, 2025
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.16%. Comparing base (415c6fa) to head (f20704b).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24729      +/-   ##
============================================
- Coverage     74.27%   74.16%   -0.11%     
+ Complexity    33569    33503      -66     
============================================
  Files          1896     1896              
  Lines        148111   148117       +6     
  Branches      17164    17166       +2     
============================================
- Hits         110009   109856     -153     
- Misses        29370    29460      +90     
- Partials       8732     8801      +69     
Flag Coverage Δ
inttests 26.33% <25.00%> (-0.17%) ⬇️
systests 22.70% <25.00%> (+0.03%) ⬆️
unittests 73.68% <100.00%> (-0.12%) ⬇️

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

Files with missing lines Coverage Δ
.../client/admin/internal/PulsarAdminBuilderImpl.java 76.23% <100.00%> (+0.48%) ⬆️
...client/admin/internal/http/AsyncHttpConnector.java 85.32% <100.00%> (-0.28%) ⬇️
...java/org/apache/pulsar/client/impl/HttpClient.java 81.81% <100.00%> (+0.25%) ⬆️

... and 87 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.

Comment on lines +288 to +291
public PulsarAdminBuilder description(String description) {
this.conf.setDescription(description);
return this;
}
Copy link
Member

Choose a reason for hiding this comment

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

@ApiModelProperty(
name = "description",
value = "The extra description of the client version. The length cannot exceed 64."
)
private String description;

Where is the check for the max 64 character limit? Please add a test that it's not allowed.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will make a PR to add this test.

Copy link
Contributor

@BewareMyPower BewareMyPower Sep 12, 2025

Choose a reason for hiding this comment

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

@nodece It seems that you merged without checking this comment

I didn't see your comment when I replied

Copy link
Member Author

Choose a reason for hiding this comment

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

@BewareMyPower Good catch. I should add the character limit in the builder.

Copy link
Member Author

Choose a reason for hiding this comment

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

@lhotari @BewareMyPower I submitted #24734 to fix this.

@nodece nodece merged commit e19856a into apache:master Sep 12, 2025
50 of 51 checks passed
@nodece nodece deleted the append-desc-to-ua branch September 12, 2025 01:59
@nodece nodece added this to the 4.2.0 milestone Sep 12, 2025
@nodece nodece self-assigned this Sep 12, 2025
nodece added a commit to ascentstream/pulsar that referenced this pull request Sep 12, 2025
apache#24729)

(cherry picked from commit e19856a)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
KannarFr pushed a commit to CleverCloud/pulsar that referenced this pull request Sep 22, 2025
lhotari pushed a commit that referenced this pull request Oct 6, 2025
walkinggo pushed a commit to walkinggo/pulsar that referenced this pull request Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants