From 89375d4c2afe366e18fed2010acdc52a6c8a28fb Mon Sep 17 00:00:00 2001 From: Vlad Zolotarov Date: Tue, 7 Jun 2016 15:54:15 +0300 Subject: [PATCH] service::storage_proxy: tracing: instrument read_digest and read_mutation_data Instrument read_digest and read_mutation_data handlers similarly to a read_data handler instrumentation. Signed-off-by: Vlad Zolotarov Message-Id: <1465304055-4263-1-git-send-email-vladz@cloudius-systems.com> --- service/storage_proxy.cc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/service/storage_proxy.cc b/service/storage_proxy.cc index d317669e97..bc92f804d9 100644 --- a/service/storage_proxy.cc +++ b/service/storage_proxy.cc @@ -3003,7 +3003,7 @@ void storage_proxy::init_messaging_service() { tracing::trace_state_ptr trace_state_ptr; if (cmd.trace_info) { trace_state_ptr = tracing::tracing::get_local_tracing_instance().create_session(cmd.trace_info->type, cmd.trace_info->flush_on_close, cmd.trace_info->session_id); - auto msg = sprint("message received from /%s", net::messaging_service::get_source(cinfo).addr); + auto msg = sprint("read_data: message received from /%s", net::messaging_service::get_source(cinfo).addr); tracing::begin(trace_state_ptr); tracing::trace(trace_state_ptr, std::move(msg)); } @@ -3017,16 +3017,34 @@ void storage_proxy::init_messaging_service() { }); }); ms.register_read_mutation_data([] (const rpc::client_info& cinfo, query::read_command cmd, query::partition_range pr) { - return do_with(std::move(pr), get_local_shared_storage_proxy(), [&cinfo, cmd = make_lw_shared(std::move(cmd))] (const query::partition_range& pr, shared_ptr& p) { + tracing::trace_state_ptr trace_state_ptr; + if (cmd.trace_info) { + trace_state_ptr = tracing::tracing::get_local_tracing_instance().create_session(cmd.trace_info->type, cmd.trace_info->flush_on_close, cmd.trace_info->session_id); + auto msg = sprint("read_mutation_data: message received from /%s", net::messaging_service::get_source(cinfo).addr); + tracing::begin(trace_state_ptr); + tracing::trace(trace_state_ptr, std::move(msg)); + } + return do_with(std::move(pr), get_local_shared_storage_proxy(), std::move(trace_state_ptr), [&cinfo, cmd = make_lw_shared(std::move(cmd))] (const query::partition_range& pr, shared_ptr& p, tracing::trace_state_ptr& trace_state_ptr) { return get_schema_for_read(cmd->schema_version, net::messaging_service::get_source(cinfo)).then([cmd, &pr, &p] (schema_ptr s) { return p->query_mutations_locally(std::move(s), cmd, pr); + }).finally([&trace_state_ptr] () mutable { + tracing::trace(trace_state_ptr, "read_mutation_data handling is done"); }); }); }); ms.register_read_digest([] (const rpc::client_info& cinfo, query::read_command cmd, query::partition_range pr) { - return do_with(std::move(pr), get_local_shared_storage_proxy(), [&cinfo, cmd = make_lw_shared(std::move(cmd))] (const query::partition_range& pr, shared_ptr& p) { + tracing::trace_state_ptr trace_state_ptr; + if (cmd.trace_info) { + trace_state_ptr = tracing::tracing::get_local_tracing_instance().create_session(cmd.trace_info->type, cmd.trace_info->flush_on_close, cmd.trace_info->session_id); + auto msg = sprint("read_digest: message received from /%s", net::messaging_service::get_source(cinfo).addr); + tracing::begin(trace_state_ptr); + tracing::trace(trace_state_ptr, std::move(msg)); + } + return do_with(std::move(pr), get_local_shared_storage_proxy(), std::move(trace_state_ptr), [&cinfo, cmd = make_lw_shared(std::move(cmd))] (const query::partition_range& pr, shared_ptr& p, tracing::trace_state_ptr& trace_state_ptr) { return get_schema_for_read(cmd->schema_version, net::messaging_service::get_source(cinfo)).then([cmd, &pr, &p] (schema_ptr s) { return p->query_singular_local_digest(std::move(s), cmd, pr); + }).finally([&trace_state_ptr] () mutable { + tracing::trace(trace_state_ptr, "read_digest handling is done"); }); }); });