Anaconda OpenTelemetry for Typescript
    Preparing search index...

    Function incrementCounter

    • Increments a named counter by a specified value and optional attributes.

      Parameters

      • args: CounterArgs

        An argument list object where the name field is required.

        The args is an object defined by (in any order):

        {
        name: string = ""; Required; Not supplying a name will result in no value being recorded.
        by?: number = 1; Optional; Not supplying this field will result in the counter being incremented by `1`.
        forceUpDownCounter?: boolean = false; Optional; Counters by default are incrementing only, set to `true` to force an updown counter.
        attributes?: AttrMap = {}; Optional; Attributes for the counter metric.
        }

      Returns boolean

      true if the counter was incremented successfully, false if metrics are not initialized.

      // Creates a incrementing only counter set to `1` or increments an existing counter by `1`.
      incrementCounter({name: "validName"})

      // Creates a incrementing and decrementing counter set to `1` or increments an existing counter by `1`.
      incrementCounter({forceUpDown: true, name: "upDownValidName", attributes: {"name": "value"}})

      // Creates a incrementing and decrementing counter set to `5` or increments an existing counter by `5`.
      incrementCounter({by: 5, name: "newCounter", forceUpDown: true})