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 for the internal system procedure calls the client issues on its own behalf (topology, catalog, partition-key and system-info refreshes).Return a map of maps by connection id.Return the per-connection statistics for all current connections from this client.Return aClientStatsthat covers all of the internal system procedure calls the client issued on its own behalf, rolled up across all connections.Return a map ofClientStatsby procedure name for the internal system procedure calls the client issued on its own behalf.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.voidResets the per-connection statistics for all current connections from this client.
-
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.
-
getInternalStats
Return aClientStatsthat covers all of the internal system procedure calls the client issued on its own behalf, rolled up across all connections. These are the topology, catalog, partition-key and system-information refreshes the client performs as housekeeping; they are reported here rather than mixed intogetStats()so that a slow housekeeping call does not distort the reported workload latency (ENG-29716). A slow topology refresh is still a useful diagnostic - it simply is not application latency. If the mergedClientStatshas no recorded transactions then the timestamps are forced 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.
-
getInternalStatsByProc
Return a map ofClientStatsby procedure name for the internal system procedure calls the client issued on its own behalf. This is the per-procedure counterpart togetStatsByProc(), covering only client housekeeping (topology, catalog, partition-key and system-info refreshes) rather than application traffic.- 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.
-
getCompleteInternalStats
Return a map of maps by connection id for the internal system procedure calls the client issues on its own behalf (topology, catalog, partition-key and system-info refreshes). The structure mirrorsgetCompleteStats(), but covers only client housekeeping rather than application traffic. EachClientStatsinstance applies to the time period currently covered by the context.- Returns:
- A map from connection id to per-procedure
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
Return the per-connection statistics for all current connections from this client. Connections are identified by an arbitrary internal identifier.- Returns:
- map of
ClientConnectionRequestStatsby connection
-
resetConnectionRequestStats
public void resetConnectionRequestStats()Resets the per-connection statistics for all current connections from this client.
-