Package org.voltdb.client
Class ClientStatsContext
java.lang.Object
org.voltdb.client.ClientStatsContext
An object to store and manipulate statistics information from the VoltDB Java client. Each instance has a set of timestamped baseline statistics and a set of timestamped current statistics. Given these two sets of data, this object can return statistics covering the period between the baseline data and current data.
An instance is created using Client.createStatsContext().
Mutliple instances can coexist, each covering a different time
period. See the Voter example in /examples for an example of using
one context for long term stats and another for short term updates.
-
Method Summary
Modifier and TypeMethodDescriptionfetch()Fetch current statistics from the client internals.Fetch current statistics from the client internals and set them to be the current baseline.Get the client affinity stats.Roll up the per-partition affinity stats and return the totals for each of the four categories.Return a map of maps by connection id.getStats()Return aClientStatsthat covers all procedures and all connection ids.Return a map ofClientStatsby connection id.Return a map ofClientStatsby procedure name.getStatsForProcedure(String procedureName) Return aClientStatsinstance for a specific procedure name.void
-
Method Details
-
fetch
Fetch current statistics from the client internals. Don't update the baseline. This will increase the range covered by anyClientStatsinstances returned from this context.- Returns:
- A
thispointer for chaining calls.
-
fetchAndResetBaseline
Fetch current statistics from the client internals and set them to be the current baseline. Subsequent calls togetStats(..)methods on this instance will return 0 values for all statistics until eitherfetch()orfetchAndResetBaseline()are called.- Returns:
- A new ClientStatsContext object that uses the newly fetched stats with the old baseline.
-
getStats
Return aClientStatsthat covers all procedures and all connection ids. TheClientStatsinstance will apply to the time period currently covered by the context. If the mergedClientStatshas no recorded transactions then we force the timestamps to the context's range, to avoid strange results from the start time being after the end time.- Returns:
- A
ClientStatsinstance.
-
getStatsByProc
Return a map ofClientStatsby procedure name. This will roll upClientStatsinstances by connection id. EachClientStatsinstance will apply to the time period currently covered by the context.- Returns:
- A map from procedure name to
ClientStatsinstances.
-
getStatsByConnection
Return a map ofClientStatsby connection id. This will roll upClientStatsinstances by procedure name for each connection. Note that connection id is unique, while hostname and port may not be. Hostname and port will be included in theClientStatsinstance data. EachClientStatsinstance will apply to the time period currently covered by the context.- Returns:
- A map from connection id to
ClientStatsinstances.
-
getCompleteStats
Return a map of maps by connection id. Each sub-map maps procedure names toClientStatsinstances. Note that connection id is unique, while hostname and port may not be. Hostname and port will be included in theClientStatsinstance data. EachClientStatsinstance will apply to the time period currently covered by the context. This is full set of data available from this context instance.- Returns:
- A map from connection id to
ClientStatsinstances.
-
getAffinityStats
Get the client affinity stats. Will only be populated if client affinity is enabled.- Returns:
- A map from an internal partition id to a
ClientAffinityStatsinstance.
-
getAggregateAffinityStats
Roll up the per-partition affinity stats and return the totals for each of the four categories. Will only be populated if client affinity is enabled.- Returns:
- A
ClientAffinityStatsinstance covering all partitions.
-
getStatsForProcedure
Return aClientStatsinstance for a specific procedure name. This will be rolled up across all connections. TheClientStatsinstance will apply to the time period currently covered by the context.- Parameters:
procedureName- Name of the procedure.- Returns:
- A
ClientStatsinstance.
-
getConnectionRequestStats
-
resetConnectionRequestStats
public void resetConnectionRequestStats()
-