Commit b564dd56 authored by zhujiashun's avatar zhujiashun

Make RpcDumpMeta be member of SampledRequest

parent 231b35af
......@@ -240,7 +240,7 @@ bool RpcDumpContext::Serialize(butil::IOBuf& buf, SampledRequest* sample) {
const size_t starting_size = buf.size();
butil::IOBufAsZeroCopyOutputStream buf_stream(&buf);
if (!sample->SerializeToZeroCopyStream(&buf_stream)) {
if (!sample->meta.SerializeToZeroCopyStream(&buf_stream)) {
LOG(ERROR) << "Fail to serialize";
return false;
}
......@@ -349,7 +349,7 @@ SampledRequest* SampleIterator::Pop(butil::IOBuf& buf, bool* format_error) {
butil::IOBuf meta_buf;
buf.cutn(&meta_buf, meta_size);
std::unique_ptr<SampledRequest> req(new SampledRequest);
if (!ParsePbFromIOBuf(req.get(), meta_buf)) {
if (!ParsePbFromIOBuf(&req->meta, meta_buf)) {
LOG(ERROR) << "Fail to parse RpcDumpMeta";
*format_error = true;
return NULL;
......
......@@ -46,9 +46,9 @@ DECLARE_bool(rpc_dump);
// In practice, sampled requests are just small fraction of all requests.
// The overhead of sampling should be negligible for overall performance.
struct SampledRequest : public bvar::Collected
, public RpcDumpMeta {
struct SampledRequest : public bvar::Collected {
butil::IOBuf request;
RpcDumpMeta meta;
// Implement methods of Sampled.
void dump_and_destroy(size_t round) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment