Skip to content

Commit

Permalink
feat!: support Node.js v20 (#78)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
Drop support for Node.js v14
Update prom-client to v15
metrics is now an async function
  • Loading branch information
10xLaCroixDrinker authored Apr 8, 2024
1 parent 88e13d5 commit 1f3e050
Show file tree
Hide file tree
Showing 6 changed files with 5,616 additions and 2,927 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/nodejs-ci-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ on:
pull_request:
branches: [ main ]

env:
HUSKY: 0

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x, 20.x, 21.x]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Example:
prometheus.add([c3]);

// Write metrics to the console
console.log(prometheus.metrics);
console.log(await prometheus.metrics());
```

This module would typically be used in an application that can provide
Expand Down
12 changes: 5 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ class PrometheusMetrics {
}

if (!options.registry) {
this.interval = this._client
.collectDefaultMetrics({
prefix: `${this._metricPrefix}opossum_`,
timeout: 5000
});
this._client.collectDefaultMetrics({
prefix: `${this._metricPrefix}opossum_`,
register: this._registry
});
}

if (options.circuits) {
Expand Down Expand Up @@ -75,11 +74,10 @@ class PrometheusMetrics {
}

clear () {
clearInterval(this.interval);
this._registry.clear();
}

get metrics () {
metrics () {
return this._registry.metrics();
}

Expand Down
Loading

0 comments on commit 1f3e050

Please sign in to comment.