Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
#include <rpc-trace.h>
Classes | |
struct | InvocationContext |
Created per-Rpc invocation. More... | |
struct | MethodDescriptor |
Per-method descriptor. More... | |
Public Member Functions | |
RpcEventHandler (const std::string &server_name, MetricGroup *metrics) | |
virtual void * | getContext (const char *fn_name, void *server_context) |
virtual void | postWrite (void *ctx, const char *fn_name, uint32_t bytes) |
void | ToJson (rapidjson::Value *server, rapidjson::Document *document) |
void | Reset (const std::string &method_name) |
Resets the statistics for a single method. More... | |
void | ResetAll () |
Resets the statistics for all methods. More... | |
std::string | server_name () const |
Private Types | |
typedef boost::unordered_map < std::string, MethodDescriptor * > | MethodMap |
Map from method name to descriptor. More... | |
Private Attributes | |
boost::mutex | method_map_lock_ |
Protects method_map_ and rpc_counter_. More... | |
MethodMap | method_map_ |
Map of all methods, populated lazily as they are invoked for the first time. More... | |
std::string | server_name_ |
Name of the server that we listen for events from. More... | |
MetricGroup * | metrics_ |
Metrics subsystem access. More... | |
An RpcEventHandler is called every time an Rpc is started and completed. There is at most one RpcEventHandler per ThriftServer. When an Rpc is started, getContext() creates an InvocationContext recording the current time and other metadata for that invocation.
Definition at line 36 of file rpc-trace.h.
|
private |
Map from method name to descriptor.
Definition at line 91 of file rpc-trace.h.
RpcEventHandler::RpcEventHandler | ( | const std::string & | server_name, |
MetricGroup * | metrics | ||
) |
Definition at line 133 of file rpc-trace.cc.
References handler_manager.
|
virtual |
From TProcessorEventHandler, called initially when an Rpc is invoked. Returns an InvocationContext*. 'server_context' is a per-connection context object. For our Thrift servers, it is always a ThriftServer::ConnectionContext*.
Definition at line 158 of file rpc-trace.cc.
References impala::RpcEventHandler::InvocationContext::cnxn_ctx, gen_ir_descriptions::fn_name, method_map_, method_map_lock_, metrics_, impala::MonotonicMillis(), impala::RpcEventHandler::MethodDescriptor::name, impala::ThriftServer::ConnectionContext::network_address, impala::MetricGroup::RegisterMetric(), server_name_, impala::RpcEventHandler::MethodDescriptor::time_stats, and VLOG_RPC.
|
virtual |
From TProcessorEventHandler, called after all bytes were written to the calling client. 'ctx' is the context returned by getContext(), which is an InvocationContext*.
Definition at line 184 of file rpc-trace.cc.
References impala::RpcEventHandler::InvocationContext::cnxn_ctx, impala::RpcEventHandler::InvocationContext::method_descriptor, impala::MonotonicMillis(), impala::ThriftServer::ConnectionContext::network_address, impala::RpcEventHandler::MethodDescriptor::num_in_flight, impala::PrettyPrinter::Print(), server_name_, impala::RpcEventHandler::InvocationContext::start_time_ms, impala::RpcEventHandler::MethodDescriptor::time_stats, impala::StatsMetric< T >::Update(), and VLOG_RPC.
void RpcEventHandler::Reset | ( | const std::string & | method_name | ) |
Resets the statistics for a single method.
Definition at line 117 of file rpc-trace.cc.
Referenced by RpcEventHandlerManager::ResetCallback().
void RpcEventHandler::ResetAll | ( | ) |
Resets the statistics for all methods.
Definition at line 125 of file rpc-trace.cc.
Referenced by RpcEventHandlerManager::ResetCallback().
|
inline |
Definition at line 75 of file rpc-trace.h.
References server_name_.
Referenced by RpcEventHandlerManager::ResetCallback(), and ToJson().
void RpcEventHandler::ToJson | ( | rapidjson::Value * | server, |
rapidjson::Document * | document | ||
) |
Helper method to dump all per-method summaries to Json Json produced looks like: { "name": "beeswax", "methods": [ { "name": "BeeswaxService.get_state", "summary": " count: 1, last: 0, min: 0, max: 0, mean: 0, stddev: 0", "in_flight": 0 }, { "name": "BeeswaxService.query", "summary": " count: 1, last: 293, min: 293, max: 293, mean: 293, stddev: 0", "in_flight": 0 }, ] }
Definition at line 138 of file rpc-trace.cc.
References method_map_, method_map_lock_, impala::name, server_name(), and server_name_.
Referenced by RpcEventHandlerManager::JsonCallback().
|
private |
Map of all methods, populated lazily as they are invoked for the first time.
Definition at line 115 of file rpc-trace.h.
Referenced by getContext(), and ToJson().
|
private |
Protects method_map_ and rpc_counter_.
Definition at line 112 of file rpc-trace.h.
Referenced by getContext(), and ToJson().
|
private |
|
private |
Name of the server that we listen for events from.
Definition at line 118 of file rpc-trace.h.
Referenced by getContext(), postWrite(), server_name(), and ToJson().