Fix issue #3505: Set client description to identify Node.js client #453
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes issue #3505 by adding a
descriptionparameter to the Node.js client configuration. The default description is set to"node", which causes the client version in topic stats to display as"Pulsar-CPP-vX.Y.Z-node"instead of just"Pulsar-CPP-vX.Y.Z".Problem
The Node.js client wraps the C++ client library. When connecting to the broker, it uses the C++ client's version string, making it impossible to distinguish Node.js clients from C++ clients in topic statistics. This creates confusion for operators monitoring their Pulsar clusters.
Solution
descriptionparameter toClientConfiginterface"node"to identify the client as Node.jssetDescription()method from the C++ClientConfigurationclassChanges
src/Client.cc: Add description configuration parsing and set default valueindex.d.ts: Adddescription?: stringtoClientConfiginterfaceTesting
After applying this fix, the
clientVersionin topic stats will display as:"Pulsar-CPP-v4.0.0-node""Pulsar-CPP-v4.0.0-node-v1.0.0"(if description is"node-v1.0.0")Backward Compatibility
This change is fully backward compatible. Existing code will continue to work, and the client version string in topic stats will simply include the additional
-nodesuffix.Related Issues
Fixes #3505