A timing distribution metric.

Timing distributions are used to accumulate and store time measurement, for analyzing distributions of the timing data.

Constructors

Properties

#inner: InternalTimingDistributionMetricType

Methods

  • Accumulates the provided samples in the metric.

    Notes Reports an ErrorType.InvalidOverflow error for samples that are longer than MAX_SAMPLE_TIME.

    Parameters

    • samples: number[]

      A list of samples recorded by the metric. Samples must be in nanoseconds.

    Returns void

  • Accumulates the provided signed samples in the metric.

    This will take care of filtering and reporting errors for any provided negative sample.

    Please note that this assumes that the provided samples are already in the "unit" declared by the instance of the metric type (e.g. if the instance this method was called on is using TimeUnit.Second, then samples are assumed to be in that unit).

    Discards any negative value in samples and reports an ErrorType.InvalidValue for each of them. Reports an ErrorType.InvalidOverflow error for samples that are longer than MAX_SAMPLE_TIME.

    Parameters

    • samples: number[]

      Holds all the samples for the recorded metric.

    Returns void

  • Aborts a previous start call.

    No error is recorded if no start was called.

    Parameters

    • id: number

      The timer ID to associate with this timing. This allows for concurrent timing of events associated with different IDs to the same timing distribution metric.

    Returns void

  • Test-only API

    Accumulates the provided signed samples in the metric.

    Use accumulateSamples instead.

    Parameters

    • samples: number[]

      Signed samples to accumulate in metric.

    Returns void

  • Test-only API

    Set stop time for the metric.

    Use stopAndAccumulate instead.

    Parameters

    • id: number

      Timer ID to stop

    • stopTime: number

      End time for the current timer

    Returns void

  • Starts tracking time for the provided metric. Multiple timers can run simultaneously.

    This records an error if it's already tracking time (i.e. start was already called with no corresponding stopAndAccumulate): in that case the original start time will be preserved.

    Returns number

    The ID to associate with this timing.

  • Stop tracking time for the provided metric and associated timer id. Add a count to the corresponding bucket in the timing distribution. This will record an error if no start was called.

    Parameters

    • id: number

      The timer id associated with this timing. This allows for concurrent timing of events associated with different ids to the same timespan metric.

    Returns void

  • Test-only API

    Returns the number of errors recorded for the given metric.

    Parameters

    • errorType: string

      The type of the error recorded.

    • ping: string = ...

      Represents the name of the ping to retrieve the metric for. Defaults to the first value in sendInPings.

    Returns number

    The number of errors recorded for the metric.

Generated using TypeDoc