-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,915 additions
and
1,718 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,10 @@ | ||
{ | ||
"env": { | ||
"es6": true, | ||
"node": true | ||
}, | ||
"extends": "airbnb-base", | ||
"rules": { | ||
"strict": [0, "global"], | ||
"prefer-const": 1, | ||
"indent": [1, 4], | ||
"class-methods-use-this": [0], | ||
"import/no-extraneous-dependencies": [0], | ||
"arrow-body-style": [0, "always"], | ||
"no-multiple-empty-lines": [0], | ||
"no-underscore-dangle": [0], | ||
"comma-dangle": [0], | ||
"no-plusplus": [0], | ||
"no-console": [0], | ||
"new-cap": [0] | ||
"extends": ["eslint:recommended", "plugin:prettier/recommended"], | ||
"plugins": ["prettier"], | ||
"env": { "es6": true, "node": true }, | ||
"parserOptions": { | ||
"requireConfigFile": false, | ||
"ecmaVersion": 2020, | ||
"sourceType": "module" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
name: Release on main | ||
|
||
permissions: | ||
contents: write # to be able to publish a GitHub release | ||
issues: write # to be able to comment on released issues | ||
pull-requests: write # to be able to comment on released pull requests | ||
id-token: write # to enable use of OIDC for npm provenance | ||
contents: write # to be able to publish a GitHub release | ||
issues: write # to be able to comment on released issues | ||
pull-requests: write # to be able to comment on released pull requests | ||
id-token: write # to enable use of OIDC for npm provenance | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
# Cancel previous workflows which might still be running | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Run all tests | ||
run: npm test | ||
|
||
- name: Release and publish | ||
run: npx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Run all tests | ||
run: npm test | ||
|
||
- name: Release and publish | ||
run: npx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
name: Run Lint and Tests | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
node-version: [10.x, 18.x, 20.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
node-version: [18.x, 20.x] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Lint | ||
run: npm run lint | ||
- name: Lint | ||
run: npm run lint | ||
|
||
- name: Run tests | ||
run: npm test | ||
- name: Run tests | ||
run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ tmp/**/* | |
*.log | ||
package-lock.json | ||
.nyc_output | ||
.tap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"singleQuote": false, | ||
"trailingComma": "all", | ||
"useTabs": true, | ||
"printWidth": 120, | ||
"overrides": [ | ||
{ | ||
"files": ["*.yml"], | ||
"options": { | ||
"tabWidth": 2, | ||
"useTabs": false | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
const Metric = require('@metrics/metric'); | ||
const Metric = require("@metrics/metric"); | ||
|
||
const CollectorActiveHandlesTotal = class CollectorActiveHandlesTotal { | ||
constructor(prefix = '') { | ||
Object.defineProperty(this, 'prefix', { | ||
value: prefix, | ||
}); | ||
constructor(prefix = "") { | ||
Object.defineProperty(this, "prefix", { | ||
value: prefix, | ||
}); | ||
|
||
Object.defineProperty(this, 'collectable', { | ||
value: (typeof process._getActiveHandles === 'function'), | ||
}); | ||
} | ||
Object.defineProperty(this, "collectable", { | ||
value: typeof process._getActiveHandles === "function", | ||
}); | ||
} | ||
|
||
get [Symbol.toStringTag]() { | ||
return 'CollectorActiveHandlesTotal'; | ||
} | ||
get [Symbol.toStringTag]() { | ||
return "CollectorActiveHandlesTotal"; | ||
} | ||
|
||
collect(timestamp) { | ||
if (!this.collectable) { | ||
return null; | ||
} | ||
collect(timestamp) { | ||
if (!this.collectable) { | ||
return null; | ||
} | ||
|
||
return [new Metric({ | ||
name: `${this.prefix}nodejs_active_handles_total`, | ||
description: 'Total number of handles', | ||
type: 1, | ||
value: process._getActiveHandles().length, | ||
timestamp, | ||
})]; | ||
} | ||
return [ | ||
new Metric({ | ||
name: `${this.prefix}nodejs_active_handles_total`, | ||
description: "Total number of handles", | ||
type: 1, | ||
value: process._getActiveHandles().length, | ||
timestamp, | ||
}), | ||
]; | ||
} | ||
}; | ||
|
||
module.exports = CollectorActiveHandlesTotal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,37 @@ | ||
'use strict'; | ||
"use strict"; | ||
|
||
const Metric = require('@metrics/metric'); | ||
const Metric = require("@metrics/metric"); | ||
|
||
const CollectorActiveRequestsTotal = class CollectorActiveRequestsTotal { | ||
constructor(prefix = '') { | ||
Object.defineProperty(this, 'prefix', { | ||
value: prefix, | ||
}); | ||
constructor(prefix = "") { | ||
Object.defineProperty(this, "prefix", { | ||
value: prefix, | ||
}); | ||
|
||
Object.defineProperty(this, 'collectable', { | ||
value: (typeof process._getActiveRequests === 'function'), | ||
}); | ||
} | ||
Object.defineProperty(this, "collectable", { | ||
value: typeof process._getActiveRequests === "function", | ||
}); | ||
} | ||
|
||
get [Symbol.toStringTag]() { | ||
return 'CollectorActiveRequestsTotal'; | ||
} | ||
get [Symbol.toStringTag]() { | ||
return "CollectorActiveRequestsTotal"; | ||
} | ||
|
||
collect(timestamp) { | ||
if (!this.collectable) { | ||
return null; | ||
} | ||
collect(timestamp) { | ||
if (!this.collectable) { | ||
return null; | ||
} | ||
|
||
return [new Metric({ | ||
name: `${this.prefix}nodejs_active_requests_total`, | ||
description: 'Total number of active requests', | ||
type: 1, | ||
value: process._getActiveRequests().length, | ||
timestamp, | ||
})]; | ||
} | ||
return [ | ||
new Metric({ | ||
name: `${this.prefix}nodejs_active_requests_total`, | ||
description: "Total number of active requests", | ||
type: 1, | ||
value: process._getActiveRequests().length, | ||
timestamp, | ||
}), | ||
]; | ||
} | ||
}; | ||
|
||
module.exports = CollectorActiveRequestsTotal; |
Oops, something went wrong.