Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface MetricsRequest

A parameterized query that can be used to fetch metrics from the server.

A new request can be created with Metrics.metricsRequest}. Requests are immutable. The MetricsRequest.server, MetricsRequest.currentServer and MetricsRequest.filter methods can be used to create a configured request that either limits the metrics to a specific server or filters the metrics returned.

By default, the request will fetch metrics from all servers and will not filter the metrics.

The metrics are the same as those exposed by the Prometheus endpoint when requesting metrics in the OpenMetrics format.

since

6.10

Hierarchy

  • MetricsRequest

Index

Methods

currentServer

  • Specifies that metrics should be fetched from the server to which the current session is connected.

    Returns MetricsRequest

    a new request derived from this fetch request but which will collect metrics from the current server

fetch

  • Fetches the metrics from the server.

    If the fetch operation completes successfully, the Promise result will contain a MetricsResult that can be used to access the metrics.

    Otherwise, the Promise will reject with an error. Common reasons for failure include:

    • the calling session does not have GlobalPermission.VIEW_SERVER permission;
    • the operation failed due to a transient cluster error;
    • the session is closed.

    If all metrics for a server are filtered out then the result will still contain an empty entry for that server.

    If either MetricsRequest.server or MetricsRequest.currentServer has been called then the result will contain an entry for that server only. Otherwise, it will contain an entry for each server in the cluster.

    Returns Result<MetricsResult>

    a Promise that will complete with the metrics

filter

  • Allows specifying a set of filters to limit the metrics returned.

    The filter may not be null. If the filter is empty then all metrics are returned.

    The filter is a set of strings. The filter matches a String if the String equals any member of the filter.

    Metrics are included only if:

    throws

    a NullValueError if the filter is null

    Parameters

    • filters: string[] | Set<string>

      the set of filters to use

    Returns MetricsRequest

    a new request derived from this fetch request but with the specified filters

  • Allows specifying a regular expression to filter the metrics returned.

    The filter may not be null.

    Similarly to calling filter with a set, metrics are included only if:

    Only the last filter set by this method will be applied.

    throws

    a NullValueError if the filter is null

    Parameters

    • filter: string | RegExp

      a regular expression to use to filter the metrics. When using a string to specify a regular expression, the string should not contain the surrounding slashes nor any flags.

    Returns MetricsRequest

    a new request derived from this fetch request but with the specified filter

server

  • Specifies the name of the server to fetch metrics from. This is the configured server name.

    throws

    an IllegalArgumentError if the server name is empty

    throws

    a NullValueError if the filter is null

    Parameters

    • server: string

      the name of the server to fetch metrics from

    Returns MetricsRequest

    a new request derived from this fetch request but with the specified server