Class Snapshot
- java.lang.Object
-
- com.opencloud.rhino.monitoring.stats.ext.Snapshot
-
- All Implemented Interfaces:
Serializable
public class Snapshot extends Object implements Serializable
Encapsulates a single snapshot of statistics from a Rhino cluster at a particular point in time.
A snapshot contains a timestamp and a arrays of sample data (see
getData()
), with one array for each subscription represented in the snapshot. The sample data can be matched with a subscription id usinggetSubscriptionIds()
.Content of data array
The array returned by
getData()
is two dimensional. For each subscription the index for that subscription in the first dimension equals that subscription id’s position within the array of subscription id’s (returned bygetSubscriptionIds()
). So for a subscription id N, the data for that statistic within the snapshot isgetData()[<position of N within getSubscriptionIds() array>]
and is of the type along[]
. The content of thelong[]
depends on the subscription mode of the subscription (seeSubscriptionMode
).-
SIMPLE_COUNTER a one element array containing the counter value
-
SIMPLE_GAUGE a one element array containing the gauge value
-
DELTA_COUNTER a two element array containing the counter delta followed by the current counter value, or zero elements if this is the first sample and no delta value is available yet
-
PER_SECOND_COUNTER a two element array containing the per-second counter delta followed by the current counter value, or zero elements if this is the first sample and no delta value is available yet
-
ROLLING_FREQUENCY_DISTRIBUTION, PERMANENT_FREQUENCY_DISTRIBUTION, RESETTING_FREQUENCY_DISTRIBUTION an N-element array containing the minimum observed sample, the maximum observed sample, the minimum bin, the maximum bin, a bin size, followed by a number of bins containing a count of the samples that fell within each
Example
For example a snapshot containing samples of 3 statistics: foo (with subscription id = 2), bar (with subscription id = 3), and baz (with subscription id = 5) will contain the following results:
getSubscriptionIds()[]
-
[0] == 2
-
[1] == 3
-
[2] == 5
getData()[][]
-
[0] == [<values forfoo>]
-
[1] == [<values forbar>]
-
[2] == [<values forbaz>]
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Snapshot(long timestamp, int[] subscriptionIds, int[] respondingNodeIds, long[][] data)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long[][]
getData()
Returns the data attached to this snapshotint[]
getRespondingNodeIds()
Return an array containing the node id of the node that provided the returned value for each corresponding subscription id.int[]
getSubscriptionIds()
Returns the array of subscription id’s represented in this snapshotlong
getTimestamp()
The timestamp at which this snapshot was taken
-
-
-
Method Detail
-
getData
public final long[][] getData()
Returns the data attached to this snapshot
- Returns:
- an array of long[] for each subscription included in the snapshot
-
getSubscriptionIds
public final int[] getSubscriptionIds()
Returns the array of subscription id’s represented in this snapshot
The subscription id’s appear in the same order as the data for each subscription in
getData()
.- Returns:
- an array of ordered subscription id’s
-
getTimestamp
public final long getTimestamp()
The timestamp at which this snapshot was taken
- Returns:
- timestamp
-
getRespondingNodeIds
public int[] getRespondingNodeIds()
Return an array containing the node id of the node that provided the returned value for each corresponding subscription id.
This array will be the same length as that returned by
getSubscriptionIds()
. It can be used to determine which value comes from which cluster node in case there are multiple values for a subscribed statistic in the snapshot (this will be the case if the subscription has used the special node if0
to get values from all nodes (see alsosubscribe
methods inStatsManagementMBean
.In case the client has subscribed to statistics from only an individual node there is no need to look at this array because the node will already be known from the subscription id.
- Returns:
- an array of ordered responding node ids
-
-