xds_interop_client.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2020 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #include <atomic>
20 #include <chrono>
21 #include <condition_variable>
22 #include <deque>
23 #include <map>
24 #include <mutex>
25 #include <set>
26 #include <sstream>
27 #include <string>
28 #include <thread>
29 #include <vector>
30 
31 #include "absl/algorithm/container.h"
32 #include "absl/flags/flag.h"
33 #include "absl/strings/str_split.h"
34 
37 #include <grpcpp/grpcpp.h>
38 #include <grpcpp/server.h>
39 #include <grpcpp/server_builder.h>
40 #include <grpcpp/server_context.h>
41 
43 #include "src/core/lib/gpr/env.h"
44 #include "src/proto/grpc/testing/empty.pb.h"
45 #include "src/proto/grpc/testing/messages.pb.h"
46 #include "src/proto/grpc/testing/test.grpc.pb.h"
49 
50 ABSL_FLAG(bool, fail_on_failed_rpc, false,
51  "Fail client if any RPCs fail after first successful RPC.");
52 ABSL_FLAG(int32_t, num_channels, 1, "Number of channels.");
53 ABSL_FLAG(bool, print_response, false, "Write RPC response to stdout.");
54 ABSL_FLAG(int32_t, qps, 1, "Qps per channel.");
55 // TODO(Capstan): Consider using absl::Duration
56 ABSL_FLAG(int32_t, rpc_timeout_sec, 30, "Per RPC timeout seconds.");
57 ABSL_FLAG(std::string, server, "localhost:50051", "Address of server.");
58 ABSL_FLAG(int32_t, stats_port, 50052,
59  "Port to expose peer distribution stats service.");
60 ABSL_FLAG(std::string, rpc, "UnaryCall",
61  "a comma separated list of rpc methods.");
62 ABSL_FLAG(std::string, metadata, "", "metadata to send with the RPC.");
63 ABSL_FLAG(std::string, expect_status, "OK",
64  "RPC status for the test RPC to be considered successful");
65 ABSL_FLAG(
66  bool, secure_mode, false,
67  "If true, XdsCredentials are used, InsecureChannelCredentials otherwise");
68 
69 using grpc::Channel;
73 using grpc::Server;
76 using grpc::Status;
77 using grpc::testing::ClientConfigureRequest;
78 using grpc::testing::ClientConfigureRequest_RpcType_Name;
79 using grpc::testing::ClientConfigureResponse;
80 using grpc::testing::Empty;
81 using grpc::testing::LoadBalancerAccumulatedStatsRequest;
83 using grpc::testing::LoadBalancerStatsRequest;
85 using grpc::testing::LoadBalancerStatsService;
88 using grpc::testing::TestService;
89 using grpc::testing::XdsUpdateClientConfigureService;
90 
91 class XdsStatsWatcher;
92 
93 struct StatsWatchers {
94  // Unique ID for each outgoing RPC
96  // Unique ID for each outgoing RPC by RPC method type
97  std::map<int, int> global_request_id_by_type;
98  // Stores a set of watchers that should be notified upon outgoing RPC
99  // completion
100  std::set<XdsStatsWatcher*> watchers;
101  // Global watcher for accumululated stats.
103  // Mutex for global_request_id and watchers
105 };
106 // Whether at least one RPC has succeeded, indicating xDS resolution completed.
107 std::atomic<bool> one_rpc_succeeded(false);
108 // RPC configuration detailing how RPC should be sent.
109 struct RpcConfig {
110  ClientConfigureRequest::RpcType type;
111  std::vector<std::pair<std::string, std::string>> metadata;
112  int timeout_sec = 0;
113 };
115  // A queue of RPC configurations detailing how RPCs should be sent.
116  std::deque<std::vector<RpcConfig>> rpc_configs_queue;
117  // Mutex for rpc_configs_queue
119 };
126  ClientConfigureRequest::RpcType rpc_type;
127  std::unique_ptr<ClientAsyncResponseReader<Empty>> empty_response_reader;
128  std::unique_ptr<ClientAsyncResponseReader<SimpleResponse>>
130 };
131 
134  public:
135  XdsStatsWatcher(int start_id, int end_id)
136  : start_id_(start_id), end_id_(end_id), rpcs_needed_(end_id - start_id) {}
137 
138  // Upon the completion of an RPC, we will look at the request_id, the
139  // rpc_type, and the peer the RPC was sent to in order to count
140  // this RPC into the right stats bin.
142  // We count RPCs for global watcher or if the request_id falls into the
143  // watcher's interested range of request ids.
144  if ((start_id_ == 0 && end_id_ == 0) ||
145  (start_id_ <= call->saved_request_id &&
146  call->saved_request_id < end_id_)) {
147  {
148  std::lock_guard<std::mutex> lock(m_);
149  if (peer.empty()) {
150  no_remote_peer_++;
151  ++no_remote_peer_by_type_[call->rpc_type];
152  } else {
153  // RPC is counted into both per-peer bin and per-method-per-peer bin.
154  rpcs_by_peer_[peer]++;
155  rpcs_by_type_[call->rpc_type][peer]++;
156  }
157  rpcs_needed_--;
158  // Report accumulated stats.
159  auto& stats_per_method = *accumulated_stats_.mutable_stats_per_method();
160  auto& method_stat =
161  stats_per_method[ClientConfigureRequest_RpcType_Name(
162  call->rpc_type)];
163  auto& result = *method_stat.mutable_result();
165  static_cast<grpc_status_code>(call->status.error_code());
166  auto& num_rpcs = result[code];
167  ++num_rpcs;
168  auto rpcs_started = method_stat.rpcs_started();
169  method_stat.set_rpcs_started(++rpcs_started);
170  }
171  cv_.notify_one();
172  }
173  }
174 
176  int timeout_sec) {
177  std::unique_lock<std::mutex> lock(m_);
178  cv_.wait_for(lock, std::chrono::seconds(timeout_sec),
179  [this] { return rpcs_needed_ == 0; });
180  response->mutable_rpcs_by_peer()->insert(rpcs_by_peer_.begin(),
181  rpcs_by_peer_.end());
182  auto& response_rpcs_by_method = *response->mutable_rpcs_by_method();
183  for (const auto& rpc_by_type : rpcs_by_type_) {
185  if (rpc_by_type.first == ClientConfigureRequest::EMPTY_CALL) {
186  method_name = "EmptyCall";
187  } else if (rpc_by_type.first == ClientConfigureRequest::UNARY_CALL) {
188  method_name = "UnaryCall";
189  } else {
190  GPR_ASSERT(0);
191  }
192  // TODO(@donnadionne): When the test runner changes to accept EMPTY_CALL
193  // and UNARY_CALL we will just use the name of the enum instead of the
194  // method_name variable.
195  auto& response_rpc_by_method = response_rpcs_by_method[method_name];
196  auto& response_rpcs_by_peer =
197  *response_rpc_by_method.mutable_rpcs_by_peer();
198  for (const auto& rpc_by_peer : rpc_by_type.second) {
199  auto& response_rpc_by_peer = response_rpcs_by_peer[rpc_by_peer.first];
200  response_rpc_by_peer = rpc_by_peer.second;
201  }
202  }
203  response->set_num_failures(no_remote_peer_ + rpcs_needed_);
204  }
205 
207  StatsWatchers* stats_watchers) {
208  std::unique_lock<std::mutex> lock(m_);
209  response->CopyFrom(accumulated_stats_);
210  // TODO(@donnadionne): delete deprecated stats below when the test is no
211  // longer using them.
212  auto& response_rpcs_started_by_method =
213  *response->mutable_num_rpcs_started_by_method();
214  auto& response_rpcs_succeeded_by_method =
215  *response->mutable_num_rpcs_succeeded_by_method();
216  auto& response_rpcs_failed_by_method =
217  *response->mutable_num_rpcs_failed_by_method();
218  for (const auto& rpc_by_type : rpcs_by_type_) {
219  auto total_succeeded = 0;
220  for (const auto& rpc_by_peer : rpc_by_type.second) {
221  total_succeeded += rpc_by_peer.second;
222  }
223  response_rpcs_succeeded_by_method[ClientConfigureRequest_RpcType_Name(
224  rpc_by_type.first)] = total_succeeded;
225  response_rpcs_started_by_method[ClientConfigureRequest_RpcType_Name(
226  rpc_by_type.first)] =
227  stats_watchers->global_request_id_by_type[rpc_by_type.first];
228  response_rpcs_failed_by_method[ClientConfigureRequest_RpcType_Name(
229  rpc_by_type.first)] = no_remote_peer_by_type_[rpc_by_type.first];
230  }
231  }
232 
233  private:
235  int end_id_;
238  std::map<int, int> no_remote_peer_by_type_;
239  // A map of stats keyed by peer name.
240  std::map<std::string, int> rpcs_by_peer_;
241  // A two-level map of stats keyed at top level by RPC method and second level
242  // by peer name.
243  std::map<int, std::map<std::string, int>> rpcs_by_type_;
244  // Storing accumulated stats in the response proto format.
247  std::condition_variable cv_;
248 };
249 
250 class TestClient {
251  public:
252  TestClient(const std::shared_ptr<Channel>& channel,
253  StatsWatchers* stats_watchers)
254  : stub_(TestService::NewStub(channel)), stats_watchers_(stats_watchers) {}
255 
258  int saved_request_id;
259  {
260  std::lock_guard<std::mutex> lock(stats_watchers_->mu);
261  saved_request_id = ++stats_watchers_->global_request_id;
263  ->global_request_id_by_type[ClientConfigureRequest::UNARY_CALL];
264  }
267  std::chrono::seconds(config.timeout_sec != 0
268  ? config.timeout_sec
269  : absl::GetFlag(FLAGS_rpc_timeout_sec));
271  for (const auto& data : config.metadata) {
272  call->context.AddMetadata(data.first, data.second);
273  // TODO(@donnadionne): move deadline to separate proto.
274  if (data.first == "rpc-behavior" && data.second == "keep-open") {
275  deadline =
277  }
278  }
279  call->context.set_deadline(deadline);
280  call->saved_request_id = saved_request_id;
281  call->rpc_type = ClientConfigureRequest::UNARY_CALL;
282  call->simple_response_reader = stub_->PrepareAsyncUnaryCall(
283  &call->context, SimpleRequest::default_instance(), &cq_);
284  call->simple_response_reader->StartCall();
285  call->simple_response_reader->Finish(&call->simple_response, &call->status,
286  call);
287  }
288 
290  Empty response;
291  int saved_request_id;
292  {
293  std::lock_guard<std::mutex> lock(stats_watchers_->mu);
294  saved_request_id = ++stats_watchers_->global_request_id;
296  ->global_request_id_by_type[ClientConfigureRequest::EMPTY_CALL];
297  }
300  std::chrono::seconds(config.timeout_sec != 0
301  ? config.timeout_sec
302  : absl::GetFlag(FLAGS_rpc_timeout_sec));
304  for (const auto& data : config.metadata) {
305  call->context.AddMetadata(data.first, data.second);
306  // TODO(@donnadionne): move deadline to separate proto.
307  if (data.first == "rpc-behavior" && data.second == "keep-open") {
308  deadline =
310  }
311  }
312  call->context.set_deadline(deadline);
313  call->saved_request_id = saved_request_id;
314  call->rpc_type = ClientConfigureRequest::EMPTY_CALL;
315  call->empty_response_reader = stub_->PrepareAsyncEmptyCall(
316  &call->context, Empty::default_instance(), &cq_);
317  call->empty_response_reader->StartCall();
318  call->empty_response_reader->Finish(&call->empty_response, &call->status,
319  call);
320  }
321 
323  void* got_tag;
324  bool ok = false;
325  while (cq_.Next(&got_tag, &ok)) {
326  AsyncClientCall* call = static_cast<AsyncClientCall*>(got_tag);
327  GPR_ASSERT(ok);
328  {
329  std::lock_guard<std::mutex> lock(stats_watchers_->mu);
330  auto server_initial_metadata = call->context.GetServerInitialMetadata();
331  auto metadata_hostname =
332  call->context.GetServerInitialMetadata().find("hostname");
333  std::string hostname =
334  metadata_hostname != call->context.GetServerInitialMetadata().end()
335  ? std::string(metadata_hostname->second.data(),
336  metadata_hostname->second.length())
337  : call->simple_response.hostname();
338  for (auto watcher : stats_watchers_->watchers) {
339  watcher->RpcCompleted(call, hostname);
340  }
341  }
342 
343  if (!RpcStatusCheckSuccess(call)) {
344  if (absl::GetFlag(FLAGS_print_response) ||
345  absl::GetFlag(FLAGS_fail_on_failed_rpc)) {
346  std::cout << "RPC failed: " << call->status.error_code() << ": "
347  << call->status.error_message() << std::endl;
348  }
349  if (absl::GetFlag(FLAGS_fail_on_failed_rpc) &&
350  one_rpc_succeeded.load()) {
351  abort();
352  }
353  } else {
354  if (absl::GetFlag(FLAGS_print_response)) {
355  auto metadata_hostname =
356  call->context.GetServerInitialMetadata().find("hostname");
357  std::string hostname =
358  metadata_hostname !=
359  call->context.GetServerInitialMetadata().end()
360  ? std::string(metadata_hostname->second.data(),
361  metadata_hostname->second.length())
362  : call->simple_response.hostname();
363  std::cout << "Greeting: Hello world, this is " << hostname
364  << ", from " << call->context.peer() << std::endl;
365  }
366  one_rpc_succeeded = true;
367  }
368 
369  delete call;
370  }
371  }
372 
373  private:
375  // Determine RPC success based on expected status.
378  absl::GetFlag(FLAGS_expect_status).c_str(), &code));
379  return code == static_cast<grpc_status_code>(call->status.error_code());
380  }
381 
382  std::unique_ptr<TestService::Stub> stub_;
385 };
386 
387 class LoadBalancerStatsServiceImpl : public LoadBalancerStatsService::Service {
388  public:
389  explicit LoadBalancerStatsServiceImpl(StatsWatchers* stats_watchers)
390  : stats_watchers_(stats_watchers) {}
391 
393  const LoadBalancerStatsRequest* request,
395  int start_id;
396  int end_id;
398  {
399  std::lock_guard<std::mutex> lock(stats_watchers_->mu);
400  start_id = stats_watchers_->global_request_id + 1;
401  end_id = start_id + request->num_rpcs();
402  watcher = new XdsStatsWatcher(start_id, end_id);
404  }
405  watcher->WaitForRpcStatsResponse(response, request->timeout_sec());
406  {
407  std::lock_guard<std::mutex> lock(stats_watchers_->mu);
409  }
410  delete watcher;
411  return Status::OK;
412  }
413 
415  ServerContext* /*context*/,
416  const LoadBalancerAccumulatedStatsRequest* /*request*/,
418  std::lock_guard<std::mutex> lock(stats_watchers_->mu);
421  return Status::OK;
422  }
423 
424  private:
426 };
427 
429  : public XdsUpdateClientConfigureService::Service {
430  public:
432  RpcConfigurationsQueue* rpc_configs_queue)
433  : rpc_configs_queue_(rpc_configs_queue) {}
434 
436  const ClientConfigureRequest* request,
437  ClientConfigureResponse* /*response*/) override {
438  std::map<int, std::vector<std::pair<std::string, std::string>>>
439  metadata_map;
440  for (const auto& data : request->metadata()) {
441  metadata_map[data.type()].push_back({data.key(), data.value()});
442  }
443  std::vector<RpcConfig> configs;
444  for (const auto& rpc : request->types()) {
446  config.timeout_sec = request->timeout_sec();
447  config.type = static_cast<ClientConfigureRequest::RpcType>(rpc);
448  auto metadata_iter = metadata_map.find(rpc);
449  if (metadata_iter != metadata_map.end()) {
450  config.metadata = metadata_iter->second;
451  }
452  configs.push_back(std::move(config));
453  }
454  {
455  std::lock_guard<std::mutex> lock(
458  }
459  return Status::OK;
460  }
461 
462  private:
464 };
465 
466 void RunTestLoop(std::chrono::duration<double> duration_per_query,
467  StatsWatchers* stats_watchers,
468  RpcConfigurationsQueue* rpc_configs_queue) {
469  grpc::ChannelArguments channel_args;
470  channel_args.SetInt(GRPC_ARG_ENABLE_RETRIES, 1);
473  absl::GetFlag(FLAGS_secure_mode)
477  channel_args),
478  stats_watchers);
479  std::chrono::time_point<std::chrono::system_clock> start =
481  std::chrono::duration<double> elapsed;
482 
484 
485  std::vector<RpcConfig> configs;
486  while (true) {
487  {
488  std::lock_guard<std::mutex> lockk(
489  rpc_configs_queue->mu_rpc_configs_queue);
490  if (!rpc_configs_queue->rpc_configs_queue.empty()) {
491  configs = std::move(rpc_configs_queue->rpc_configs_queue.front());
492  rpc_configs_queue->rpc_configs_queue.pop_front();
493  }
494  }
495 
497  if (elapsed > duration_per_query) {
499  for (const auto& config : configs) {
500  if (config.type == ClientConfigureRequest::EMPTY_CALL) {
501  client.AsyncEmptyCall(config);
502  } else if (config.type == ClientConfigureRequest::UNARY_CALL) {
503  client.AsyncUnaryCall(config);
504  } else {
505  GPR_ASSERT(0);
506  }
507  }
508  }
509  }
511 }
512 
513 void RunServer(const int port, StatsWatchers* stats_watchers,
514  RpcConfigurationsQueue* rpc_configs_queue) {
515  GPR_ASSERT(port != 0);
516  std::ostringstream server_address;
517  server_address << "0.0.0.0:" << port;
518 
519  LoadBalancerStatsServiceImpl stats_service(stats_watchers);
520  XdsUpdateClientConfigureServiceImpl client_config_service(rpc_configs_queue);
521 
524  builder.RegisterService(&stats_service);
525  builder.RegisterService(&client_config_service);
527  builder.AddListeningPort(server_address.str(),
529  std::unique_ptr<Server> server(builder.BuildAndStart());
530  gpr_log(GPR_DEBUG, "Server listening on %s", server_address.str().c_str());
531 
532  server->Wait();
533 }
534 
536  // Store Metadata like
537  // "EmptyCall:key1:value1,UnaryCall:key1:value1,UnaryCall:key2:value2" into a
538  // map where the key is the RPC method and value is a vector of key:value
539  // pairs. {EmptyCall, [{key1,value1}],
540  // UnaryCall, [{key1,value1}, {key2,value2}]}
541  std::vector<std::string> rpc_metadata =
542  absl::StrSplit(absl::GetFlag(FLAGS_metadata), ',', absl::SkipEmpty());
543  std::map<int, std::vector<std::pair<std::string, std::string>>> metadata_map;
544  for (auto& data : rpc_metadata) {
545  std::vector<std::string> metadata =
547  GPR_ASSERT(metadata.size() == 3);
548  if (metadata[0] == "EmptyCall") {
549  metadata_map[ClientConfigureRequest::EMPTY_CALL].push_back(
550  {metadata[1], metadata[2]});
551  } else if (metadata[0] == "UnaryCall") {
552  metadata_map[ClientConfigureRequest::UNARY_CALL].push_back(
553  {metadata[1], metadata[2]});
554  } else {
555  GPR_ASSERT(0);
556  }
557  }
558  std::vector<RpcConfig> configs;
559  std::vector<std::string> rpc_methods =
560  absl::StrSplit(absl::GetFlag(FLAGS_rpc), ',', absl::SkipEmpty());
561  for (const std::string& rpc_method : rpc_methods) {
563  if (rpc_method == "EmptyCall") {
564  config.type = ClientConfigureRequest::EMPTY_CALL;
565  } else if (rpc_method == "UnaryCall") {
566  config.type = ClientConfigureRequest::UNARY_CALL;
567  } else {
568  GPR_ASSERT(0);
569  }
570  auto metadata_iter = metadata_map.find(config.type);
571  if (metadata_iter != metadata_map.end()) {
572  config.metadata = metadata_iter->second;
573  }
574  configs.push_back(std::move(config));
575  }
576  {
577  std::lock_guard<std::mutex> lock(rpc_configs_queue->mu_rpc_configs_queue);
578  rpc_configs_queue->rpc_configs_queue.emplace_back(std::move(configs));
579  }
580 }
581 
582 int main(int argc, char** argv) {
583  grpc::testing::TestEnvironment env(&argc, argv);
584  grpc::testing::InitTest(&argc, &argv, true);
585  // Validate the expect_status flag.
588  absl::GetFlag(FLAGS_expect_status).c_str(), &code));
589  StatsWatchers stats_watchers;
590  RpcConfigurationsQueue rpc_config_queue;
591 
592  {
593  std::lock_guard<std::mutex> lock(stats_watchers.mu);
594  stats_watchers.global_watcher = new XdsStatsWatcher(0, 0);
595  stats_watchers.watchers.insert(stats_watchers.global_watcher);
596  }
597 
598  BuildRpcConfigsFromFlags(&rpc_config_queue);
599 
600  std::chrono::duration<double> duration_per_query =
601  std::chrono::nanoseconds(std::chrono::seconds(1)) /
602  absl::GetFlag(FLAGS_qps);
603 
604  std::vector<std::thread> test_threads;
605  test_threads.reserve(absl::GetFlag(FLAGS_num_channels));
606  for (int i = 0; i < absl::GetFlag(FLAGS_num_channels); i++) {
607  test_threads.emplace_back(std::thread(&RunTestLoop, duration_per_query,
608  &stats_watchers, &rpc_config_queue));
609  }
610 
611  RunServer(absl::GetFlag(FLAGS_stats_port), &stats_watchers,
612  &rpc_config_queue);
613 
614  for (auto it = test_threads.begin(); it != test_threads.end(); it++) {
615  it->join();
616  }
617 
618  return 0;
619 }
absl::StrSplit
strings_internal::Splitter< typename strings_internal::SelectDelimiter< Delimiter >::type, AllowEmpty, absl::string_view > StrSplit(strings_internal::ConvertibleToStringView text, Delimiter d)
Definition: abseil-cpp/absl/strings/str_split.h:499
RpcConfigurationsQueue::rpc_configs_queue
std::deque< std::vector< RpcConfig > > rpc_configs_queue
Definition: xds_interop_client.cc:116
TestClient::stub_
std::unique_ptr< TestService::Stub > stub_
Definition: xds_interop_client.cc:382
grpc::testing::InitTest
void InitTest(int *argc, char ***argv, bool remove_flags)
Definition: test_config_cc.cc:28
messages_pb2.SimpleRequest
SimpleRequest
Definition: messages_pb2.py:597
absl::time_internal::cctz::seconds
std::chrono::duration< std::int_fast64_t > seconds
Definition: abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h:40
BuildRpcConfigsFromFlags
void BuildRpcConfigsFromFlags(RpcConfigurationsQueue *rpc_configs_queue)
Definition: xds_interop_client.cc:535
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
now
static double now(void)
Definition: test/core/fling/client.cc:130
regen-readme.it
it
Definition: regen-readme.py:15
grpc::ServerContext
Definition: grpcpp/impl/codegen/server_context.h:566
XdsStatsWatcher::no_remote_peer_
int no_remote_peer_
Definition: xds_interop_client.cc:237
generate.env
env
Definition: generate.py:37
metadata
Definition: cq_verifier.cc:48
TestClient::TestClient
TestClient(const std::shared_ptr< Channel > &channel, StatsWatchers *stats_watchers)
Definition: xds_interop_client.cc:252
LoadBalancerStatsServiceImpl::GetClientStats
Status GetClientStats(ServerContext *, const LoadBalancerStatsRequest *request, LoadBalancerStatsResponse *response) override
Definition: xds_interop_client.cc:392
LoadBalancerStatsServiceImpl::stats_watchers_
StatsWatchers * stats_watchers_
Definition: xds_interop_client.cc:425
mutex
static uv_mutex_t mutex
Definition: threadpool.c:34
absl::time_internal::cctz::time_point
std::chrono::time_point< std::chrono::system_clock, D > time_point
Definition: abseil-cpp/absl/time/internal/cctz/include/cctz/time_zone.h:39
StatsWatchers::global_request_id
int global_request_id
Definition: xds_interop_client.cc:95
proto_server_reflection_plugin.h
client
Definition: examples/python/async_streaming/client.py:1
status_util.h
LoadBalancerStatsServiceImpl::GetClientAccumulatedStats
Status GetClientAccumulatedStats(ServerContext *, const LoadBalancerAccumulatedStatsRequest *, LoadBalancerAccumulatedStatsResponse *response) override
Definition: xds_interop_client.cc:414
XdsStatsWatcher::start_id_
int start_id_
Definition: xds_interop_client.cc:234
benchmark.request
request
Definition: benchmark.py:77
XdsUpdateClientConfigureServiceImpl::rpc_configs_queue_
RpcConfigurationsQueue * rpc_configs_queue_
Definition: xds_interop_client.cc:463
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
grpc_status_code
grpc_status_code
Definition: include/grpc/impl/codegen/status.h:28
RpcConfigurationsQueue::mu_rpc_configs_queue
std::mutex mu_rpc_configs_queue
Definition: xds_interop_client.cc:118
framework.rpc.grpc_channelz.Server
Server
Definition: grpc_channelz.py:42
XdsStatsWatcher::accumulated_stats_
LoadBalancerAccumulatedStatsResponse accumulated_stats_
Definition: xds_interop_client.cc:245
framework.rpc.grpc_testing.LoadBalancerAccumulatedStatsResponse
LoadBalancerAccumulatedStatsResponse
Definition: grpc_testing.py:34
OK
@ OK
Definition: cronet_status.h:43
RpcConfig
Definition: xds_interop_client.cc:109
grpc::experimental::XdsCredentials
std::shared_ptr< ChannelCredentials > XdsCredentials(const std::shared_ptr< ChannelCredentials > &fallback_creds)
Definition: cpp/client/xds_credentials.cc:48
XdsStatsWatcher::no_remote_peer_by_type_
std::map< int, int > no_remote_peer_by_type_
Definition: xds_interop_client.cc:238
StatsWatchers
Definition: xds_interop_client.cc:93
env.h
TestClient::AsyncUnaryCall
void AsyncUnaryCall(const RpcConfig &config)
Definition: xds_interop_client.cc:256
main
int main(int argc, char **argv)
Definition: xds_interop_client.cc:582
XdsStatsWatcher::RpcCompleted
void RpcCompleted(AsyncClientCall *call, const std::string &peer)
Definition: xds_interop_client.cc:141
server_address
std::string server_address("0.0.0.0:10000")
AsyncClientCall::empty_response
Empty empty_response
Definition: xds_interop_client.cc:121
grpc_status._async.code
code
Definition: grpcio_status/grpc_status/_async.py:34
XdsStatsWatcher::XdsStatsWatcher
XdsStatsWatcher(int start_id, int end_id)
Definition: xds_interop_client.cc:135
call
FilterStackCall * call
Definition: call.cc:750
XdsStatsWatcher::m_
std::mutex m_
Definition: xds_interop_client.cc:246
client
static uv_tcp_t client
Definition: test-callback-stack.c:33
XdsUpdateClientConfigureServiceImpl
Definition: xds_interop_client.cc:428
GRPC_ARG_ENABLE_RETRIES
#define GRPC_ARG_ENABLE_RETRIES
Definition: grpc_types.h:396
XdsStatsWatcher::end_id_
int end_id_
Definition: xds_interop_client.cc:235
server
std::unique_ptr< Server > server
Definition: channelz_service_test.cc:330
framework.rpc.grpc_channelz.Channel
Channel
Definition: grpc_channelz.py:32
start
static uint64_t start
Definition: benchmark-pound.c:74
RpcConfigurationsQueue
Definition: xds_interop_client.cc:114
profile_analyzer.builder
builder
Definition: profile_analyzer.py:159
channel
wrapped_grpc_channel * channel
Definition: src/php/ext/grpc/call.h:33
absl::SkipEmpty
Definition: abseil-cpp/absl/strings/str_split.h:347
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
gen_stats_data.c_str
def c_str(s, encoding='ascii')
Definition: gen_stats_data.py:38
config
struct config_s config
grpc::ServerBuilder
A builder class for the creation and startup of grpc::Server instances.
Definition: grpcpp/server_builder.h:86
RunTestLoop
void RunTestLoop(std::chrono::duration< double > duration_per_query, StatsWatchers *stats_watchers, RpcConfigurationsQueue *rpc_configs_queue)
Definition: xds_interop_client.cc:466
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
ABSL_FLAG
ABSL_FLAG(bool, fail_on_failed_rpc, false, "Fail client if any RPCs fail after first successful RPC.")
xds_manager.timeout_sec
timeout_sec
Definition: xds_manager.py:58
AsyncClientCall::rpc_type
ClientConfigureRequest::RpcType rpc_type
Definition: xds_interop_client.cc:126
grpcpp.h
configs
static grpc_end2end_test_config configs[]
Definition: h2_census.cc:111
TestClient::RpcStatusCheckSuccess
static bool RpcStatusCheckSuccess(AsyncClientCall *call)
Definition: xds_interop_client.cc:374
XdsStatsWatcher::rpcs_by_peer_
std::map< std::string, int > rpcs_by_peer_
Definition: xds_interop_client.cc:240
absl::GetFlag
ABSL_MUST_USE_RESULT T GetFlag(const absl::Flag< T > &flag)
Definition: abseil-cpp/absl/flags/flag.h:98
data
char data[kBufferLength]
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
RpcConfig::type
ClientConfigureRequest::RpcType type
Definition: xds_interop_client.cc:110
RunServer
void RunServer(const int port, StatsWatchers *stats_watchers, RpcConfigurationsQueue *rpc_configs_queue)
Definition: xds_interop_client.cc:513
admin_services.h
GPR_UNREACHABLE_CODE
#define GPR_UNREACHABLE_CODE(STATEMENT)
Definition: impl/codegen/port_platform.h:652
xds_manager.rpcs_started
list rpcs_started
Definition: xds_manager.py:35
XdsStatsWatcher::rpcs_by_type_
std::map< int, std::map< std::string, int > > rpcs_by_type_
Definition: xds_interop_client.cc:243
LoadBalancerStatsServiceImpl::LoadBalancerStatsServiceImpl
LoadBalancerStatsServiceImpl(StatsWatchers *stats_watchers)
Definition: xds_interop_client.cc:389
StatsWatchers::mu
std::mutex mu
Definition: xds_interop_client.cc:104
TestClient::AsyncEmptyCall
void AsyncEmptyCall(const RpcConfig &config)
Definition: xds_interop_client.cc:289
AsyncClientCall::status
Status status
Definition: xds_interop_client.cc:124
Empty
Definition: abseil-cpp/absl/container/internal/compressed_tuple_test.cc:33
one_rpc_succeeded
std::atomic< bool > one_rpc_succeeded(false)
grpc::ClientContext
Definition: grpcpp/impl/codegen/client_context.h:195
tests.unit._exit_scenarios.port
port
Definition: _exit_scenarios.py:179
test_config.h
grpc_status_code_from_string
bool grpc_status_code_from_string(const char *status_str, grpc_status_code *status)
Definition: status_util.cc:51
TestClient::AsyncCompleteRpc
void AsyncCompleteRpc()
Definition: xds_interop_client.cc:322
grpc::ChannelArguments
Definition: grpcpp/support/channel_arguments.h:39
grpc::CompletionQueue::Next
bool Next(void **tag, bool *ok)
Definition: include/grpcpp/impl/codegen/completion_queue.h:179
XdsUpdateClientConfigureServiceImpl::Configure
Status Configure(ServerContext *, const ClientConfigureRequest *request, ClientConfigureResponse *) override
Definition: xds_interop_client.cc:435
server
Definition: examples/python/async_streaming/server.py:1
StatsWatchers::watchers
std::set< XdsStatsWatcher * > watchers
Definition: xds_interop_client.cc:100
Empty::default_instance
static const Empty & default_instance()
Definition: bloaty/third_party/protobuf/src/google/protobuf/empty.pb.cc:129
AsyncClientCall
Definition: xds_interop_client.cc:120
server_context.h
TestClient::cq_
CompletionQueue cq_
Definition: xds_interop_client.cc:384
asyncio_get_stats.response
response
Definition: asyncio_get_stats.py:28
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
LoadBalancerStatsServiceImpl
Definition: xds_interop_client.cc:387
grpc::CreateCustomChannel
std::shared_ptr< Channel > CreateCustomChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds, const ChannelArguments &args)
XdsStatsWatcher::rpcs_needed_
int rpcs_needed_
Definition: xds_interop_client.cc:236
grpc::ClientAsyncResponseReader
Definition: grpcpp/impl/codegen/async_unary_call.h:37
grpc::protobuf::util::Status
GRPC_CUSTOM_UTIL_STATUS Status
Definition: include/grpcpp/impl/codegen/config_protobuf.h:93
XdsStatsWatcher::cv_
std::condition_variable cv_
Definition: xds_interop_client.cc:247
grpc::Status
Definition: include/grpcpp/impl/codegen/status.h:35
ok
bool ok
Definition: async_end2end_test.cc:197
grpc::AddAdminServices
void AddAdminServices(grpc::ServerBuilder *builder)
Definition: admin_services.cc:41
test_config.h
StatsWatchers::global_watcher
XdsStatsWatcher * global_watcher
Definition: xds_interop_client.cc:102
config_s
Definition: bloaty/third_party/zlib/deflate.c:120
watcher
ClusterWatcher * watcher
Definition: cds.cc:148
AsyncClientCall::empty_response_reader
std::unique_ptr< ClientAsyncResponseReader< Empty > > empty_response_reader
Definition: xds_interop_client.cc:127
grpc::ChannelArguments::SetInt
void SetInt(const std::string &key, int value)
Set an integer argument value under key.
Definition: channel_arguments.cc:174
grpc::InsecureServerCredentials
std::shared_ptr< ServerCredentials > InsecureServerCredentials()
Definition: insecure_server_credentials.cc:52
run_xds_tests.fail_on_failed_rpc
string fail_on_failed_rpc
Definition: run_xds_tests.py:3404
TestClient::stats_watchers_
StatsWatchers * stats_watchers_
Definition: xds_interop_client.cc:383
AsyncClientCall::simple_response_reader
std::unique_ptr< ClientAsyncResponseReader< SimpleResponse > > simple_response_reader
Definition: xds_interop_client.cc:129
GPR_DEBUG
#define GPR_DEBUG
Definition: include/grpc/impl/codegen/log.h:55
XdsStatsWatcher::WaitForRpcStatsResponse
void WaitForRpcStatsResponse(LoadBalancerStatsResponse *response, int timeout_sec)
Definition: xds_interop_client.cc:175
grpc::CompletionQueue
Definition: include/grpcpp/impl/codegen/completion_queue.h:104
code
Definition: bloaty/third_party/zlib/contrib/infback9/inftree9.h:24
server.h
StatsWatchers::global_request_id_by_type
std::map< int, int > global_request_id_by_type
Definition: xds_interop_client.cc:97
grpc::InsecureChannelCredentials
std::shared_ptr< ChannelCredentials > InsecureChannelCredentials()
Credentials for an unencrypted, unauthenticated channel.
Definition: cpp/client/insecure_credentials.cc:69
messages_pb2.SimpleResponse
SimpleResponse
Definition: messages_pb2.py:604
RpcConfig::timeout_sec
int timeout_sec
Definition: xds_interop_client.cc:112
AsyncClientCall::context
ClientContext context
Definition: xds_interop_client.cc:123
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
method_name
absl::string_view method_name
Definition: call_creds_util.cc:40
XdsUpdateClientConfigureServiceImpl::XdsUpdateClientConfigureServiceImpl
XdsUpdateClientConfigureServiceImpl(RpcConfigurationsQueue *rpc_configs_queue)
Definition: xds_interop_client.cc:431
grpc::reflection::InitProtoReflectionServerBuilderPlugin
void InitProtoReflectionServerBuilderPlugin()
Definition: proto_server_reflection_plugin.cc:66
AsyncClientCall::saved_request_id
int saved_request_id
Definition: xds_interop_client.cc:125
AsyncClientCall::simple_response
SimpleResponse simple_response
Definition: xds_interop_client.cc:122
thread
static uv_thread_t thread
Definition: test-async-null-cb.c:29
server_builder.h
framework.rpc.grpc_testing.LoadBalancerStatsResponse
LoadBalancerStatsResponse
Definition: grpc_testing.py:32
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
XdsStatsWatcher
Definition: xds_interop_client.cc:133
XdsStatsWatcher::GetCurrentRpcStats
void GetCurrentRpcStats(LoadBalancerAccumulatedStatsResponse *response, StatsWatchers *stats_watchers)
Definition: xds_interop_client.cc:206
RpcConfig::metadata
std::vector< std::pair< std::string, std::string > > metadata
Definition: xds_interop_client.cc:111
TestClient
Definition: xds_interop_client.cc:250


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:59