cascading.stats

## Class CascadingStats<Child>

- java.lang.Object
- - cascading.stats.CascadingStats<Child>

- All Implemented Interfaces:
    ProvidesCounters, java.io.Serializable
  Direct Known Subclasses:
    CascadeStats, FlowNodeStats, FlowStats, FlowStepStats

      public abstract class CascadingStats<Child>
      extends java.lang.Object
      implements ProvidesCounters, java.io.Serializable

  Class CascadingStats is the base class for all Cascading statistics gathering. It also reports the status of core elements that have state.

  There are eight states the stats object reports; PENDING, SKIPPED, STARTED, SUBMITTED, RUNNING, SUCCESSFUL, STOPPED, and FAILED.
  - `pending` - when the Flow or Cascade has yet to start.
  - `skipped` - when the Flow was skipped by the parent Cascade.
  - `started` - when `Flow.start()` was called.
  - `submitted` - when the Step was submitted to the underlying platform for work.
  - `running` - when the Flow or Cascade is executing a workload.
  - `stopped` - when the user calls `Flow.stop()` on the Flow or Cascade.
  - `failed` - when the Flow or Cascade threw an error and failed to finish the workload.
  - `successful` - when the Flow or Cascade naturally completed its workload without failure.

  CascadingStats also reports four unique timestamps.
  - `startTime` - when the `start()` method was called.
  - `submitTime` - when the unit of work was actually submitted for execution. Not supported by all sub-classes.
  - `runTime` - when the unit of work actually began to execute work. This value may be affected by any "polling interval" in place.
  - `finishedTime` - when all work has completed successfully, failed, or stopped.

  A unit of work is considered `finished` when the Flow or Cascade is no longer processing a workload and `successful`, `skipped`, `failed`, or `stopped` is true.

  It is important to note all the timestamps are client side observations. Not values reported by the underlying platform. That said, the transitions are seen by polling the client interface to the underlying platform so are effected by the `FlowProps.getJobPollingInterval()` value.
  See Also:
    `CascadeStats`, `FlowStats`, `FlowStepStats`, Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CascadingStats.Status`
    `static class` | `CascadingStats.Type`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ClientState` | `clientState`
    `protected long` | `finishedTime` Field finishedTime
    `protected java.util.concurrent.atomic.AtomicLong` | `lastCaptureDetail`
    `protected java.util.Set<StatsListener>` | `listeners`
    `protected java.lang.String` | `name` Field name
    `protected long` | `pendingTime` Field pendingTime
    `protected long` | `runTime` Field runTime
    `protected long` | `startTime` Field startTime
    `static java.lang.String` | `STATS_COMPLETE_CHILD_DETAILS_BLOCK_DURATION`
    `static java.lang.String` | `STATS_STORE_INTERVAL`
    `protected CascadingStats.Status` | `status` Field status
    `protected long` | `submitTime` Field submitTime
    `protected java.lang.Throwable` | `throwable` Field throwable
    `protected java.lang.String[]` | `throwableTrace` Field throwableTrace

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `CascadingStats(java.lang.String name, ClientState clientState)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addListener(StatsListener statsListener)`
    `void` | `captureDetail()` Method captureDetail will recursively capture details about nested systems.
    `abstract void` | `captureDetail(CascadingStats.Type depth)`
    `void` | `cleanup()` Method cleanup destroys any resources allocated by this instance.
    `protected void` | `fireListeners(CascadingStats.Status fromStatus, CascadingStats.Status toStatus)`
    `abstract java.util.Collection<Child>` | `getChildren()` Method getChildren returns any relevant child statistics instances.
    `abstract Child` | `getChildWith(java.lang.String id)` Method getChildWith returns a child stats instance with the given ID value.
    `abstract java.util.Collection<java.lang.String>` | `getCounterGroupsMatching(java.lang.String regex)` Method getCounterGroupsMatching returns all the available counter group names that match the given regular expression.
    `java.util.Collection<java.lang.String>` | `getCountersFor(java.lang.Class<? extends java.lang.Enum> group)` Method getCountersFor returns all the counter names for the counter Enum.
    `long` | `getCurrentDuration()` Method getCurrentDuration returns the current duration of the current work whether or not the work is finished.
    `long` | `getDuration()` Method getDuration returns the duration the work executed before being finished.
    `long` | `getFinishedTime()` Method getFinishedTime returns the finishedTime of this CascadingStats object.
    `abstract java.lang.String` | `getID()` Method getID returns the ID of this CascadingStats object.
    `java.lang.String` | `getName()` Method getName returns the name of this CascadingStats object.
    `long` | `getPendingTime()` Method getPendingTime returns the pendingTime of this CascadingStats object.
    `protected java.lang.String` | `getPrefix()`
    `protected abstract ProcessLogger` | `getProcessLogger()`
    `long` | `getRunTime()` Method getRunTime returns the runTime of this CascadingStats object.
    `long` | `getStartTime()` Method getStartTime returns the startTime of this CascadingStats object.
    `protected java.lang.String` | `getStatsString()`
    `CascadingStats.Status` | `getStatus()` Method getStatus returns the `CascadingStats.Status` of this CascadingStats object.
    `long` | `getSubmitTime()` Method getSubmitTime returns the submitTime of this CascadingStats object.
    `java.lang.Throwable` | `getThrowable()` Method getThrowable returns the throwable of this CascadingStats object.
    `java.lang.String[]` | `getThrowableTrace()` Method getThrowableTrace returns the throwableTrace of this CascadingStats object.
    `abstract CascadingStats.Type` | `getType()`
    `protected boolean` | `isDetailStale()` For rate limiting access to the backend.
    `boolean` | `isEngaged()` Method isEngaged returns true when there is work being executed, if `isStarted()`, `isSubmitted()`, or `isRunning()` returns true;
    `boolean` | `isFailed()` Method isFailed returns true when the work ended with an error.
    `boolean` | `isFinished()` Method isFinished returns true if the current status shows no work currently being executed, if `isSkipped()`, `isSuccessful()`, `isFailed()`, or `isStopped()` returns true.
    `boolean` | `isPending()` Method isPending returns true if no work has been submitted.
    `boolean` | `isRunning()` Method isRunning returns true when work has begun.
    `boolean` | `isSkipped()` Method isSkipped returns true when the works was skipped.
    `boolean` | `isStarted()` Method isStarted returns true when work has started.
    `boolean` | `isStopped()` Method isStopped returns true when the user stopped the work.
    `boolean` | `isSubmitted()` Method isSubmitted returns true if no work has started.
    `boolean` | `isSuccessful()` Method isSuccessful returns true when work has completed successfully.
    `protected void` | `logDebug(java.lang.String message, java.lang.Object... arguments)`
    `protected void` | `logError(java.lang.String message, java.lang.Object... arguments)`
    `protected void` | `logError(java.lang.String message, java.lang.Throwable throwable)`
    `protected void` | `logInfo(java.lang.String message, java.lang.Object... arguments)`
    `protected void` | `logWarn(java.lang.String message, java.lang.Object... arguments)`
    `protected void` | `markDetailCaptured()`
    `void` | `markFailed()` Method markFailed sets the status to `CascadingStats.Status.FAILED`.
    `void` | `markFailed(java.lang.String[] throwableTrace)` Method markFailed sets the status to `CascadingStats.Status.FAILED`.
    `void` | `markFailed(java.lang.Throwable throwable)` Method markFailed sets the status to `CascadingStats.Status.FAILED`.
    `protected void` | `markFailed(java.lang.Throwable throwable, java.lang.String[] throwableTrace)`
    `protected void` | `markFinishedTime()`
    `void` | `markPending()` Method markPending sets the status to `CascadingStats.Status.PENDING`.
    `protected void` | `markPendingTime()`
    `void` | `markRunning()` Method markRunning sets the status to `CascadingStats.Status.RUNNING`.
    `protected void` | `markRunTime()`
    `void` | `markSkipped()` Method markSkipped sets the status to `CascadingStats.Status.SKIPPED`.
    `void` | `markStarted()` Method markStarted sets the status to `CascadingStats.Status.STARTED`.
    `void` | `markStartedThenRunning()` Method markStartedThenRunning consecutively marks the status as `CascadingStats.Status.STARTED` then `CascadingStats.Status.RUNNING` and forces the start and running time to be equals.
    `protected void` | `markStartTime()`
    `protected void` | `markStartToRunTime()`
    `void` | `markStopped()` Method markStopped sets the status to `CascadingStats.Status.STOPPED`.
    `void` | `markSubmitted()` Method markSubmitted sets the status to `CascadingStats.Status.SUBMITTED`.
    `protected void` | `markSubmitTime()`
    `void` | `markSuccessful()` Method markSuccessful sets the status to `CascadingStats.Status.SUCCESSFUL`.
    `void` | `prepare()` Method prepare initializes this instance.
    `abstract void` | `recordInfo()`
    `void` | `recordStats()` Method recordStats forces recording of current status information.
    `boolean` | `removeListener(StatsListener statsListener)`
    `static void` | `setStatsStoreInterval(java.util.Map<java.lang.Object,java.lang.Object> properties, long intervalMs)` Method setStatsStoreInterval sets the interval time between store operations against the underlying document storage services.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface cascading.stats.ProvidesCounters

      `getCounterGroups, getCountersFor, getCounterValue, getCounterValue, getLastSuccessfulCounterFetchTime`

- - ### Field Detail

    - #### STATS_STORE_INTERVAL

          public static final java.lang.String STATS_STORE_INTERVAL

      See Also:
        Constant Field Values

    - #### STATS_COMPLETE_CHILD_DETAILS_BLOCK_DURATION

          public static final java.lang.String STATS_COMPLETE_CHILD_DETAILS_BLOCK_DURATION

      See Also:
        Constant Field Values

    - #### name

          protected final java.lang.String name

      Field name

    - #### clientState

          protected final ClientState clientState

    - #### status

          protected CascadingStats.Status status

      Field status

    - #### listeners

          protected java.util.Set<StatsListener> listeners

    - #### pendingTime

          protected long pendingTime

      Field pendingTime

    - #### startTime

          protected long startTime

      Field startTime

    - #### submitTime

          protected long submitTime

      Field submitTime

    - #### runTime

          protected long runTime

      Field runTime

    - #### finishedTime

          protected long finishedTime

      Field finishedTime

    - #### throwable

          protected java.lang.Throwable throwable

      Field throwable

    - #### throwableTrace

          protected java.lang.String[] throwableTrace

      Field throwableTrace

    - #### lastCaptureDetail

          protected java.util.concurrent.atomic.AtomicLong lastCaptureDetail

  - ### Constructor Detail

    - #### CascadingStats

          protected CascadingStats(java.lang.String name,
                        ClientState clientState)

  - ### Method Detail

    - #### setStatsStoreInterval

          public static void setStatsStoreInterval(java.util.Map<java.lang.Object,java.lang.Object> properties,
                                   long intervalMs)

      Method setStatsStoreInterval sets the interval time between store operations against the underlying document storage services. This affects the rate at which metrics and status information is updated.
      Parameters:
        `properties` - of type Properties
        `intervalMs` - milliseconds between storage calls

    - #### prepare

          public void prepare()

      Method prepare initializes this instance.

    - #### cleanup

          public void cleanup()

      Method cleanup destroys any resources allocated by this instance.

    - #### getID

          public abstract java.lang.String getID()

      Method getID returns the ID of this CascadingStats object.
      Returns:
        the ID (type Object) of this CascadingStats object.

    - #### getName

          public java.lang.String getName()

      Method getName returns the name of this CascadingStats object.
      Returns:
        the name (type String) of this CascadingStats object.

    - #### getType

          public abstract CascadingStats.Type getType()

    - #### getThrowable

          public java.lang.Throwable getThrowable()

      Method getThrowable returns the throwable of this CascadingStats object.
      Returns:
        the throwable (type Throwable) of this CascadingStats object.

    - #### getThrowableTrace

          public java.lang.String[] getThrowableTrace()

      Method getThrowableTrace returns the throwableTrace of this CascadingStats object.

      Will return null if not set.
      Returns:
        the throwableTrace (type String[]) of this CascadingStats object.

    - #### isPending

          public boolean isPending()

      Method isPending returns true if no work has been submitted.
      Returns:
        the pending (type boolean) of this CascadingStats object.

    - #### isSkipped

          public boolean isSkipped()

      Method isSkipped returns true when the works was skipped.

      Flows are skipped if the appropriate `FlowSkipStrategy.skipFlow(Flow)` returns `true`;
      Returns:
        the skipped (type boolean) of this CascadingStats object.

    - #### isStarted

          public boolean isStarted()

      Method isStarted returns true when work has started.
      Returns:
        the started (type boolean) of this CascadingStats object.

    - #### isSubmitted

          public boolean isSubmitted()

      Method isSubmitted returns true if no work has started.
      Returns:
        the submitted (type boolean) of this CascadingStats object.

    - #### isRunning

          public boolean isRunning()

      Method isRunning returns true when work has begun.
      Returns:
        the running (type boolean) of this CascadingStats object.

    - #### isEngaged

          public boolean isEngaged()

      Method isEngaged returns true when there is work being executed, if `isStarted()`, `isSubmitted()`, or `isRunning()` returns true;
      Returns:
        the engaged (type boolean) of this CascadingStats object.

    - #### isSuccessful

          public boolean isSuccessful()

      Method isSuccessful returns true when work has completed successfully.
      Returns:
        the completed (type boolean) of this CascadingStats object.

    - #### isFailed

          public boolean isFailed()

      Method isFailed returns true when the work ended with an error.
      Returns:
        the failed (type boolean) of this CascadingStats object.

    - #### isStopped

          public boolean isStopped()

      Method isStopped returns true when the user stopped the work.
      Returns:
        the stopped (type boolean) of this CascadingStats object.

    - #### isFinished

          public boolean isFinished()

      Method isFinished returns true if the current status shows no work currently being executed, if `isSkipped()`, `isSuccessful()`, `isFailed()`, or `isStopped()` returns true.
      Returns:
        the finished (type boolean) of this CascadingStats object.

    - #### getStatus

          public CascadingStats.Status getStatus()

      Method getStatus returns the `CascadingStats.Status` of this CascadingStats object.
      Returns:
        the status (type Status) of this CascadingStats object.

    - #### recordStats

          public void recordStats()

      Method recordStats forces recording of current status information.

    - #### recordInfo

          public abstract void recordInfo()

    - #### markPending

          public void markPending()

      Method markPending sets the status to `CascadingStats.Status.PENDING`.

    - #### markPendingTime

          protected void markPendingTime()

    - #### markStartedThenRunning

          public void markStartedThenRunning()

      Method markStartedThenRunning consecutively marks the status as `CascadingStats.Status.STARTED` then `CascadingStats.Status.RUNNING` and forces the start and running time to be equals.

    - #### markStartToRunTime

          protected void markStartToRunTime()

    - #### markStarted

          public void markStarted()

      Method markStarted sets the status to `CascadingStats.Status.STARTED`.

    - #### markStartTime

          protected void markStartTime()

    - #### markSubmitted

          public void markSubmitted()

      Method markSubmitted sets the status to `CascadingStats.Status.SUBMITTED`.

    - #### markSubmitTime

          protected void markSubmitTime()

    - #### markRunning

          public void markRunning()

      Method markRunning sets the status to `CascadingStats.Status.RUNNING`.

    - #### markRunTime

          protected void markRunTime()

    - #### markSuccessful

          public void markSuccessful()

      Method markSuccessful sets the status to `CascadingStats.Status.SUCCESSFUL`.

    - #### markFinishedTime

          protected void markFinishedTime()

    - #### markFailed

          public void markFailed()

      Method markFailed sets the status to `CascadingStats.Status.FAILED`.

    - #### markFailed

          public void markFailed(java.lang.Throwable throwable)

      Method markFailed sets the status to `CascadingStats.Status.FAILED`.
      Parameters:
        `throwable` - of type Throwable

    - #### markFailed

          public void markFailed(java.lang.String[] throwableTrace)

      Method markFailed sets the status to `CascadingStats.Status.FAILED`.
      Parameters:
        `throwableTrace` - of type String[]

    - #### markFailed

          protected void markFailed(java.lang.Throwable throwable,
                        java.lang.String[] throwableTrace)

    - #### markStopped

          public void markStopped()

      Method markStopped sets the status to `CascadingStats.Status.STOPPED`.

    - #### markSkipped

          public void markSkipped()

      Method markSkipped sets the status to `CascadingStats.Status.SKIPPED`.

    - #### getPendingTime

          public long getPendingTime()

      Method getPendingTime returns the pendingTime of this CascadingStats object.
      Returns:
        the pendingTime (type long) of this CascadingStats object.

    - #### getStartTime

          public long getStartTime()

      Method getStartTime returns the startTime of this CascadingStats object.
      Returns:
        the startTime (type long) of this CascadingStats object.

    - #### getSubmitTime

          public long getSubmitTime()

      Method getSubmitTime returns the submitTime of this CascadingStats object.
      Returns:
        the submitTime (type long) of this CascadingStats object.

    - #### getRunTime

          public long getRunTime()

      Method getRunTime returns the runTime of this CascadingStats object.
      Returns:
        the runTime (type long) of this CascadingStats object.

    - #### getFinishedTime

          public long getFinishedTime()

      Method getFinishedTime returns the finishedTime of this CascadingStats object.
      Returns:
        the finishedTime (type long) of this CascadingStats object.

    - #### getDuration

          public long getDuration()

      Method getDuration returns the duration the work executed before being finished.

      This method will return zero until the work is finished. See `getCurrentDuration()` if you wish to poll for the current duration value.

      Duration is calculated as `finishedTime - startTime`.
      Returns:
        the duration (type long) of this CascadingStats object.

    - #### getCurrentDuration

          public long getCurrentDuration()

      Method getCurrentDuration returns the current duration of the current work whether or not the work is finished. When finished, the return value will be the same as `getDuration()`.

      Duration is calculated as `finishedTime - startTime`.
      Returns:
        the currentDuration (type long) of this CascadingStats object.

    - #### getCountersFor

          public java.util.Collection<java.lang.String> getCountersFor(java.lang.Class<? extends java.lang.Enum> group)

      Description copied from interface: `ProvidesCounters`
      Method getCountersFor returns all the counter names for the counter Enum.
      Specified by:
        `getCountersFor` in interface `ProvidesCounters`
      Returns:
        Collection

    - #### getCounterGroupsMatching

          public abstract java.util.Collection<java.lang.String> getCounterGroupsMatching(java.lang.String regex)

      Method getCounterGroupsMatching returns all the available counter group names that match the given regular expression.
      Parameters:
        `regex` - of type String
      Returns:
        Collection

    - #### captureDetail

          public void captureDetail()

      Method captureDetail will recursively capture details about nested systems. Use this method to persist statistics about a given Cascade, Flow, FlowStep, or FlowNode.

      Each CascadingStats object must be individually inspected for any system specific details.

      Each call to this method will refresh the internal cache unless the current Stats object is marked finished. One additional refresh will happen after this instance is marked finished.

    - #### captureDetail

          public abstract void captureDetail(CascadingStats.Type depth)

    - #### isDetailStale

          protected boolean isDetailStale()

      For rate limiting access to the backend.

      Currently used at the Step and below.

    - #### markDetailCaptured

          protected void markDetailCaptured()

    - #### getChildren

          public abstract java.util.Collection<Child> getChildren()

      Method getChildren returns any relevant child statistics instances. They may not be of type CascadingStats, but instead platform specific.
      Returns:
        a Collection of child statistics

    - #### getChildWith

          public abstract Child getChildWith(java.lang.String id)

      Method getChildWith returns a child stats instance with the given ID value.
      Parameters:
        `id` - the id of a child instance
      Returns:
        the child stats instance or null if not found

    - #### addListener

          public void addListener(StatsListener statsListener)

    - #### removeListener

          public boolean removeListener(StatsListener statsListener)

    - #### fireListeners

          protected void fireListeners(CascadingStats.Status fromStatus,
                           CascadingStats.Status toStatus)

    - #### getProcessLogger

          protected abstract ProcessLogger getProcessLogger()

    - #### getStatsString

          protected java.lang.String getStatsString()

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### logInfo

          protected void logInfo(java.lang.String message,
                     java.lang.Object... arguments)

    - #### logDebug

          protected void logDebug(java.lang.String message,
                      java.lang.Object... arguments)

    - #### logWarn

          protected void logWarn(java.lang.String message,
                     java.lang.Object... arguments)

    - #### logError

          protected void logError(java.lang.String message,
                      java.lang.Object... arguments)

    - #### logError

          protected void logError(java.lang.String message,
                      java.lang.Throwable throwable)

    - #### getPrefix

          protected java.lang.String getPrefix()

Copyright © 2007-2015 Xplenty, Inc. All Rights Reserved.