org.apache.avro.ipc.trace
Class TracePlugin

java.lang.Object
  extended by org.apache.avro.ipc.RPCPlugin
      extended by org.apache.avro.ipc.trace.TracePlugin

public class TracePlugin
extends RPCPlugin

A tracing plugin for Avro. This plugin traces RPC call timing and follows nested trees of RPC calls. To use, instantiate and add to an existing Requestor or Responder. If you have a Responder that itself acts as an RPC client (i.e. it contains a Requestor) be sure to pass the same instance of the plugin to both components so that propagation occurs correctly. Currently, propagation only works if each requester is performing serial RPC calls. That is, we cannot support the case in which the Requestor's request does not occur in the same thread as the Responder's response.


Nested Class Summary
static class TracePlugin.StorageType
           
 
Field Summary
protected  org.mortbay.jetty.Server clientFacingServer
           
protected  TracePluginConfiguration config
           
protected  HttpServer httpServer
           
protected  SpecificResponder responder
           
protected static TracePlugin singleton
           
protected static TracePluginConfiguration singletonConf
           
protected  SpanStorage storage
           
 
Constructor Summary
TracePlugin(TracePluginConfiguration conf)
           
 
Method Summary
 void clientFinishConnect(RPCContext context)
          Called on the client after the initial RPC handshake
 void clientReceiveResponse(RPCContext context)
          This method is invoked at the client after the call is executed, and after the client receives the response
 void clientSendRequest(RPCContext context)
          This method is invoked at the client before it issues the RPC call.
 void clientStartConnect(RPCContext context)
          Called on the client before the initial RPC handshake to setup any handshake metadata for this plugin
static void configureSingleton(TracePluginConfiguration conf)
          Configure a singleton instance for this TracePlugin.
static TracePlugin getSingleton()
          Get a singleton TracePlugin.
protected  void initializeClientServer()
          Start a client-facing server.
 void serverConnecting(RPCContext context)
          Called on the server during the RPC handshake
 void serverReceiveRequest(RPCContext context)
          This method is invoked at the RPC server when the request is received, but before the call itself is executed
 void serverSendResponse(RPCContext context)
          This method is invoked at the server before the response is executed, but before the response has been formulated
 void stopClientServer()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleton

protected static TracePlugin singleton

singletonConf

protected static TracePluginConfiguration singletonConf

config

protected TracePluginConfiguration config

storage

protected SpanStorage storage

httpServer

protected HttpServer httpServer

responder

protected SpecificResponder responder

clientFacingServer

protected org.mortbay.jetty.Server clientFacingServer
Constructor Detail

TracePlugin

public TracePlugin(TracePluginConfiguration conf)
            throws IOException
Throws:
IOException
Method Detail

getSingleton

public static TracePlugin getSingleton()
                                throws IOException
Get a singleton TracePlugin. This is useful if you want to persist a plugin across both a { @link Requestor } and { @link Responder }. This must be prefixed by at least one call of configureSingleton();

Throws:
IOException

configureSingleton

public static void configureSingleton(TracePluginConfiguration conf)
Configure a singleton instance for this TracePlugin. If a singleton has already been created according to a different configuration, throw a RuntimeException.


clientStartConnect

public void clientStartConnect(RPCContext context)
Description copied from class: RPCPlugin
Called on the client before the initial RPC handshake to setup any handshake metadata for this plugin

Overrides:
clientStartConnect in class RPCPlugin
Parameters:
context - the handshake rpc context

serverConnecting

public void serverConnecting(RPCContext context)
Description copied from class: RPCPlugin
Called on the server during the RPC handshake

Overrides:
serverConnecting in class RPCPlugin
Parameters:
context - the handshake rpc context

clientFinishConnect

public void clientFinishConnect(RPCContext context)
Description copied from class: RPCPlugin
Called on the client after the initial RPC handshake

Overrides:
clientFinishConnect in class RPCPlugin
Parameters:
context - the handshake rpc context

clientSendRequest

public void clientSendRequest(RPCContext context)
Description copied from class: RPCPlugin
This method is invoked at the client before it issues the RPC call.

Overrides:
clientSendRequest in class RPCPlugin
Parameters:
context - the per-call rpc context (in/out parameter)

serverReceiveRequest

public void serverReceiveRequest(RPCContext context)
Description copied from class: RPCPlugin
This method is invoked at the RPC server when the request is received, but before the call itself is executed

Overrides:
serverReceiveRequest in class RPCPlugin
Parameters:
context - the per-call rpc context (in/out parameter)

serverSendResponse

public void serverSendResponse(RPCContext context)
Description copied from class: RPCPlugin
This method is invoked at the server before the response is executed, but before the response has been formulated

Overrides:
serverSendResponse in class RPCPlugin
Parameters:
context - the per-call rpc context (in/out parameter)

clientReceiveResponse

public void clientReceiveResponse(RPCContext context)
Description copied from class: RPCPlugin
This method is invoked at the client after the call is executed, and after the client receives the response

Overrides:
clientReceiveResponse in class RPCPlugin
Parameters:
context - the per-call rpc context

stopClientServer

public void stopClientServer()

initializeClientServer

protected void initializeClientServer()
Start a client-facing server. Can be overridden if users prefer to attach client Servlet to their own server.



Copyright © 2011 The Apache Software Foundation. All Rights Reserved.