mirror of
https://github.com/BreizhHardware/express-prom-bundle.git
synced 2026-01-18 16:27:28 +01:00
Added Typescript definitions
This commit is contained in:
45
index.d.ts
vendored
Normal file
45
index.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import * as express from "express";
|
||||
import { DefaultMetricsCollectorConfiguration } from "prom-client";
|
||||
|
||||
type NormalizePathRegexs = [string, string];
|
||||
|
||||
interface Labels {
|
||||
[key: string]: string | number;
|
||||
}
|
||||
|
||||
interface Opts {
|
||||
autoregister?: boolean;
|
||||
buckets?: [number];
|
||||
|
||||
includeStatusCode?: boolean;
|
||||
includeMethod?: boolean;
|
||||
includePath?: boolean;
|
||||
includeUp?: boolean;
|
||||
|
||||
metricType?: "summary" | "histogram";
|
||||
metricsPath?: string;
|
||||
promClient?: DefaultMetricsCollectorConfiguration;
|
||||
normalizePath?: NormalizePathRegexs;
|
||||
formatStatusCode?: (res: express.Response) => number | string;
|
||||
|
||||
transformLabels: (
|
||||
labels: Labels,
|
||||
req: express.Request,
|
||||
res: express.Response
|
||||
) => Labels;
|
||||
|
||||
// https://github.com/disjunction/url-value-parser#options
|
||||
urlValueParser?: {
|
||||
minHexLength?: number;
|
||||
minBase64Length?: number;
|
||||
replaceMasks?: string[];
|
||||
extraMasks?: string[];
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizePath(
|
||||
req: express.Request,
|
||||
opts?: { normalizePath?: NormalizePathRegexs }
|
||||
);
|
||||
|
||||
export default function(opts: Opts): express.RequestHandler;
|
||||
@@ -10,6 +10,10 @@
|
||||
"path",
|
||||
"method"
|
||||
],
|
||||
"files": [
|
||||
"src",
|
||||
"index.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"test": "node_modules/jasme/run.js",
|
||||
"coverage": "make coverage"
|
||||
|
||||
Reference in New Issue
Block a user