Package org.apache.avro.ipc.stats

# Class StatsPlugin

java.lang.Object
org.apache.avro.ipc.RPCPlugin
org.apache.avro.ipc.stats.StatsPlugin

public class StatsPlugin extends RPCPlugin
Collects count and latency statistics about RPC calls. Keeps data for every method. Can be added to a Requestor (client) or Responder (server). This uses milliseconds as the standard unit of measure throughout the class, stored in floats.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final org.apache.avro.ipc.stats.Histogram.Segmenter<String,Float>`
`LATENCY_SEGMENTER`
Static declaration of histogram buckets.
`static final org.apache.avro.ipc.stats.Histogram.Segmenter<String,Integer>`
`PAYLOAD_SEGMENTER`
`Date`
`startupTime`
How long I've been alive

## Constructor Summary

Constructors
Constructor
Description
`StatsPlugin()`
Construct a plugin with default (system) ticks, and default histogram segmentation.
`StatsPlugin(org.apache.avro.ipc.stats.Stopwatch.Ticks ticks, org.apache.avro.ipc.stats.Histogram.Segmenter<?,Float> floatSegmenter, org.apache.avro.ipc.stats.Histogram.Segmenter<?,Integer> integerSegmenter)`
Construct a plugin with custom Ticks and Segmenter implementations.

## Method Summary

Modifier and Type
Method
Description
`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`
`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

### Methods inherited from class org.apache.avro.ipc.RPCPlugin

`clientFinishConnect, clientStartConnect, serverConnecting`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### LATENCY_SEGMENTER

public static final org.apache.avro.ipc.stats.Histogram.Segmenter<String,Float> LATENCY_SEGMENTER
Static declaration of histogram buckets.

### PAYLOAD_SEGMENTER

public static final org.apache.avro.ipc.stats.Histogram.Segmenter<String,Integer> PAYLOAD_SEGMENTER

### startupTime

public Date startupTime
How long I've been alive

## Constructor Details

### StatsPlugin

public StatsPlugin(org.apache.avro.ipc.stats.Stopwatch.Ticks ticks, org.apache.avro.ipc.stats.Histogram.Segmenter<?,Float> floatSegmenter, org.apache.avro.ipc.stats.Histogram.Segmenter<?,Integer> integerSegmenter)
Construct a plugin with custom Ticks and Segmenter implementations.

### StatsPlugin

public StatsPlugin()
Construct a plugin with default (system) ticks, and default histogram segmentation.

## Method Details

### 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)

### 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)

### 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