From 6db3165fc492513a319c3f143968b1fbd090d837 Mon Sep 17 00:00:00 2001 From: Jiashuo Date: Fri, 13 Aug 2021 19:00:09 +0800 Subject: [PATCH] fix: update mutation tracer name to mutation->name() (#876) --- include/dsn/utils/latency_tracer.h | 4 +++- src/replica/replica_2pc.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/dsn/utils/latency_tracer.h b/include/dsn/utils/latency_tracer.h index f3b68e090d..b4ec02fb9b 100644 --- a/include/dsn/utils/latency_tracer.h +++ b/include/dsn/utils/latency_tracer.h @@ -93,12 +93,14 @@ class latency_tracer // stageA[rpc_message]--stageB[rpc_message]-- void set_sub_tracer(const std::shared_ptr &tracer); + void set_name(const std::string &name) { _name = name; } + private: void dump_trace_points(/*out*/ std::string &traces); utils::rw_lock_nr _lock; - const std::string _name; + std::string _name; const uint64_t _threshold; bool _is_sub; const uint64_t _start_time; diff --git a/src/replica/replica_2pc.cpp b/src/replica/replica_2pc.cpp index 46a5d7e0d5..70b238e4d9 100644 --- a/src/replica/replica_2pc.cpp +++ b/src/replica/replica_2pc.cpp @@ -180,6 +180,7 @@ void replica::init_prepare(mutation_ptr &mu, bool reconciliation, bool pop_all_c mu->set_id(get_ballot(), mu->data.header.decree); } + mu->tracer->set_name(fmt::format("mutation[{}]", mu->name())); dlog(level, "%s: mutation %s init_prepare, mutation_tid=%" PRIu64, name(), @@ -386,6 +387,7 @@ void replica::on_prepare(dsn::message_ex *request) decree decree = mu->data.header.decree; dinfo("%s: mutation %s on_prepare", name(), mu->name()); + mu->tracer->set_name(fmt::format("mutation[{}]", mu->name())); dassert(mu->data.header.pid == rconfig.pid, "(%d.%d) VS (%d.%d)",