Top Description Methods
stormpot

public Interface MetricsRecorder


A MetricsRecorder implementation supplies the pool with the ability to record and report operational metrics. Many of the methods of the stormpot.ManagedPool interface relies on a MetricsRecorder being configured for the given pool. Stormpot provides no default implementation of this interface, so by default many of the metrics reporting methods of the ManagedPool interfaces will return Double.NaN.

Note

that implementations of this class must be thread-safe! Here's an example implementation based on the https://metrics.dropwizard.io/[Dropwizard Metrics library]: [source,java] ---- include::../src/test/java/examples/DropwizardMetricsRecorder.java[lines=16..-1] ----

Since
2.3

Method Summary

Modifier and TypeMethod and Description
public double

Returns:

The latency value in milliseconds for the given percentile/quantile.
getAllocationFailureLatencyPercentile
(double
The percentile/quantile to get a value for.
percentile
)

Get the approximate latency value, in milliseconds, for failed allocation latencies within the given percentile/quantile of what has been recorded so far.

public double

Returns:

The latency value in milliseconds for the given percentile/quantile.
getAllocationLatencyPercentile
(double
The percentile/quantile to get a value for.
percentile
)

Get the approximate Poolable object allocation latency value, in milliseconds, of the given percentile/quantile of the values recorded so far.

public double

Returns:

The latency value in milliseconds for the given percentile/quantile.
getDeallocationLatencyPercentile
(double
The percentile/quantile to get a value for.
percentile
)

Get the approximate latency value, in milliseconds, for deallocation latencies within the given percentile/quantile of what has been recorded so far.

public double

Returns:

The latency value in milliseconds for the given percentile/quantile.
getObjectLifetimePercentile
(double
The percentile/quantile to get a value for.
percentile
)

Get the approximate object lifetime, in milliseconds, for the given percentile/quantile.

public double

Returns:

The latency value in milliseconds for the given percentile/quantile.
getReallocationFailurePercentile
(double
The percentile/quantile to get a value for.
percentile
)

Get the approximate latency value, in milliseconds, for failed reallocation latencies within the given percentile/quantile of what has been recorded so far.

public double

Returns:

The latency value in milliseconds for the given percentile/quantile.
getReallocationLatencyPercentile
(double
The percentile/quantile to get a value for.
percentile
)

Get the approximate latency value, in milliseconds, for reallocation latencies within the given percentile/quantile of what has been recorded so far.

public void
recordAllocationFailureLatencySampleMillis(long
How many milliseconds transpired before the allocation failed.
milliseconds
)

Record a latency sample of a failed allocation, in milliseconds.

public void
recordAllocationLatencySampleMillis(long
How many milliseconds it took to successfully allocate an object.
milliseconds
)

Record a latency sample of a successful allocation, in milliseconds.

public void
recordDeallocationLatencySampleMillis(long
How many milliseconds to took to deallocate an object.
milliseconds
)

Record a latency sample of a deallocation, in milliseconds.

public void
recordObjectLifetimeSampleMillis(long
How many milliseconds a Poolable object was in circulation; from it was created, till it was deallocated.
milliseconds
)

Record an object lifetime sample, in milliseconds.

public void
recordReallocationFailureLatencySampleMillis(long
How many milliseconds transpired before the reallocation failed.
milliseconds
)

Record a latency sample of a failed reallocation, in milliseconds.

public void
recordReallocationLatencySampleMillis(long
How many milliseconds it took to successfully reallocate an object.
milliseconds
)

Record a latency sample of a successful reallocation, in milliseconds.

Method Detail

getAllocationFailureLatencyPercentileback to summary
public double getAllocationFailureLatencyPercentile(double percentile)

Get the approximate latency value, in milliseconds, for failed allocation latencies within the given percentile/quantile of what has been recorded so far. A percentile, or quantile, is a value between 0.0 and 1.0, both inclusive, which represents a percentage of the recorded samples. In other words, given a percentile, the returned value will be the latency in milliseconds, that the given percent of samples is less than or equal to. For instance, if given the percentile 0.9 returns 120, then 90% of all recorded latency samples will be less than or equal to 120 milliseconds.

Note

Implementers should strive to return `Double.NaN` as a sentinel value, if they do not support recording of the allocation latencies and/or returning a specific percentile of such recordings.

Parameters
percentile:double

The percentile/quantile to get a value for.

Returns:double

The latency value in milliseconds for the given percentile/quantile.

getAllocationLatencyPercentileback to summary
public double getAllocationLatencyPercentile(double percentile)

Get the approximate Poolable object allocation latency value, in milliseconds, of the given percentile/quantile of the values recorded so far. A percentile, or quantile, is a value between 0.0 and 1.0, both inclusive, which represents a percentage of the recorded samples. In other words, given a percentile, the returned value will be the latency in milliseconds, that the given percent of samples is less than or equal to. For instance, if given the percentile 0.9 returns 120, then 90% of all recorded latency samples will be less than or equal to 120 milliseconds.

Note

Implementers should strive to return `Double.NaN` as a sentinel value, if they do not support recording of the allocation latencies and/or returning a specific percentile of such recordings.

Parameters
percentile:double

The percentile/quantile to get a value for.

Returns:double

The latency value in milliseconds for the given percentile/quantile.

getDeallocationLatencyPercentileback to summary
public double getDeallocationLatencyPercentile(double percentile)

Get the approximate latency value, in milliseconds, for deallocation latencies within the given percentile/quantile of what has been recorded so far. A percentile, or quantile, is a value between 0.0 and 1.0, both inclusive, which represents a percentage of the recorded samples. In other words, given a percentile, the returned value will be the latency in milliseconds, that the given percent of samples is less than or equal to. For instance, if given the percentile 0.9 returns 120, then 90% of all recorded latency samples will be less than or equal to 120 milliseconds.

Note

Implementers should strive to return `Double.NaN` as a sentinel value, if they do not support recording of the allocation latencies and/or returning a specific percentile of such recordings.

Parameters
percentile:double

The percentile/quantile to get a value for.

Returns:double

The latency value in milliseconds for the given percentile/quantile.

getObjectLifetimePercentileback to summary
public double getObjectLifetimePercentile(double percentile)

Get the approximate object lifetime, in milliseconds, for the given percentile/quantile. A percentile, or quantile, is a value between 0.0 and 1.0, both inclusive, which represents a percentage of the recorded samples. In other words, given a percentile, the returned value will be the latency in milliseconds, that the given percent of samples is less than or equal to. For instance, if given the percentile 0.9 returns 120, then 90% of all recorded latency samples will be less than or equal to 120 milliseconds.

Note

Implementers should strive to return `Double.NaN` as a sentinel value, if they do not support recording of the allocation latencies and/or returning a specific percentile of such recordings.

Parameters
percentile:double

The percentile/quantile to get a value for.

Returns:double

The latency value in milliseconds for the given percentile/quantile.

getReallocationFailurePercentileback to summary
public double getReallocationFailurePercentile(double percentile)

Get the approximate latency value, in milliseconds, for failed reallocation latencies within the given percentile/quantile of what has been recorded so far. A percentile, or quantile, is a value between 0.0 and 1.0, both inclusive, which represents a percentage of the recorded samples. In other words, given a percentile, the returned value will be the latency in milliseconds, that the given percent of samples is less than or equal to. For instance, if given the percentile 0.9 returns 120, then 90% of all recorded latency samples will be less than or equal to 120 milliseconds.

Note

Implementers should strive to return `Double.NaN` as a sentinel value, if they do not support recording of the allocation latencies and/or returning a specific percentile of such recordings.

Parameters
percentile:double

The percentile/quantile to get a value for.

Returns:double

The latency value in milliseconds for the given percentile/quantile.

getReallocationLatencyPercentileback to summary
public double getReallocationLatencyPercentile(double percentile)

Get the approximate latency value, in milliseconds, for reallocation latencies within the given percentile/quantile of what has been recorded so far. A percentile, or quantile, is a value between 0.0 and 1.0, both inclusive, which represents a percentage of the recorded samples. In other words, given a percentile, the returned value will be the latency in milliseconds, that the given percent of samples is less than or equal to. For instance, if given the percentile 0.9 returns 120, then 90% of all recorded latency samples will be less than or equal to 120 milliseconds.

Note

Implementers should strive to return `Double.NaN` as a sentinel value, if they do not support recording of the allocation latencies and/or returning a specific percentile of such recordings.

Parameters
percentile:double

The percentile/quantile to get a value for.

Returns:double

The latency value in milliseconds for the given percentile/quantile.

recordAllocationFailureLatencySampleMillisback to summary
public void recordAllocationFailureLatencySampleMillis(long milliseconds)

Record a latency sample of a failed allocation, in milliseconds. This is the time it took for a call to Allocator#allocate(Slot) to throw an exception or return `null`.

Parameters
milliseconds:long

How many milliseconds transpired before the allocation failed.

recordAllocationLatencySampleMillisback to summary
public void recordAllocationLatencySampleMillis(long milliseconds)

Record a latency sample of a successful allocation, in milliseconds. This is the time it took for a call to Allocator#allocate(Slot) to return a useable object.

Parameters
milliseconds:long

How many milliseconds it took to successfully allocate an object.

recordDeallocationLatencySampleMillisback to summary
public void recordDeallocationLatencySampleMillis(long milliseconds)

Record a latency sample of a deallocation, in milliseconds. This is the time it took to complete a call to Allocator#deallocate(Poolable).

Parameters
milliseconds:long

How many milliseconds to took to deallocate an object.

recordObjectLifetimeSampleMillisback to summary
public void recordObjectLifetimeSampleMillis(long milliseconds)

Record an object lifetime sample, in milliseconds. This is the time that transpired from an object was allocated with Allocator#allocate(Slot), till it was deallocated with Allocator#deallocate(Poolable).

Parameters
milliseconds:long

How many milliseconds a Poolable object was in circulation; from it was created, till it was deallocated.

recordReallocationFailureLatencySampleMillisback to summary
public void recordReallocationFailureLatencySampleMillis(long milliseconds)

Record a latency sample of a failed reallocation, in milliseconds. This is the time it took for a call to Reallocator#reallocate(Slot, Poolable) to throw an exception or return `null`.

Parameters
milliseconds:long

How many milliseconds transpired before the reallocation failed.

recordReallocationLatencySampleMillisback to summary
public void recordReallocationLatencySampleMillis(long milliseconds)

Record a latency sample of a successful reallocation, in milliseconds. This is the time it took for a call to Reallocator#reallocate(Slot, Poolable) to return a useable object.

Parameters
milliseconds:long

How many milliseconds it took to successfully reallocate an object.