Options
All
  • Public
  • Public/Protected
  • All
Menu

A timespan metric.

Timespans are used to make a measurement of how much time is spent in a particular task.

Hierarchy

  • default

Index

Constructors

Properties

Methods

  • cancel(): void
  • setRawNanos(elapsed: number): void
  • Explicitly sets the timespan value.

    This API should only be used if your library or application requires recording times in a way that can not make use of {@link InternalTimespanMetricType#start}/{@link InternalTimespanMetricType#stop}.

    Care should be taken using this if the ping lifetime might contain more than one timespan measurement. To be safe, this function should generally be followed by sending a custom ping containing the timespan.

    Parameters

    • elapsed: number

      The elapsed time to record, in nanoseconds.

    Returns void

  • start(): void
  • Starts tracking time for the provided metric.

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

    Returns void

  • stop(): void
  • Stops tracking time for the provided metric. Sets the metric to the elapsed time.

    This will record an error if no start() was called.

    Returns void

  • testGetNumRecordedErrors(errorType: string, ping?: string): Promise<number>
  • 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 Promise<number>

    the number of errors recorded for the metric.

  • testGetValue(ping?: string): Promise<undefined | number>
  • Test-only API.**

    Gets the currently stored value as a number.

    This doesn't clear the stored value.

    Parameters

    • ping: string = ...

      the ping from which we want to retrieve this metrics value from. Defaults to the first value in sendInPings.

    Returns Promise<undefined | number>

    The value found in storage or undefined if nothing was found.

Generated using TypeDoc