Skip to content

Commit 1f3e050

Browse files
feat!: support Node.js v20 (#78)
BREAKING CHANGE: Drop support for Node.js v14 Update prom-client to v15 metrics is now an async function
1 parent 88e13d5 commit 1f3e050

File tree

6 files changed

+5616
-2927
lines changed

6 files changed

+5616
-2927
lines changed

.github/workflows/nodejs-ci-action.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ on:
66
pull_request:
77
branches: [ main ]
88

9+
env:
10+
HUSKY: 0
11+
912
jobs:
1013
build:
1114

1215
runs-on: ubuntu-latest
1316

1417
strategy:
1518
matrix:
16-
node-version: [14.x, 16.x, 18.x]
19+
node-version: [16.x, 18.x, 20.x, 21.x]
1720

1821
steps:
1922
- uses: actions/checkout@v2

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Example:
3333
prometheus.add([c3]);
3434

3535
// Write metrics to the console
36-
console.log(prometheus.metrics);
36+
console.log(await prometheus.metrics());
3737
```
3838

3939
This module would typically be used in an application that can provide

index.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ class PrometheusMetrics {
3333
}
3434

3535
if (!options.registry) {
36-
this.interval = this._client
37-
.collectDefaultMetrics({
38-
prefix: `${this._metricPrefix}opossum_`,
39-
timeout: 5000
40-
});
36+
this._client.collectDefaultMetrics({
37+
prefix: `${this._metricPrefix}opossum_`,
38+
register: this._registry
39+
});
4140
}
4241

4342
if (options.circuits) {
@@ -75,11 +74,10 @@ class PrometheusMetrics {
7574
}
7675

7776
clear () {
78-
clearInterval(this.interval);
7977
this._registry.clear();
8078
}
8179

82-
get metrics () {
80+
metrics () {
8381
return this._registry.metrics();
8482
}
8583

0 commit comments

Comments
 (0)