Setu-TS
    Preparing search index...

    Hierarchy

    • MetricBase
      • Counter
    Index
    • Gets the current value for a label set.

      Parameters

      • Optionallabels: Readonly<Record<string, string>>

        Label values keyed by label name

      Returns number

      The current value

    • Increments the counter.

      Parameters

      • value: number = 1

        The value to add (default 1)

      • Optionallabels: Readonly<Record<string, string>>

        Label values keyed by label name

      Returns void

    • Creates a deterministic key from labels for storage/retrieval. A pure lookup: it reads the key cache but never adds to it, so a getter cannot grow the cache — only MetricBase.seriesKey, for an observed series, does.

      Parameters

      • labels: Readonly<Record<string, string>> | undefined

        The labels to key by

      Returns string

      A deterministic string key

    • Records an observation — equivalent to inc() for counters.

      Parameters

      • value: number = 1

        The value to add (default 1)

      • Optionallabels: Readonly<Record<string, string>>

        Label values keyed by label name

      Returns void

    • Validates an observation's label snapshot and returns its series key, in one pass when it can. A snapshot (from snapshotLabels) holds only own, enumerable data properties; when it has exactly as many as the configured names, and every configured name is among them, it carries exactly the configured labels — which is what validateLabels checks — provided the configured names are distinct (with ['a', 'a'], the set { a, b } would pass the count and presence test). Anything else takes validateLabels, so an invalid set throws the same error as before.

      Parameters

      • snapshot: Readonly<Record<string, string>> | undefined

        The observation's own copy of its labels

      Returns string

      The series key

      If the labels do not match the configured names

    • Copies the caller's labels once per observation. Validation, the series key and the stored labels all read this copy, so an accessor returning a different value on each read cannot file a series under one label set and export it under another.

      Parameters

      • labels: Readonly<Record<string, string>> | undefined

        The caller's labels

      Returns Readonly<Record<string, string>> | undefined

      A private copy, or undefined when unlabeled (null included)

    • Validates that label names match the configured labels.

      Parameters

      • labels: Readonly<Record<string, string>> | undefined

        The labels to validate

      Returns void

      If label names don't match the config