diff --git a/src/brpc/policy/http_rpc_protocol.cpp b/src/brpc/policy/http_rpc_protocol.cpp index 2587cf3f04..52fff2c9cf 100644 --- a/src/brpc/policy/http_rpc_protocol.cpp +++ b/src/brpc/policy/http_rpc_protocol.cpp @@ -1578,15 +1578,17 @@ void ProcessHttpRequest(InputMessageBase *msg) { } } } - SampledRequest* sample = AskToBeSampled(); - if (sample && !is_http2) { - sample->meta.set_compress_type(COMPRESS_TYPE_NONE); - sample->meta.set_protocol_type(PROTOCOL_HTTP); - sample->meta.set_attachment_size(req_body.size()); - - butil::EndPoint ep; - MakeRawHttpRequest(&sample->request, &req_header, ep, &req_body); - sample->submit(start_parse_us); + if (!is_http2) { + SampledRequest* sample = AskToBeSampled(); + if (sample) { + sample->meta.set_compress_type(COMPRESS_TYPE_NONE); + sample->meta.set_protocol_type(PROTOCOL_HTTP); + sample->meta.set_attachment_size(req_body.size()); + + butil::EndPoint ep; + MakeRawHttpRequest(&sample->request, &req_header, ep, &req_body); + sample->submit(start_parse_us); + } } } else { if (imsg_guard->read_body_progressively()) {