Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::RpcEventHandler Class Reference

#include <rpc-trace.h>

Inheritance diagram for impala::RpcEventHandler:
Collaboration diagram for impala::RpcEventHandler:

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...
 
MetricGroupmetrics_
 Metrics subsystem access. More...
 

Detailed Description

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.

Member Typedef Documentation

typedef boost::unordered_map<std::string, MethodDescriptor*> impala::RpcEventHandler::MethodMap
private

Map from method name to descriptor.

Definition at line 91 of file rpc-trace.h.

Constructor & Destructor Documentation

RpcEventHandler::RpcEventHandler ( const std::string &  server_name,
MetricGroup metrics 
)

Definition at line 133 of file rpc-trace.cc.

References handler_manager.

Member Function Documentation

void * RpcEventHandler::getContext ( const char *  fn_name,
void *  server_context 
)
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.

void RpcEventHandler::postWrite ( void *  ctx,
const char *  fn_name,
uint32_t  bytes 
)
virtual
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().

std::string impala::RpcEventHandler::server_name ( ) const
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().

Member Data Documentation

MethodMap impala::RpcEventHandler::method_map_
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().

boost::mutex impala::RpcEventHandler::method_map_lock_
private

Protects method_map_ and rpc_counter_.

Definition at line 112 of file rpc-trace.h.

Referenced by getContext(), and ToJson().

MetricGroup* impala::RpcEventHandler::metrics_
private

Metrics subsystem access.

Definition at line 121 of file rpc-trace.h.

Referenced by getContext().

std::string impala::RpcEventHandler::server_name_
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().


The documentation for this class was generated from the following files: