com.neeve.stats
Interface IStats.Series

All Known Subinterfaces:
IStats.Latencies
All Known Implementing Classes:
Stats.LatencyManager
Enclosing interface:
IStats

public static interface IStats.Series

Interface used to collect series data points.

A Series stat records information used to create histo graphical data over a series of data points. For example IStats.Series might be used to record the latencies of received messages by calling add(double) with the the current time minus the origin time.

The series interface is model around the double data type, but the actual precision and data type of the implementation could be another numeric type with lower memory overhead and serialization costs. Such implementations down cast to their native as returned by getType(); caller should ensure a value recorded via add(double) can be cast to the type dictated by the IStats.Series.Type


Nested Class Summary
static interface IStats.Series.Collector
          Passed to a IStats.Series stat to collect recorded values.
static class IStats.Series.Type
          Used to indicate the type of value that a Series records.
 
Field Summary
static String PROP_SERIES_SAMPLE_SIZE
          Property that can be used to control the default sampling size for series stats.
static int PROP_SERIES_SAMPLE_SIZE_DEFAULT
          The default value for PROP_SERIES_SAMPLE_SIZE.
 
Method Summary
 long add(double value)
          Adds a recorded latency sample.
 void compute()
          Computes statistic values.
 long get(IStats.Series.Collector collector, cern.colt.list.DoubleArrayList temp, long minSequenceNumber)
          Collects currently captured data points into the provide IStats.Series.Collector.
 void get(StringBuilder builder, NumberFormat format)
          Appends the series' computed values calculted by compute() to the provided StringBuilder.
 String getName()
          Gets statistic name.
 XString getNameAsRaw()
          Gets the stat's name as an XString.
 IStats.Series.Type getType()
          Gets the underlying type for the Series.
 double max()
          Gets the maximum value last computed via compute().
 double mean()
          Gets the mean value last computed via compute().
 double median()
          Gets the median value computed via compute().
 double min()
          Gets the minimum value last computed via compute().
 double pct75()
          Gets the 75%ile value computed via compute().
 double pct90()
          Gets the 90%ile value computed via compute().
 double pct99()
          Gets the 99%ile value computed via compute().
 double pct999()
          Gets the 99.9%ile value computed via compute().
 double pct9999()
          Gets the 99.99%ile value computed via compute().
 void reset()
          Clears and resets tracking.
 long sample()
          Gets the sample on which the latency stats were computed during compute().
 long sequenceNumber()
          Gets the sequence number of the last recorded value.
 int size()
          Returns the maximum sample size of data points that can be held.
 

Field Detail

PROP_SERIES_SAMPLE_SIZE

static final String PROP_SERIES_SAMPLE_SIZE
Property that can be used to control the default sampling size for series stats.

If the number of datapoints collected in a stats interval exceeds this size the computation for histographical data will be lossy, increasing the value will reduce loss of datapoints, but results in greater overhead in stats collection in terms of both memory usage and pressure on the process caches. Default value: 10240

See Also:
Constant Field Values

PROP_SERIES_SAMPLE_SIZE_DEFAULT

static final int PROP_SERIES_SAMPLE_SIZE_DEFAULT
The default value for PROP_SERIES_SAMPLE_SIZE.

See Also:
Constant Field Values
Method Detail

getName

String getName()
Gets statistic name.

Returns:
The statistic name

getType

IStats.Series.Type getType()
Gets the underlying type for the Series.

The IStats.Series.Type indicates what primitive types to which the values returned by the Series can be safely cast.

Returns:
The IStats.Series's IStats.Series.Type.

getNameAsRaw

XString getNameAsRaw()
Gets the stat's name as an XString.

Returns:
The statistic name in raw form

sequenceNumber

long sequenceNumber()
Gets the sequence number of the last recorded value.


sample

long sample()
Gets the sample on which the latency stats were computed during compute().

Returns:
The number of samples over which the current values have been computed.

min

double min()
Gets the minimum value last computed via compute().

This value can be cast according to this IStats.Series's IStats.Series.Type.

Returns:
the minimum value captured.

max

double max()
Gets the maximum value last computed via compute().

This value can be cast according to this IStats.Series's IStats.Series.Type.

Returns:
the maximum value captured.

mean

double mean()
Gets the mean value last computed via compute().

This value can be cast according to this IStats.Series's IStats.Series.Type.

Returns:
the mean value.

median

double median()
Gets the median value computed via compute().

This value can be cast according to this IStats.Series's IStats.Series.Type.

Returns:
the median latency.

pct75

double pct75()
Gets the 75%ile value computed via compute().

This value can be cast according to this IStats.Series's IStats.Series.Type.

Returns:
the 75 percentile value.

pct90

double pct90()
Gets the 90%ile value computed via compute().

This value can be cast according to this IStats.Series's IStats.Series.Type.

Returns:
the 90 percentile value.

pct99

double pct99()
Gets the 99%ile value computed via compute().

This value can be cast according to this IStats.Series's IStats.Series.Type.

Returns:
the 99 percentile value.

pct999

double pct999()
Gets the 99.9%ile value computed via compute().

This value can be cast according to this IStats.Series's IStats.Series.Type.

Returns:
the 99.9 percentile value.

pct9999

double pct9999()
Gets the 99.99%ile value computed via compute().

This value can be cast according to this IStats.Series's IStats.Series.Type.

Returns:
the 99.99 percentile value.

compute

void compute()
Computes statistic values. This method may be called periodically by a stat thread allowing stats based on the counter to be computed.

Threading:
This method should only be called periodically by a single statistics output thread as it records interval based stats.

get

void get(StringBuilder builder,
         NumberFormat format)
Appends the series' computed values calculted by compute() to the provided StringBuilder.

Threading:
this call is not safe for concurrent access by multiple threads.

get

long get(IStats.Series.Collector collector,
         cern.colt.list.DoubleArrayList temp,
         long minSequenceNumber)
Collects currently captured data points into the provide IStats.Series.Collector.

Parameters:
collector - The collector to which values will be collected via IStats.Series.Collector.add(long, double)
temp - A temporary list into which collected values will be copied.
minSequenceNumber - The minimum sequence number (inclusive) to collect.
Returns:
the sequence number of the first element reported or -1 if minSequenceNumber is greater than the current series sequence number
Threading:
The method is not safe for concurrent access by multiple threads with itself of any other method other than add(double).

add

long add(double value)
Adds a recorded latency sample.

The added value should be castable to this IStats.Series's IStats.Series.Type.

Parameters:
value - the sampled value to record.
Returns:
the sequence number of the element added.
Threading:
The method is not safe for concurrent access by multiple threads.

size

int size()
Returns the maximum sample size of data points that can be held.

Returns:
The number of historic data points this series can retain before older values are discarded.

reset

void reset()
Clears and resets tracking.

Threading:
The method is not safe for concurrent access by multiple threads.


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.