mirror of
https://github.com/BreizhHardware/express-prom-bundle.git
synced 2026-03-18 21:30:38 +01:00
Merge pull request #33 from cliedeman/feat/typescript-definitions
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",
|
"path",
|
||||||
"method"
|
"method"
|
||||||
],
|
],
|
||||||
|
"files": [
|
||||||
|
"src",
|
||||||
|
"index.d.ts"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node_modules/jasme/run.js",
|
"test": "node_modules/jasme/run.js",
|
||||||
"coverage": "make coverage"
|
"coverage": "make coverage"
|
||||||
|
|||||||
Reference in New Issue
Block a user