matrix-appservice-bridge
    Preparing search index...

    Class PrometheusMetrics

    Index

    Constructors

    • Constructs a new Prometheus Metrics instance. The metric app_version will be set here, so ensure that getBridgeVersion will return the correct bridge version.

      Parameters

      • Optionalregister: Registry<"text/plain; version=0.0.4; charset=utf-8">

        A custom registry to provide, if not using the global default.

      Returns PrometheusMetrics

    Properties

    AgeCounters: typeof AgeCounters = AgeCounters

    Methods

    • Registers the /metrics page generating function with the containing Express app.

      Parameters

      • bridge: Bridge

        The containing Bridge instance.

      Returns void

    • Adds a new collector function. These collector functions are run whenever the /metrics page is about to be generated, allowing code to update values of gauges.

      Parameters

      • func: CollectorFunction

        A new collector function. This function is passed no arguments and is not expected to return anything. It runs purely to have a side-effect on previously registered gauges.

      Returns void

    • Adds a new counter metric

      Parameters

      • opts: CounterOpts

        Options

        • namespace

          An optional toplevel namespace name for the new metric. Default: "bridge".

        • name

          The variable name for the new metric.

        • help

          Descriptive help text for the new metric. Once created, the value of this metric can be incremented with the incCounter method.

        • labels

          An optional list of string label names

      Returns Counter<string>

      A counter metric.

    • Adds a new gauge metric.

      Parameters

      • opts: GaugeOpts

        Options

        • namespace

          An optional toplevel namespace name for the new metric. Default: "bridge".

        • name

          The variable name for the new metric.

        • help

          Descriptive help text for the new metric.

        • labels

          An optional list of string label names

        • refresh

          An optional function to invoke to generate a new value for the gauge. If a refresh function is provided, it is invoked with the gauge as its only parameter. The function should call the set() method on this gauge in order to provide a new value for it.

      Returns Gauge<string>

      A gauge metric.

    • Adds a new timer metric, represented by a prometheus Histogram.

      Parameters

      • opts: HistogramOpts

        Options

        • namespace

          An optional toplevel namespace name for the new metric. Default: "bridge".

        • name

          The variable name for the new metric.

        • help

          Descriptive help text for the new metric.

        • buckets

          The buckets that should be used for the histogram.

        • labels

          An optional list of string label names

      Returns Histogram<string>

      A histogram metric. Once created, the value of this metric can be incremented with the startTimer method.

    • Increments the value of a counter metric @param{string} name The name the metric was previously registered as. @param{Object} labels Optional object containing additional label values.

      Parameters

      • name: string
      • labels: { [label: string]: string }

      Returns void

    • Fetch metrics from all configured collectors

      Returns Promise<void>

    • Registers some exported metrics that expose counts of various kinds of objects within the bridge.

      Parameters

      Returns Promise<void>

    • Registers some exported metrics that relate to operations of the embedded matrix-bot-sdk. In particular, a metric is added that counts the number of calls to client API endpoints made by the client library.

      Parameters

      • appservice: Appservice

      Returns void

    • Begins a new timer observation for a timer metric. @param{string} name The name the metric was previously registered as. @param{Object} labels Optional object containing additional label values.

      Parameters

      • name: string
      • labels: { [label: string]: string }

      Returns () => void

      A function to be called to end the timer and report the observation.