Options for configuring metrics middleware.

interface Opts {
    collectNodeMetrics: boolean;
    collectServiceVersion: boolean;
    customLabels: { [key: string]: any };
    includeOperationId: boolean;
    labels: Record<string, string>;
    prefix: string;
    registry: Registry;
    transformLabels?: TransformLabelsFn;
}

Properties

collectNodeMetrics: boolean

Whether to collect node metrics.

collectServiceVersion: boolean

Whether to collect service version metrics.

customLabels: { [key: string]: any }

Object containing extra labels, useful together with transformLabels.

includeOperationId: boolean

Add operation id based on the Openapi operationId to the metrics. Requires the express-openapi-validator package to function.

true
labels: Record<string, string>

The labels to attach to all the metrics.

prefix: string

The prefix for the metrics. e.g. 'my_prefix_my_metric'

registry: Registry

The Prometheus registry to use for the metrics.

transformLabels?: TransformLabelsFn

Function to transform labels with request and response objects.