Class TimedInvocationHandler

java.lang.Object
com.helixframework.proxy.TimedInvocationHandler
All Implemented Interfaces:
InvocationHandler

public class TimedInvocationHandler extends Object implements InvocationHandler
The TimedInvocationHandler class is an implementation of the InvocationHandler interface that allows for timing method invocations. It records the latency of each method invocation and provides methods to retrieve statistical data about the latencies.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.helixframework.proxy.TimedInvocationHandler.Builder
    builder(Object target)
    Returns a new instance of the Builder class with the given target object.
    Optional<org.HdrHistogram.Histogram>
    Retrieves the latency histogram for the given method.
    Retrieves the maximum duration to record timing information for.
    long
    Retrieves the maximum latency in nanoseconds for the given method.
    double
    Retrieves the mean latency in nanoseconds for the given method.
    long
    Retrieves the minimum latency in nanoseconds for the given method.
    long
    getP50(String method)
    Retrieves the 50th percentile (P50) latency in nanoseconds for the given method.
    long
    getP90(String method)
    Retrieves the 90th percentile latency in nanoseconds for the given method.
    long
    getP95(String method)
    Retrieves the 95th percentile (P95) latency in nanoseconds for the given method.
    long
    getP99(String method)
    Retrieves the 99th percentile latency in nanoseconds for the given method.
    long
    getPercentile(String method, double percentile)
    Retrieves the percentile latency in nanoseconds for the given method.
    double
    Retrieves the sample rate for recording timing information of method invocations.
    Retrieves the window duration.
    invoke(Object proxy, Method method, Object[] args)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • builder

      public static com.helixframework.proxy.TimedInvocationHandler.Builder builder(Object target)
      Returns a new instance of the Builder class with the given target object.
      Parameters:
      target - the target object
      Returns:
      a new instance of the Builder class
    • invoke

      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
      Specified by:
      invoke in interface InvocationHandler
      Throws:
      Throwable
    • getHistogram

      public Optional<org.HdrHistogram.Histogram> getHistogram(String method)
      Retrieves the latency histogram for the given method.
      Parameters:
      method - the name of the method
      Returns:
      an Optional containing the Histogram for the method, or an empty Optional if the histogram is not found
    • getMinNanos

      public long getMinNanos(String method)
      Retrieves the minimum latency in nanoseconds for the given method.
      Parameters:
      method - the name of the method
      Returns:
      the minimum latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
    • getMaxNanos

      public long getMaxNanos(String method)
      Retrieves the maximum latency in nanoseconds for the given method.
      Parameters:
      method - the name of the method
      Returns:
      the maximum latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
    • getMeanNanos

      public double getMeanNanos(String method)
      Retrieves the mean latency in nanoseconds for the given method.
      Parameters:
      method - the name of the method
      Returns:
      the mean latency in nanoseconds for the method, or Double.MIN_VALUE if the histogram is not found
    • getP99

      public long getP99(String method)
      Retrieves the 99th percentile latency in nanoseconds for the given method.
      Parameters:
      method - the name of the method
      Returns:
      the 99th percentile latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
    • getP95

      public long getP95(String method)
      Retrieves the 95th percentile (P95) latency in nanoseconds for the given method.
      Parameters:
      method - the name of the method
      Returns:
      the 95th percentile latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
    • getP90

      public long getP90(String method)
      Retrieves the 90th percentile latency in nanoseconds for the given method.
      Parameters:
      method - the name of the method
      Returns:
      the 90th percentile latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
    • getP50

      public long getP50(String method)
      Retrieves the 50th percentile (P50) latency in nanoseconds for the given method.
      Parameters:
      method - the name of the method
      Returns:
      the 50th percentile latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
    • getPercentile

      public long getPercentile(String method, double percentile)
      Retrieves the percentile latency in nanoseconds for the given method.
      Parameters:
      method - the name of the method
      percentile - the desired percentile (0.0 to 100.0)
      Returns:
      the percentile latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
    • getSampleRate

      public double getSampleRate()
      Retrieves the sample rate for recording timing information of method invocations.
      Returns:
      the sample rate
    • getMaxDuration

      public Duration getMaxDuration()
      Retrieves the maximum duration to record timing information for.
      Returns:
      the maximum duration
    • getWindow

      public Duration getWindow()
      Retrieves the window duration.
      Returns:
      the window duration