Fix issue #3505: Set client description to identify Node.js client#453
Closed
Fix issue #3505: Set client description to identify Node.js client#453
Conversation
Add 'description' parameter to Client configuration and set default value to 'node' so that clientVersion in topic stats displays as 'Pulsar-CPP-vX.Y.Z-node' instead of just 'Pulsar-CPP-vX.Y.Z'. This allows operators to distinguish Node.js clients from C++ clients in topic statistics. Changes: - Add CFG_DESCRIPTION constant for description configuration parameter - Parse description from JavaScript client configuration - Set default description to 'node' to identify as Node.js client - Add 'description' to TypeScript ClientConfig interface - Allow users to override description if needed Fixes #3505
Automatically set client description to 'node-client-vX.Y.Z' using the Node.js client version from package.json, so that clientVersion in topic stats displays as 'Pulsar-CPP-vX.Y.Z-node-client-vA.B.C' instead of just 'Pulsar-CPP-vX.Y.Z'. This allows operators to distinguish Node.js clients from C++ clients in topic statistics without requiring users to configure anything. Changes: - Add PULSAR_CLIENT_NODE_VERSION define in binding.gyp to read version from package.json - Set client description to 'node-client-v<version>' in Client constructor - Remove user-configurable description parameter (not needed, automatic) - Add <sstream> header for string formatting - Remove description from TypeScript ClientConfig interface Fixes #3505
Member
Author
|
Replacing with updated PR that correctly implements the fix - automatically setting client description without requiring user configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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