MCPcopy Create free account
hub / github.com/apache/brpc / GenerateReport

Method GenerateReport

test/brpc_builtin_service_unittest.cpp:570–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568class MyGrpcHealthReporter : public brpc::HealthReporter {
569public:
570 void GenerateReport(brpc::Controller* cntl,
571 google::protobuf::Closure* done) {
572 grpc::health::v1::HealthCheckResponse response;
573 response.set_status(grpc::health::v1::HealthCheckResponse_ServingStatus_UNKNOWN);
574
575 if (cntl->response()) {
576 cntl->response()->CopyFrom(response);
577 } else {
578 std::string json;
579 json2pb::ProtoMessageToJson(response, &json);
580 cntl->http_response().set_content_type("application/json");
581 cntl->response_attachment().append(json);
582 }
583 done->Run();
584 }
585};
586
587TEST_F(BuiltinServiceTest, normal_grpc_health) {

Callers

nothing calls this directly

Calls 7

set_statusMethod · 0.80
responseMethod · 0.80
CopyFromMethod · 0.80
set_content_typeMethod · 0.80
ProtoMessageToJsonFunction · 0.50
appendMethod · 0.45
RunMethod · 0.45

Tested by

no test coverage detected