ModeShape Distribution 3.0.0.Beta4

org.modeshape.jcr
Class RepositoryStatistics

java.lang.Object
  extended by org.modeshape.jcr.RepositoryStatistics
All Implemented Interfaces:
RepositoryMonitor

@ThreadSafe
public class RepositoryStatistics
extends Object
implements RepositoryMonitor

A component that records statistics for a variety of repository metrics, and makes the statistics available for a variety of windows. The value metrics currently include:

  1. active sessions - the number of sessions that are open during the window;
  2. active queries - the number of queries that were executing during the window;
  3. workspaces - the number of workspaces in existence during the window;
  4. listeners - the number of listeners registered during the window;
  5. session-scoped locks - the number of locks held by sessions during the window;
  6. non-scoped locks - the number of non-scoped locks held during the window;
  7. save operations - the number of Session save operations performed the window;
  8. changed nodes - the number of nodes that were created, updated, or deleted during the window;
and the metrics that record durations include:
  1. session lifetime - the duration of the sessions closed during the window;
  2. query execution time - the duration of queries that finished during the window;
  3. sequencer execution time - the duration of sequencing operations completed during the window;
This class provides a way to obtain the history for a particular metric during a specified window, where the window is comprised of the statistics (the average value, minimum value, maximum value, variance, standard deviation, number of samples, and time interval of the statistics) for:
  1. each ten 5-second intervals during the last minute (60 seconds); or
  2. each minute during the last hour (60 minutes); or
  3. each hour during the last day (24 hours); or
  4. each day during the last week (7 days); or
  5. each week during the last year (52 weeks)

To use, simply instantiate and start it by supplying a ScheduledExecutorService instance, which is used to create a periodic task that runs every 5 seconds to roll up measured metrics into the various statistic windows. When completed, simply call stop() to have the object clean up after itself.


Nested Class Summary
static class RepositoryStatistics.DurationActivity
          The RepositoryStatistics.MetricHistory specialization used for recording the statistics for activities with measured durations.
protected static class RepositoryStatistics.DurationHistory
           
static class RepositoryStatistics.History
          A history of a metric for a given window in time.
protected static class RepositoryStatistics.MetricHistory
          Abstract base class for the RepositoryStatistics.ValueHistory and RepositoryStatistics.DurationHistory classes.
static class RepositoryStatistics.Statistics
          The statistics for a sample of values.
protected static class RepositoryStatistics.ValueHistory
          The RepositoryStatistics.MetricHistory specialization used for recording the statistics for running values.
 
Field Summary
static long CAPTURE_INTERVAL_IN_SECONDS
          The frequency at which the metric values are rolled into statistics.
protected static long DURATION_OF_24_HOURS_WINDOW_IN_SECONDS
           
protected static long DURATION_OF_52_WEEKS_WINDOW_IN_SECONDS
           
protected static long DURATION_OF_60_MINUTES_WINDOW_IN_SECONDS
           
protected static long DURATION_OF_60_SECONDS_WINDOW_IN_SECONDS
           
protected static long DURATION_OF_7_DAYS_WINDOW_IN_SECONDS
           
static int MAXIMUM_LONG_RUNNING_QUERY_COUNT
          The maximum number of longest-running queries to retain.
static int MAXIMUM_LONG_RUNNING_SEQUENCING_COUNT
          The maximum number of longest-running sequencing operations to retain.
static int MAXIMUM_LONG_RUNNING_SESSION_COUNT
          The maximum number of longest-running sessions to retain.
 
Method Summary
 Set<DurationMetric> getAvailableDurationMetrics()
          Get the DurationMetric enumerations that are available for use by the caller with RepositoryMonitor.getHistory(DurationMetric, Window).
 Set<ValueMetric> getAvailableValueMetrics()
          Get the ValueMetric enumerations that are available for use by the caller with RepositoryMonitor.getHistory(ValueMetric, Window).
 Set<Window> getAvailableWindows()
          Get the Window enumerations that are available for use by the caller with RepositoryMonitor.getHistory(DurationMetric, Window) and RepositoryMonitor.getHistory(ValueMetric, Window).
 RepositoryStatistics.History getHistory(DurationMetric metric, Window windowInTime)
          Get the statics for the specified duration metric during the given window in time.
 RepositoryStatistics.History getHistory(ValueMetric metric, Window windowInTime)
          Get the statics for the specified value metric during the given window in time.
 RepositoryStatistics.DurationActivity[] getLongestRunning(DurationMetric metric)
          Get the longest-running activities recorded for the specified metric.
static RepositoryStatistics.Statistics statisticsFor(long value)
          Utility method to construct the statistics for a series of values.
static RepositoryStatistics.Statistics statisticsFor(long[] values)
          Utility method to construct the statistics for a series of values.
static RepositoryStatistics.Statistics statisticsFor(RepositoryStatistics.Statistics[] statistics)
          Utility method to construct the composite statistics for a series of sampled statistics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAXIMUM_LONG_RUNNING_QUERY_COUNT

public static final int MAXIMUM_LONG_RUNNING_QUERY_COUNT
The maximum number of longest-running queries to retain.

See Also:
Constant Field Values

MAXIMUM_LONG_RUNNING_SEQUENCING_COUNT

public static final int MAXIMUM_LONG_RUNNING_SEQUENCING_COUNT
The maximum number of longest-running sequencing operations to retain.

See Also:
Constant Field Values

MAXIMUM_LONG_RUNNING_SESSION_COUNT

public static final int MAXIMUM_LONG_RUNNING_SESSION_COUNT
The maximum number of longest-running sessions to retain. Note that all active sessions (those that are not logged out) are excluded from this list.

See Also:
Constant Field Values

CAPTURE_INTERVAL_IN_SECONDS

public static final long CAPTURE_INTERVAL_IN_SECONDS
The frequency at which the metric values are rolled into statistics.

See Also:
Constant Field Values

DURATION_OF_52_WEEKS_WINDOW_IN_SECONDS

protected static final long DURATION_OF_52_WEEKS_WINDOW_IN_SECONDS

DURATION_OF_7_DAYS_WINDOW_IN_SECONDS

protected static final long DURATION_OF_7_DAYS_WINDOW_IN_SECONDS

DURATION_OF_24_HOURS_WINDOW_IN_SECONDS

protected static final long DURATION_OF_24_HOURS_WINDOW_IN_SECONDS

DURATION_OF_60_MINUTES_WINDOW_IN_SECONDS

protected static final long DURATION_OF_60_MINUTES_WINDOW_IN_SECONDS

DURATION_OF_60_SECONDS_WINDOW_IN_SECONDS

protected static final long DURATION_OF_60_SECONDS_WINDOW_IN_SECONDS
Method Detail

getAvailableDurationMetrics

public Set<DurationMetric> getAvailableDurationMetrics()
Description copied from interface: RepositoryMonitor
Get the DurationMetric enumerations that are available for use by the caller with RepositoryMonitor.getHistory(DurationMetric, Window).

Specified by:
getAvailableDurationMetrics in interface RepositoryMonitor
Returns:
the immutable set of DurationMetric instances; never null but possibly empty if the caller has no permissions to see any duration metrics
See Also:
RepositoryMonitor.getHistory(DurationMetric, Window), RepositoryMonitor.getLongestRunning(DurationMetric)

getAvailableValueMetrics

public Set<ValueMetric> getAvailableValueMetrics()
Description copied from interface: RepositoryMonitor
Get the ValueMetric enumerations that are available for use by the caller with RepositoryMonitor.getHistory(ValueMetric, Window).

Specified by:
getAvailableValueMetrics in interface RepositoryMonitor
Returns:
the immutable set of ValueMetric instances; never null but possibly empty if the caller has no permissions to see any value metrics
See Also:
RepositoryMonitor.getHistory(ValueMetric, Window)

getAvailableWindows

public Set<Window> getAvailableWindows()
Description copied from interface: RepositoryMonitor
Get the Window enumerations that are available for use by the caller with RepositoryMonitor.getHistory(DurationMetric, Window) and RepositoryMonitor.getHistory(ValueMetric, Window).

Specified by:
getAvailableWindows in interface RepositoryMonitor
Returns:
the immutable set of DurationMetric instances; never null but possibly empty if the caller has no permissions to see any windows
See Also:
RepositoryMonitor.getHistory(DurationMetric, Window), RepositoryMonitor.getHistory(ValueMetric, Window)

getHistory

public RepositoryStatistics.History getHistory(ValueMetric metric,
                                               Window windowInTime)
Description copied from interface: RepositoryMonitor
Get the statics for the specified value metric during the given window in time. The oldest statistics will be first, while the newest statistics will be last.

Specified by:
getHistory in interface RepositoryMonitor
Parameters:
metric - the value metric; may not be null
windowInTime - the window specifying which statistics are to be returned; may not be null
Returns:
the history of the metrics; never null but possibly empty if there are no statistics being captures for this repository
See Also:
RepositoryMonitor.getAvailableValueMetrics(), RepositoryMonitor.getAvailableWindows()

getHistory

public RepositoryStatistics.History getHistory(DurationMetric metric,
                                               Window windowInTime)
Description copied from interface: RepositoryMonitor
Get the statics for the specified duration metric during the given window in time. The oldest statistics will be first, while the newest statistics will be last.

Specified by:
getHistory in interface RepositoryMonitor
Parameters:
metric - the duration metric; may not be null
windowInTime - the window specifying which statistics are to be returned; may not be null
Returns:
the history of the metrics; never null but possibly empty if there are no statistics being captures for this repository
See Also:
RepositoryMonitor.getAvailableDurationMetrics(), RepositoryMonitor.getAvailableWindows()

getLongestRunning

public RepositoryStatistics.DurationActivity[] getLongestRunning(DurationMetric metric)
Description copied from interface: RepositoryMonitor
Get the longest-running activities recorded for the specified metric. The results contain the duration records in order of increasing duration, with the activity with the longest duration appearing last in the array.

Specified by:
getLongestRunning in interface RepositoryMonitor
Parameters:
metric - the duration metric; may not be null
Returns:
the activities with the longest durations; never null but possibly empty if no such activities were performed
See Also:
RepositoryMonitor.getAvailableDurationMetrics()

statisticsFor

public static RepositoryStatistics.Statistics statisticsFor(long value)
Utility method to construct the statistics for a series of values.

Parameters:
value - the single value
Returns:
the core statistics; never null

statisticsFor

public static RepositoryStatistics.Statistics statisticsFor(long[] values)
Utility method to construct the statistics for a series of values.

Parameters:
values - the values; the array reference may not be null but the array may be empty
Returns:
the core statistics; never null

statisticsFor

public static RepositoryStatistics.Statistics statisticsFor(RepositoryStatistics.Statistics[] statistics)
Utility method to construct the composite statistics for a series of sampled statistics.

Parameters:
statistics - the sample statistics that are to be combined; the array reference may not be null but the array may be empty
Returns:
the composite statistics; never null

ModeShape Distribution 3.0.0.Beta4

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.