add setting channel args functionality to performance tesing

setting channel args --draft

clang-format
pull/8770/head
Yuxuan Li 8 years ago
parent a3960b98d6
commit 98c0bd7c82
  1. 10
      src/proto/grpc/testing/control.proto
  2. 13
      test/cpp/qps/client.h

@ -78,6 +78,14 @@ message SecurityParams {
string server_host_override = 2;
}
message ChannelArg {
string name = 1;
oneof value {
string str_value = 2;
int32 int_value = 3;
}
}
message ClientConfig {
// List of targets to connect to. At least one target needs to be specified.
repeated string server_targets = 1;
@ -103,6 +111,8 @@ message ClientConfig {
// If we use an OTHER_CLIENT client_type, this string gives more detail
string other_client_api = 15;
repeated ChannelArg channel_args = 16;
}
message ClientStatus { ClientStats stats = 1; }

@ -409,6 +409,7 @@ class ClientImpl : public Client {
// old compilers happy with using this in std::vector
ChannelArguments args;
args.SetInt("shard_to_ensure_no_subchannel_merges", shard);
set_channel_args(config, &args);
channel_ = CreateTestChannel(
target, config.security_params().server_host_override(),
config.has_security_params(), !config.security_params().use_test_ca(),
@ -423,6 +424,18 @@ class ClientImpl : public Client {
StubType* get_stub() { return stub_.get(); }
private:
void set_channel_args(const ClientConfig& config, ChannelArguments* args) {
for (auto channel_arg : config.channel_args()) {
if (channel_arg.value_case() == ChannelArg::kStrValue) {
args->SetString(channel_arg.name(), channel_arg.str_value());
} else if (channel_arg.value_case() == ChannelArg::kIntValue) {
args->SetInt(channel_arg.name(), channel_arg.int_value());
} else {
gpr_log(GPR_ERROR, "Empty channel arg value.");
}
}
}
std::shared_ptr<Channel> channel_;
std::unique_ptr<StubType> stub_;
};

Loading…
Cancel
Save