Options
All
  • Public
  • Public/Protected
  • All
Menu

A counter metric.

Used to count things. The value can only be incremented, not decremented.

Hierarchy

  • default

Index

Constructors

Properties

Methods

  • add(amount?: number): void
  • Increases the counter by amount.

    Note

    • Logs an error if the amount is 0 or negative.
    • If the addition yields a number larger than Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER will be recorded.

    Parameters

    • Optional amount: number

      The amount to increase by. Should be positive. If not provided will default to 1.

    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