prom-client
Advanced tools
Comparing version 15.1.2 to 15.1.3
@@ -24,3 +24,5 @@ // Type definitions for prom-client | ||
*/ | ||
export class Registry<RegistryContentType = PrometheusContentType> { | ||
export class Registry< | ||
BoundRegistryContentType extends RegistryContentType = PrometheusContentType, | ||
> { | ||
/** | ||
@@ -74,3 +76,3 @@ * Get string representation for all metrics | ||
*/ | ||
setDefaultLabels(labels: Object): void; | ||
setDefaultLabels(labels: object): void; | ||
@@ -86,3 +88,3 @@ /** | ||
*/ | ||
readonly contentType: RegistryContentType; | ||
readonly contentType: BoundRegistryContentType; | ||
@@ -94,3 +96,3 @@ /** | ||
*/ | ||
setContentType(contentType: RegistryContentType): void; | ||
setContentType(contentType: BoundRegistryContentType): void; | ||
@@ -156,3 +158,3 @@ /** | ||
static aggregate<T extends RegistryContentType>( | ||
metricsArr: Array<Object>, | ||
metricsArr: Array<object>, | ||
): Registry<T>; // TODO Promise? | ||
@@ -778,3 +780,3 @@ | ||
eventLoopMonitoringPrecision?: number; | ||
labels?: Object; | ||
labels?: object; | ||
} | ||
@@ -781,0 +783,0 @@ |
@@ -8,3 +8,2 @@ 'use strict'; | ||
try { | ||
/* eslint-disable node/no-unsupported-features/node-builtins */ | ||
perf_hooks = require('perf_hooks'); | ||
@@ -11,0 +10,0 @@ } catch { |
@@ -50,3 +50,3 @@ 'use strict'; | ||
// `URL` first added in v6.13.0 | ||
// eslint-disable-next-line node/no-deprecated-api | ||
// eslint-disable-next-line n/no-deprecated-api | ||
const gatewayUrlParsed = url.parse(this.gatewayUrl); | ||
@@ -62,5 +62,5 @@ const gatewayUrlPath = | ||
// eslint-disable-next-line node/no-deprecated-api | ||
// eslint-disable-next-line n/no-deprecated-api | ||
const target = url.resolve(this.gatewayUrl, path); | ||
// eslint-disable-next-line node/no-deprecated-api | ||
// eslint-disable-next-line n/no-deprecated-api | ||
const requestParams = url.parse(target); | ||
@@ -67,0 +67,0 @@ const httpModule = isHttps(requestParams.href) ? https : http; |
@@ -56,3 +56,7 @@ 'use strict'; | ||
if (labelNames.length !== args.length) { | ||
throw new Error('Invalid number of arguments'); | ||
throw new Error( | ||
`Invalid number of arguments (${args.length}): "${args.join( | ||
', ', | ||
)}" for label names (${labelNames.length}): "${labelNames.join(', ')}".`, | ||
); | ||
} | ||
@@ -59,0 +63,0 @@ |
{ | ||
"name": "prom-client", | ||
"version": "15.1.2", | ||
"version": "15.1.3", | ||
"description": "Client for prometheus", | ||
@@ -21,3 +21,4 @@ "main": "index.js", | ||
"check-prettier": "npm run run-prettier -- --check", | ||
"compile-typescript": "tsc --project ." | ||
"compile-typescript": "tsc --project .", | ||
"prepare": "husky" | ||
}, | ||
@@ -38,12 +39,14 @@ "repository": { | ||
"@clevernature/benchmark-regression": "^1.0.0", | ||
"@typescript-eslint/eslint-plugin": "^6.21.0", | ||
"@typescript-eslint/parser": "^6.21.0", | ||
"eslint": "^8.32.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-node": "^11.0.0", | ||
"eslint-plugin-n": "^16.0.0", | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"express": "^4.13.3", | ||
"husky": "^8.0.3", | ||
"husky": "^9.0.0", | ||
"jest": "^29.3.1", | ||
"lint-staged": "^13.1.0", | ||
"nock": "^13.0.5", | ||
"prettier": "3.1.1", | ||
"prettier": "3.3.2", | ||
"typescript": "^5.0.4" | ||
@@ -61,5 +64,5 @@ }, | ||
"lint-staged": { | ||
"*.js": "eslint --fix", | ||
"*.{ts,md,json,yml}": "prettier --write", | ||
".{eslintrc,travis.yml}": "prettier --write" | ||
"*.{js,ts}": "eslint --fix", | ||
"*.{md,json,yml}": "prettier --write", | ||
".travis.yml": "prettier --write" | ||
}, | ||
@@ -66,0 +69,0 @@ "prettier": { |
@@ -359,3 +359,3 @@ # Prometheus client for node.js [![Actions Status](https://github.com/siimon/prom-client/workflows/Node.js%20CI/badge.svg?branch=master)](https://github.com/siimon/prom-client/actions) | ||
const gauge = new client.Counter({ | ||
const counter = new client.Counter({ | ||
name: 'metric_name', | ||
@@ -368,7 +368,7 @@ help: 'metric_help', | ||
// Ok | ||
gauge.inc({ method: 1 }); | ||
counter.inc({ method: 1 }); | ||
// this is an error since `'methods'` is not a valid `labelName` | ||
// @ts-expect-error | ||
gauge.inc({ methods: 1 }); | ||
counter.inc({ methods: 1 }); | ||
``` | ||
@@ -375,0 +375,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
126441
3172
14