Compare commits

...

13 Commits

Author SHA1 Message Date
Félix MARQUET
522e9ad64d bump version to 8.0.1 2025-10-29 12:55:01 +00:00
Félix MARQUET
db8710d5d0 feat: add upMetricName params to allow for up metric name customization 2025-04-25 06:47:26 +00:00
Konstantin Pogorelov
f9a0a7622a bump version to 8.0.0, update express and @types/express to 5 2024-10-12 15:42:42 +02:00
Konstantin Pogorelov
fd33d98c15 bump v7.0.2 2024-10-12 13:54:58 +02:00
Konstantin Pogorelov
5978ea7b73 Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/multi-092c445592' 2024-10-12 13:51:57 +02:00
Konstantin Pogorelov
71467e6a17 Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/multi-6b7e5c81f3' 2024-10-12 13:51:45 +02:00
Konstantin Pogorelov
c6b24f6eca Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/multi-9f37c16f8f' 2024-10-12 13:51:31 +02:00
Konstantin Pogorelov
1ac5fba5c4 Merge remote-tracking branch 'remotes/origin/dependabot/npm_and_yarn/multi-41ee8087b2' 2024-10-12 13:51:11 +02:00
dependabot[bot]
ca8b0ba1e0 Bump body-parser and express
Bumps [body-parser](https://github.com/expressjs/body-parser) to 1.20.3 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.


Updates `body-parser` from 1.20.2 to 1.20.3
- [Release notes](https://github.com/expressjs/body-parser/releases)
- [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md)
- [Commits](https://github.com/expressjs/body-parser/compare/1.20.2...1.20.3)

Updates `express` from 4.19.2 to 4.21.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.1)

---
updated-dependencies:
- dependency-name: body-parser
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-12 11:48:55 +00:00
dependabot[bot]
2ebc2618de Bump path-to-regexp and express
Bumps [path-to-regexp](https://github.com/pillarjs/path-to-regexp) to 0.1.10 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.


Updates `path-to-regexp` from 0.1.7 to 0.1.10
- [Release notes](https://github.com/pillarjs/path-to-regexp/releases)
- [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md)
- [Commits](https://github.com/pillarjs/path-to-regexp/compare/v0.1.7...v0.1.10)

Updates `express` from 4.19.2 to 4.21.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.1)

---
updated-dependencies:
- dependency-name: path-to-regexp
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-12 11:48:51 +00:00
dependabot[bot]
df46ecaa9a Bump cookie and express
Bumps [cookie](https://github.com/jshttp/cookie) to 0.7.1 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.


Updates `cookie` from 0.6.0 to 0.7.1
- [Release notes](https://github.com/jshttp/cookie/releases)
- [Commits](https://github.com/jshttp/cookie/compare/v0.6.0...v0.7.1)

Updates `express` from 4.19.2 to 4.21.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.1)

---
updated-dependencies:
- dependency-name: cookie
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-12 11:48:01 +00:00
dependabot[bot]
abdfe2d93a Bump serve-static and express
Bumps [serve-static](https://github.com/expressjs/serve-static) to 1.16.2 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.


Updates `serve-static` from 1.15.0 to 1.16.2
- [Release notes](https://github.com/expressjs/serve-static/releases)
- [Changelog](https://github.com/expressjs/serve-static/blob/v1.16.2/HISTORY.md)
- [Commits](https://github.com/expressjs/serve-static/compare/v1.15.0...v1.16.2)

Updates `express` from 4.19.2 to 4.21.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.1)

---
updated-dependencies:
- dependency-name: serve-static
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-12 11:48:00 +00:00
dependabot[bot]
33ab388106 Bump send and express
Bumps [send](https://github.com/pillarjs/send) to 0.19.0 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.


Updates `send` from 0.18.0 to 0.19.0
- [Release notes](https://github.com/pillarjs/send/releases)
- [Changelog](https://github.com/pillarjs/send/blob/master/HISTORY.md)
- [Commits](https://github.com/pillarjs/send/compare/0.18.0...0.19.0)

Updates `express` from 4.19.2 to 4.21.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.1)

---
updated-dependencies:
- dependency-name: send
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-12 11:47:58 +00:00
5 changed files with 525 additions and 180 deletions

View File

@@ -55,6 +55,7 @@ Which labels to include in `http_request_duration_seconds` metric:
* **metricsPath**: replace the `/metrics` route with a **regex** or exact **string**. Note: it is highly recommended to just stick to the default
* **metricType**: histogram/summary selection. See more details below
* **httpDurationMetricName**: Allows you change the name of HTTP duration metric, default: **`http_request_duration_seconds`**.
* **upMetricName**: Allows you change the name of up metric, default: **`up`**.
### metricType option ###

694
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "express-prom-bundle",
"version": "7.0.1",
"version": "8.0.1",
"description": "express middleware with popular prometheus metrics in one bundle",
"main": "src/index.js",
"keywords": [
@@ -24,14 +24,14 @@
"author": "Konstantin Pogorelov <or@pluseq.com>",
"license": "MIT",
"dependencies": {
"@types/express": "^4.17.21",
"express": "^4.18.2",
"@types/express": "^5.0.0",
"on-finished": "^2.3.0",
"url-value-parser": "^2.0.0"
},
"devDependencies": {
"dts": "^0.1.1",
"eslint": "^5.11.0",
"express": "^5.0.1",
"istanbul": "^0.4.5",
"jasme": "^6.0.0",
"koa": "^2.6.2",

View File

@@ -91,6 +91,7 @@ function main(opts) {
}
const httpMetricName = opts.httpDurationMetricName || 'http_request_duration_seconds';
const upMetricName = opts.upMetricName || 'up';
function makeHttpMetric() {
const labels = ['status_code'];
@@ -138,7 +139,7 @@ function main(opts) {
prefix = opts.promClient.collectDefaultMetrics.prefix || '';
}
metrics.up = new promClient.Gauge({
name: `${prefix}up`,
name: prefix + upMetricName,
help: '1 = up, 0 = not up',
registers: [opts.promRegistry]
});

1
types/index.d.ts vendored
View File

@@ -38,6 +38,7 @@ declare namespace express_prom_bundle {
metricsPath?: string;
httpDurationMetricName?: string;
upMetricName?: string;
promClient?: { collectDefaultMetrics?: DefaultMetricsCollectorConfiguration<RegistryContentType> };
promRegistry?: Registry;
normalizePath?: NormalizePathEntry[] | NormalizePathFn;