Make entity description type as Json instead of string

pull/23860/head
“Mohan 5 years ago
parent f85569e5a7
commit dee219a28f
  1. 14
      test/cpp/util/channelz_sampler.cc

@ -470,7 +470,8 @@ class ChannelzSampler final {
std::string type = "Channel";
std::string description;
::google::protobuf::TextFormat::PrintToString(channel.data(), &description);
StoreEntityInJson(id, type, description);
grpc_core::Json description_json = grpc_core::Json(description);
StoreEntityInJson(id, type, description_json);
}
// Store a subchannel in Json
@ -480,7 +481,8 @@ class ChannelzSampler final {
std::string description;
::google::protobuf::TextFormat::PrintToString(subchannel.data(),
&description);
StoreEntityInJson(id, type, description);
grpc_core::Json description_json = grpc_core::Json(description);
StoreEntityInJson(id, type, description_json);
}
// Store a server in Json
@ -489,7 +491,8 @@ class ChannelzSampler final {
std::string type = "Server";
std::string description;
::google::protobuf::TextFormat::PrintToString(server.data(), &description);
StoreEntityInJson(id, type, description);
grpc_core::Json description_json = grpc_core::Json(description);
StoreEntityInJson(id, type, description_json);
}
// Store a socket in Json
@ -498,12 +501,13 @@ class ChannelzSampler final {
std::string type = "Socket";
std::string description;
::google::protobuf::TextFormat::PrintToString(socket.data(), &description);
StoreEntityInJson(id, type, description);
grpc_core::Json description_json = grpc_core::Json(description);
StoreEntityInJson(id, type, description_json);
}
// Store an entity in Json
void StoreEntityInJson(std::string& id, std::string& type,
std::string& description) {
grpc_core::Json description) {
std::string start, finish;
gpr_timespec ago = gpr_time_sub(
now_,

Loading…
Cancel
Save