Set client description to identify Node.js client #454
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 automatically setting the client description to
"node-client-vX.Y.Z"whereX.Y.Zis the Node.js client version from package.json. After this fix, theclientVersionin topic statistics will display as"Pulsar-CPP-vA.B.C-node-client-vX.Y.Z"instead of just"Pulsar-CPP-vA.B.C".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
Automatically set client description using the Node.js client version from package.json. The description is set to
"node-client-vX.Y.Z"format during client initialization. This is done transparently without requiring any user configuration.Changes
PULSAR_CLIENT_NODE_VERSIONdefine to read version from package.json at build time"node-client-v<version>"format in client constructordescriptionparameter fromClientConfig(not needed, automatic)Result
After this fix,
clientVersionin topic stats will display as:"Pulsar-CPP-v4.0.0-node-client-v1.17.0-rc.0"Pulsar-CPP-v4.0.0): C++ client version-node-client-v1.17.0-rc.0): Node.js client identifier and versionBackward Compatibility
This change is fully backward compatible. Existing code will continue to work without any changes. The only visible change is that
clientVersionin topic statistics will now include the Node.js client identifier.