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) { ...@@ -240,7 +240,7 @@ bool RpcDumpContext::Serialize(butil::IOBuf& buf, SampledRequest* sample) {
const size_t starting_size = buf.size(); const size_t starting_size = buf.size();
butil::IOBufAsZeroCopyOutputStream buf_stream(&buf); butil::IOBufAsZeroCopyOutputStream buf_stream(&buf);
if (!sample->SerializeToZeroCopyStream(&buf_stream)) { if (!sample->meta.SerializeToZeroCopyStream(&buf_stream)) {
LOG(ERROR) << "Fail to serialize"; LOG(ERROR) << "Fail to serialize";
return false; return false;
} }
...@@ -349,7 +349,7 @@ SampledRequest* SampleIterator::Pop(butil::IOBuf& buf, bool* format_error) { ...@@ -349,7 +349,7 @@ SampledRequest* SampleIterator::Pop(butil::IOBuf& buf, bool* format_error) {
butil::IOBuf meta_buf; butil::IOBuf meta_buf;
buf.cutn(&meta_buf, meta_size); buf.cutn(&meta_buf, meta_size);
std::unique_ptr<SampledRequest> req(new SampledRequest); 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"; LOG(ERROR) << "Fail to parse RpcDumpMeta";
*format_error = true; *format_error = true;
return NULL; return NULL;
......
...@@ -46,9 +46,9 @@ DECLARE_bool(rpc_dump); ...@@ -46,9 +46,9 @@ DECLARE_bool(rpc_dump);
// In practice, sampled requests are just small fraction of all requests. // In practice, sampled requests are just small fraction of all requests.
// The overhead of sampling should be negligible for overall performance. // The overhead of sampling should be negligible for overall performance.
struct SampledRequest : public bvar::Collected struct SampledRequest : public bvar::Collected {
, public RpcDumpMeta {
butil::IOBuf request; butil::IOBuf request;
RpcDumpMeta meta;
// Implement methods of Sampled. // Implement methods of Sampled.
void dump_and_destroy(size_t round) override; 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