Compare commits

..

49 Commits
7.0.2 ... dev

Author SHA1 Message Date
Félix MARQUET
dcc9e1f893 chore(deps): Update qs to fix security issue 2026-01-04 09:18:26 +00:00
Félix MARQUET
36d1484d33 feat(security): Add security policy documentation 2025-12-17 09:01:43 +00:00
Félix MARQUET
8fc61cd1d8 chore(version): bump version to 8.0.7 2025-12-17 08:55:50 +00:00
Félix MARQUET
4fd7a797c5 feat(action): Add regular github action for audit security vulnerability 2025-12-17 08:53:44 +00:00
Félix MARQUET
30d9c3d473 Merge pull request #21 from BreizhHardware/dependabot/npm_and_yarn/dev/eslint/js-9.39.2
chore(deps-dev): bump @eslint/js from 9.39.1 to 9.39.2
2025-12-17 09:33:16 +01:00
Félix MARQUET
10fe1cac8f Merge pull request #22 from BreizhHardware/dependabot/npm_and_yarn/dev/eslint-9.39.2
chore(deps-dev): bump eslint from 9.39.1 to 9.39.2
2025-12-17 09:32:50 +01:00
dependabot[bot]
9b4e0eb163 chore(deps-dev): bump eslint from 9.39.1 to 9.39.2
Bumps [eslint](https://github.com/eslint/eslint) from 9.39.1 to 9.39.2.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/compare/v9.39.1...v9.39.2)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.39.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-15 15:37:01 +00:00
dependabot[bot]
475b7a8f6d chore(deps-dev): bump @eslint/js from 9.39.1 to 9.39.2
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.39.1 to 9.39.2.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/commits/v9.39.2/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-version: 9.39.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-15 15:36:51 +00:00
Félix MARQUET
c1482220c2 Merge pull request #20 from BreizhHardware/dependabot/npm_and_yarn/dev/multi-b251156d90
chore(deps): bump express and @types/express
2025-12-15 08:51:57 +01:00
dependabot[bot]
66643411b8 chore(deps): bump express and @types/express
Bumps [express](https://github.com/expressjs/express) and [@types/express](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/express). These dependencies needed to be updated together.

Updates `express` from 5.2.0 to 5.2.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/v5.2.0...v5.2.1)

Updates `@types/express` from 5.0.5 to 5.0.6
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/express)

---
updated-dependencies:
- dependency-name: express
  dependency-version: 5.2.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
- dependency-name: "@types/express"
  dependency-version: 5.0.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-08 15:41:39 +00:00
Félix MARQUET
97b2f425e6 chore: bump version to 8.0.6 2025-12-03 13:08:29 +00:00
Félix MARQUET
a8d4fa8116 Merge pull request #16 from BreizhHardware/dependabot/npm_and_yarn/dev/eslint/eslintrc-3.3.3
chore(deps-dev): bump @eslint/eslintrc from 3.3.1 to 3.3.3
2025-12-03 14:04:57 +01:00
Félix MARQUET
0eb0178622 chore(deps-dev): update body-parser to 2.2.1 2025-12-03 13:02:08 +00:00
Félix MARQUET
5c1f68a482 Merge pull request #17 from BreizhHardware/dependabot/npm_and_yarn/dev/express-5.2.0
chore(deps-dev): bump express from 5.1.0 to 5.2.0
2025-12-03 13:58:46 +01:00
dependabot[bot]
12ff62478f chore(deps-dev): bump express from 5.1.0 to 5.2.0
Bumps [express](https://github.com/expressjs/express) from 5.1.0 to 5.2.0.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/v5.1.0...v5.2.0)

---
updated-dependencies:
- dependency-name: express
  dependency-version: 5.2.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-01 17:05:50 +00:00
dependabot[bot]
2efc5189d0 chore(deps-dev): bump @eslint/eslintrc from 3.3.1 to 3.3.3
Bumps [@eslint/eslintrc](https://github.com/eslint/eslintrc) from 3.3.1 to 3.3.3.
- [Release notes](https://github.com/eslint/eslintrc/releases)
- [Changelog](https://github.com/eslint/eslintrc/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslintrc/compare/v3.3.1...eslintrc-v3.3.3)

---
updated-dependencies:
- dependency-name: "@eslint/eslintrc"
  dependency-version: 3.3.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-01 17:05:40 +00:00
Félix MARQUET
c28b736c6e Merge pull request #15 from BreizhHardware/dependabot/github_actions/dot-github/workflows/dev/actions/checkout-6
chore(deps): bump actions/checkout from 5 to 6 in /.github/workflows
2025-11-27 15:01:25 +01:00
dependabot[bot]
e84b96bf5e chore(deps): bump actions/checkout from 5 to 6 in /.github/workflows
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-24 18:00:38 +00:00
Félix MARQUET
e49f95ab0e chore: bump to version to 8.0.5 2025-11-18 09:57:23 +00:00
Félix MARQUET
cf862fca31 docs: update package name in readme 2025-11-18 08:52:45 +01:00
Félix MARQUET
0f6eab8d98 Merge pull request #11 from BreizhHardware/docs/update-readme-badge
docs: update README badges and add coverage upload step in release workflow
2025-11-18 08:46:03 +01:00
Félix MARQUET
b586bd9515 fix: Fix security issue in js-yaml 2025-11-18 07:43:48 +00:00
Félix MARQUET
1a5f6df7f9 docs: update README badges and add coverage upload step in release workflow 2025-11-17 13:55:47 +00:00
Félix MARQUET
b2f5283303 Merge pull request #8 from BreizhHardware/dependabot/npm_and_yarn/dev/eslint-9.39.1
Bump eslint from 9.39.0 to 9.39.1
2025-11-13 16:18:27 +01:00
dependabot[bot]
cdc558a8d8 Bump eslint from 9.39.0 to 9.39.1
Bumps [eslint](https://github.com/eslint/eslint) from 9.39.0 to 9.39.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/compare/v9.39.0...v9.39.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.39.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-13 15:17:03 +00:00
Félix MARQUET
af8a3097fc Merge pull request #7 from BreizhHardware/dependabot/npm_and_yarn/dev/eslint/js-9.39.1
Bump @eslint/js from 9.39.0 to 9.39.1
2025-11-13 16:15:35 +01:00
Félix MARQUET
c5cce9f8f5 Merge pull request #1 from BreizhHardware/dependabot/npm_and_yarn/tsd-0.33.0
Bump tsd from 0.30.7 to 0.33.0
2025-11-13 16:15:22 +01:00
Félix MARQUET
36789b54ae fix: bump version to 8.0.4 2025-11-13 15:14:21 +00:00
dependabot[bot]
e1b09bca43 Bump tsd from 0.30.7 to 0.33.0
Bumps [tsd](https://github.com/tsdjs/tsd) from 0.30.7 to 0.33.0.
- [Release notes](https://github.com/tsdjs/tsd/releases)
- [Commits](https://github.com/tsdjs/tsd/compare/v0.30.7...v0.33.0)

---
updated-dependencies:
- dependency-name: tsd
  dependency-version: 0.33.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-13 15:11:20 +00:00
dependabot[bot]
c3284c6ce6 Bump @eslint/js from 9.39.0 to 9.39.1
Bumps [@eslint/js](https://github.com/eslint/eslint/tree/HEAD/packages/js) from 9.39.0 to 9.39.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/commits/v9.39.1/packages/js)

---
updated-dependencies:
- dependency-name: "@eslint/js"
  dependency-version: 9.39.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-13 15:11:16 +00:00
Félix MARQUET
8dc2f9c171 feat: add a release workflow 2025-11-13 15:06:18 +00:00
Félix MARQUET
a9eb496d11 Merge pull request #2 from BreizhHardware/dependabot/npm_and_yarn/typescript-5.9.3
Bump typescript from 3.9.10 to 5.9.3
2025-11-13 15:57:41 +01:00
Félix MARQUET
3353686379 Merge pull request #3 from BreizhHardware/dependabot/npm_and_yarn/supertest-7.1.4
Bump supertest from 3.4.2 to 7.1.4
2025-11-13 15:57:06 +01:00
Félix MARQUET
489ce17366 Merge pull request #4 from BreizhHardware/dependabot/npm_and_yarn/eslint-9.39.0
Bump eslint from 9.38.0 to 9.39.0
2025-11-13 15:56:09 +01:00
Félix MARQUET
4e07a7db7a Merge pull request #5 from BreizhHardware/dependabot/npm_and_yarn/globals-16.5.0
Bump globals from 16.4.0 to 16.5.0
2025-11-13 15:54:31 +01:00
dependabot[bot]
59f6ac0afa Bump globals from 16.4.0 to 16.5.0
Bumps [globals](https://github.com/sindresorhus/globals) from 16.4.0 to 16.5.0.
- [Release notes](https://github.com/sindresorhus/globals/releases)
- [Commits](https://github.com/sindresorhus/globals/compare/v16.4.0...v16.5.0)

---
updated-dependencies:
- dependency-name: globals
  dependency-version: 16.5.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-03 16:42:43 +00:00
dependabot[bot]
597fdda556 Bump eslint from 9.38.0 to 9.39.0
Bumps [eslint](https://github.com/eslint/eslint) from 9.38.0 to 9.39.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/compare/v9.38.0...v9.39.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.39.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-03 16:42:35 +00:00
dependabot[bot]
21e90237e4 Bump supertest from 3.4.2 to 7.1.4
Bumps [supertest](https://github.com/ladjs/supertest) from 3.4.2 to 7.1.4.
- [Release notes](https://github.com/ladjs/supertest/releases)
- [Commits](https://github.com/ladjs/supertest/compare/v3.4.2...v7.1.4)

---
updated-dependencies:
- dependency-name: supertest
  dependency-version: 7.1.4
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-31 10:03:37 +00:00
dependabot[bot]
2de73f7526 Bump typescript from 3.9.10 to 5.9.3
Bumps [typescript](https://github.com/microsoft/TypeScript) from 3.9.10 to 5.9.3.
- [Release notes](https://github.com/microsoft/TypeScript/releases)
- [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release-publish.yml)
- [Commits](https://github.com/microsoft/TypeScript/compare/v3.9.10...v5.9.3)

---
updated-dependencies:
- dependency-name: typescript
  dependency-version: 5.9.3
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-31 10:03:29 +00:00
Félix MARQUET
e886d7cb05 chore: add dependabot configuration and CI workflow for tests 2025-10-31 10:02:19 +00:00
Félix MARQUET
815ba9819a chore: clean package-lock 2025-10-29 13:28:17 +00:00
Félix MARQUET
f7805d301b chore: remove Istanbul and add NYC for code coverage in package.json 2025-10-29 13:27:45 +00:00
Félix MARQUET
6b23a109b1 chore: update koa dependency to version 3.0.1 2025-10-29 13:24:22 +00:00
Félix MARQUET
39788a1ff0 chore: update express dependency to version 5.1.0 2025-10-29 13:23:33 +00:00
Félix MARQUET
f7474e3ea7 chore: bump version to 8.0.3 and update dependencies
- Updated version from 8.0.2 to 8.0.3 in package.json
- Upgraded eslint from 5.11.0 to 9.38.0
- Added @eslint/eslintrc and @eslint/js as devDependencies
- Added globals as a devDependency
2025-10-29 13:21:53 +00:00
Félix MARQUET
6da4bece87 feat: update package metadata and version to 8.0.2 2025-10-29 13:18:11 +00:00
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
13 changed files with 3346 additions and 2215 deletions

View File

@@ -0,0 +1,12 @@
{
"name": "Node.js 24",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,
"version": "lts",
"nvmVersion": "latest"
},
"ghcr.io/devcontainers/features/git-lfs:1": {}
}
}

View File

@@ -1,55 +0,0 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"globals": {
"app": true,
"fetch": true
},
"env": {
"node": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [1, 2],
"array-bracket-spacing": [2, "never"],
"block-scoped-var": 2,
"brace-style": [2, "1tbs"],
"computed-property-spacing": [2, "never"],
"curly": 2,
"eol-last": 2,
"eqeqeq": [2, "smart"],
"max-depth": [1, 3],
"new-cap": 1,
"no-extend-native": 2,
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": 1,
"no-unused-vars": 1,
"no-use-before-define": [2, "nofunc"],
"object-curly-spacing": [2, "never"],
"quotes": [1, "single", "avoid-escape"],
"semi": [2, "always"],
"keyword-spacing": [2, {"before": true, "after": true}],
"space-unary-ops": 2,
"no-console": [1, { allow: ["info", "warn", "error"] }],
"max-len": [1, 120],
"max-statements": [1, 50],
"consistent-this": [2, "self"],
"no-var": 2,
"no-dupe-class-members": 2,
"operator-linebreak": [1, "before"],
"no-unneeded-ternary": [1, {"defaultAssignment": false}],
"no-lonely-if": 1,
"linebreak-style": [2, "unix"],
"no-nested-ternary": 2,
"require-yield": 2
}
}

12
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
target-branch: "dev"
- package-ecosystem: "github-actions"
directory: "/.github/workflows"
schedule:
interval: "weekly"
target-branch: "dev"

42
.github/workflows/audit.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: Security Audit
on:
push:
branches: [main, dev]
pull_request:
branches:
- '**'
schedule:
- cron: '0 8 * * *'
workflow_dispatch:
jobs:
audit:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install dependencies
run: npm install
- name: Run security audit
id: audit
run: npm audit --audit-level moderate
continue-on-error: true
- name: Create issue on failure
if: steps.audit.outcome == 'failure'
uses: actions/github-script@v8
with:
script: |
github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Security Audit Failed',
body: 'The daily security audit has failed. Please check the workflow run for details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}',
labels: ['security', 'audit']
});

72
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,72 @@
name: Release
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22, 24, latest]
steps:
- uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- run: npm install prom-client
- run: npm install
- run: npm run lint
- run: npm test
- run: npm run test-types
- name: Generate coverage
run: make coverage
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: coverage/lcov.info
publish:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Use Node.js 18
uses: actions/setup-node@v6
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get version
id: get_version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Generate Changelog
run: |
# Simple changelog generation
echo "# Changelog" > CHANGELOG.md
git log --oneline --pretty=format:"- %s" $(git describe --tags --abbrev=0 2>/dev/null || echo "HEAD~1")..HEAD >> CHANGELOG.md
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: Release v${{ steps.get_version.outputs.version }}
body_path: CHANGELOG.md
draft: false
prerelease: false

54
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,54 @@
name: CI-Tests
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22, 24, latest]
steps:
- uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- run: npm install prom-client
- run: npm install
- run: npm run lint
- run: npm test
- run: npm run test-types
codeql:
name: CodeQL Analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: javascript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
audit:
name: Audit Dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Use Node.js 18
uses: actions/setup-node@v6
with:
node-version: 18
- run: npm install
- name: Audit Dependencies
run: npm audit --audit-level=moderate

View File

@@ -1,8 +1,9 @@
[![build status](https://travis-ci.org/jochen-schweizer/express-prom-bundle.png)](https://travis-ci.org/jochen-schweizer/express-prom-bundle) [![Coverage Status](https://coveralls.io/repos/github/jochen-schweizer/express-prom-bundle/badge.svg?branch=master)](https://coveralls.io/github/jochen-schweizer/express-prom-bundle?branch=master) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://www.tldrlegal.com/l/mit) [![NPM version](https://badge.fury.io/js/express-prom-bundle.png)](http://badge.fury.io/js/express-prom-bundle)
[![CI](https://github.com/BreizhHardware/express-prom-bundle/actions/workflows/release.yml/badge.svg)](https://github.com/BreizhHardware/express-prom-bundle/actions/workflows/release.yml) [![Coverage Status](https://coveralls.io/repos/github/BreizhHardware/express-prom-bundle/badge.svg?branch=main)](https://coveralls.io/github/BreizhHardware/express-prom-bundle?branch=main) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://www.tldrlegal.com/l/mit) [![NPM version](https://badge.fury.io/js/%40breizhhardware%2Fexpress-prom-bundle.png)](http://badge.fury.io/js/%40breizhhardware%2Fexpress-prom-bundle)
# express prometheus bundle
Express middleware with popular prometheus metrics in one bundle. It's also compatible with koa v1 and v2 (see below).
Express middleware with popular prometheus metrics in one bundle. It's also compatible with koa v1 and v2 (see below). This package is a fork from the one from
[Jochen Schweizer](https://github.com/jochen-schweizer/express-prom-bundle).
This library uses **prom-client v15+** as a peer dependency. See: https://github.com/siimon/prom-client
@@ -16,13 +17,13 @@ Included metrics:
## Install
```
npm install prom-client express-prom-bundle
npm install prom-client @breizhhardware/express-prom-bundle
```
## Sample Usage
```javascript
const promBundle = require("express-prom-bundle");
const promBundle = require("@breizhhardware/express-prom-bundle");
const app = require("express")();
const metricsMiddleware = promBundle({includeMethod: true});
@@ -55,6 +56,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 ###
@@ -180,7 +182,7 @@ setup std. metrics but exclude `up`-metric:
```javascript
const express = require("express");
const app = express();
const promBundle = require("express-prom-bundle");
const promBundle = require("@breizhhardware/express-prom-bundle");
// calls to this route will not appear in metrics
// because it's applied before promBundle
@@ -205,7 +207,7 @@ See an [advanced example on github](https://github.com/jochen-schweizer/express-
## koa v2 example
```javascript
const promBundle = require("express-prom-bundle");
const promBundle = require("@breizhhardware/express-prom-bundle");
const Koa = require("koa");
const c2k = require("koa-connect");
const metricsMiddleware = promBundle({/* options */ });
@@ -226,7 +228,7 @@ which returns an aggregate of all metrics from all the workers.
``` javascript
const cluster = require('cluster');
const promBundle = require('express-prom-bundle');
const promBundle = require('@breizhhardware/express-prom-bundle');
const promClient = require('prom-client');
const numCPUs = Math.max(2, require('os').cpus().length);
const express = require('express');

12
SECURITY.md Normal file
View File

@@ -0,0 +1,12 @@
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| >= 8.0.x| :white_check_mark: |
| < 8.0.0 | :x: |
## Reporting a Vulnerability
Please use [GitHub's private vulnerability reporting](https://github.com/breizhhardware/express-prom-bundle/security/advisories/new) to report a vulnerability.

77
eslint.config.mjs Normal file
View File

@@ -0,0 +1,77 @@
import { defineConfig } from "eslint/config";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default defineConfig([{
extends: compat.extends("eslint:recommended"),
languageOptions: {
globals: {
...globals.node,
app: true,
fetch: true,
},
ecmaVersion: 6,
sourceType: "module",
},
rules: {
indent: [1, 2],
"array-bracket-spacing": [2, "never"],
"block-scoped-var": 2,
"brace-style": [2, "1tbs"],
"computed-property-spacing": [2, "never"],
curly: 2,
"eol-last": 2,
eqeqeq: [2, "smart"],
"max-depth": [1, 3],
"new-cap": 1,
"no-extend-native": 2,
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": 1,
"no-unused-vars": 1,
"no-use-before-define": [2, "nofunc"],
"object-curly-spacing": [2, "never"],
quotes: [1, "single", "avoid-escape"],
semi: [2, "always"],
"keyword-spacing": [2, {
before: true,
after: true,
}],
"space-unary-ops": 2,
"no-console": [1, {
allow: ["info", "warn", "error"],
}],
"max-len": [1, 120],
"max-statements": [1, 50],
"consistent-this": [2, "self"],
"no-var": 2,
"no-dupe-class-members": 2,
"operator-linebreak": [1, "before"],
"no-unneeded-ternary": [1, {
defaultAssignment: false,
}],
"no-lonely-if": 1,
"linebreak-style": [2, "unix"],
"no-nested-ternary": 2,
"require-yield": 2,
},
}]);

5178
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.2",
"name": "@breizhhardware/express-prom-bundle",
"version": "8.0.7",
"description": "express middleware with popular prometheus metrics in one bundle",
"main": "src/index.js",
"keywords": [
@@ -21,33 +21,36 @@
"coverage": "make coverage",
"test-types": "tsd"
},
"author": "Konstantin Pogorelov <or@pluseq.com>",
"author": "BreizhHardware <felix.marquet@horoquartz.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": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.38.0",
"dts": "^0.1.1",
"eslint": "^5.11.0",
"istanbul": "^0.4.5",
"eslint": "^9.38.0",
"express": "^5.1.0",
"globals": "^16.4.0",
"jasme": "^6.0.0",
"koa": "^2.6.2",
"koa": "^3.0.1",
"koa-connect": "^2.0.1",
"prom-client": "^15.0.0",
"supertest": "^3.3.0",
"supertest": "^7.1.4",
"supertest-koa-agent": "^0.3.0",
"tsd": "^0.30.3",
"typescript": "^3.4.5"
"tsd": "^0.33.0",
"typescript": "^5.9.3",
"nyc": "^17.1.0"
},
"peerDependencies": {
"prom-client": ">=15.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/jochen-schweizer/express-prom-bundle.git"
"url": "git+https://github.com/breizhhardware/express-prom-bundle.git"
},
"engines": {
"node": ">=18"

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;