diff options
Diffstat (limited to 'src/cpp/client/create_channel.cc')
-rw-r--r-- | src/cpp/client/create_channel.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index 510af2bb00..62f179d361 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -32,9 +32,11 @@ */ #include <memory> +#include <sstream> #include "src/cpp/client/channel.h" #include <grpc++/channel_interface.h> +#include <grpc++/channel_arguments.h> #include <grpc++/create_channel.h> namespace grpc { @@ -43,8 +45,13 @@ class ChannelArguments; std::shared_ptr<ChannelInterface> CreateChannel( const grpc::string& target, const std::shared_ptr<Credentials>& creds, const ChannelArguments& args) { - return creds ? creds->CreateChannel(target, args) + ChannelArguments cp_args = args; + std::ostringstream user_agent_prefix; + user_agent_prefix << "grpc-c++/" << grpc_version_string(); + cp_args.SetString(GRPC_ARG_PRIMARY_USER_AGENT_STRING, + user_agent_prefix.str()); + return creds ? creds->CreateChannel(target, cp_args) : std::shared_ptr<ChannelInterface>( - new Channel(target, grpc_lame_client_channel_create())); + new Channel(target, grpc_lame_client_channel_create(NULL))); } } // namespace grpc |