Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Counter

Counter is the most common synchronous instrument. This instrument supports an Add(increment) function for reporting a sum, and is restricted to non-negative increments. The default aggregation is Sum, as for any additive instrument.

Example uses for Counter:

  1. count the number of bytes received.
  2. count the number of requests completed.
  3. count the number of accounts created.
  4. count the number of checkpoints run.
  5. count the number of 5xx errors.

Hierarchy

Implemented by

Index

Methods

Methods

add

  • add(value: number, labels?: Labels): void
  • Adds the given value to the current value. Values cannot be negative.

    Parameters

    • value: number
    • Optional labels: Labels

    Returns void

bind

  • Returns a Instrument associated with specified Labels. It is recommended to keep a reference to the Instrument instead of always calling this method for every operations.

    Parameters

    • labels: Labels

      key-values pairs that are associated with a specific metric that you want to record.

    Returns BoundCounter

clear

  • clear(): void

unbind

  • unbind(labels: Labels): void