@k03mad/simple-prom 11.0.0 → 11.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.editorconfig CHANGED
@@ -8,8 +8,5 @@ indent_style = space
8
8
  insert_final_newline = true
9
9
  trim_trailing_whitespace = true
10
10
 
11
- [*.json]
12
- indent_size = 2
13
-
14
- [*.{yml,yaml}]
11
+ [*.{json,yml,yaml}]
15
12
  indent_size = 2
@@ -5,10 +5,10 @@ updates:
5
5
  schedule:
6
6
  interval: monthly
7
7
  assignees:
8
- - "k03mad"
8
+ - 'k03mad'
9
9
  - package-ecosystem: github-actions
10
10
  directory: /
11
11
  schedule:
12
12
  interval: monthly
13
13
  assignees:
14
- - "k03mad"
14
+ - 'k03mad'
package/.oxfmtrc.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "./node_modules/oxfmt/configuration_schema.json",
3
+ "ignorePatterns": ["node_modules/**"],
4
+ "singleQuote": true,
5
+ "arrowParens": "avoid",
6
+ "bracketSpacing": false,
7
+ "quoteProps": "consistent",
8
+ "experimentalSortImports": {
9
+ "groups": [
10
+ ["builtin"],
11
+ ["external", "type-external"],
12
+ ["internal", "type-internal"],
13
+ ["parent", "type-parent"],
14
+ ["sibling", "type-sibling"],
15
+ ["index", "type-index"]
16
+ ]
17
+ }
18
+ }
package/.oxlintrc.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
3
+ "extends": ["./node_modules/@k03mad/oxlint-config/.oxlintrc.json"],
4
+ "env": {
5
+ "node": true
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "cSpell.words": ["oxfmt", "oxlint"]
3
+ }
@@ -12,10 +12,8 @@ import client from 'prom-client';
12
12
  export const registerMetrics = ({appName, port, metrics, metricsTurnOff = []}) => {
13
13
  const filteredMetrics = metrics
14
14
  ? Object.fromEntries(
15
- Object.entries(metrics).filter(
16
- ([key]) => !metricsTurnOff.includes(key),
17
- ),
18
- )
15
+ Object.entries(metrics).filter(([key]) => !metricsTurnOff.includes(key)),
16
+ )
19
17
  : {};
20
18
 
21
19
  const register = new client.Registry();
@@ -23,26 +21,24 @@ export const registerMetrics = ({appName, port, metrics, metricsTurnOff = []}) =
23
21
  client.collectDefaultMetrics({register});
24
22
  register.setDefaultLabels({app: appName, port, host: os.hostname});
25
23
 
26
- Object
27
- .values(filteredMetrics)
28
- .forEach(metric => {
29
- const {collect, name, ...rest} = metric;
30
-
31
- const gauge = new client.Gauge({
32
- name,
33
- ...rest,
34
- async collect() {
35
- try {
36
- await collect(this);
37
- } catch (err) {
38
- console.error(`>> ${name}`);
39
- console.error(err);
40
- }
41
- },
42
- });
43
-
44
- register.registerMetric(gauge);
24
+ Object.values(filteredMetrics).forEach(metric => {
25
+ const {collect, name, ...rest} = metric;
26
+
27
+ const gauge = new client.Gauge({
28
+ name,
29
+ ...rest,
30
+ async collect() {
31
+ try {
32
+ await collect(this);
33
+ } catch (err) {
34
+ console.error(`>> ${name}`);
35
+ console.error(err);
36
+ }
37
+ },
45
38
  });
46
39
 
40
+ register.registerMetric(gauge);
41
+ });
42
+
47
43
  return register;
48
44
  };
package/app/lib/server.js CHANGED
@@ -16,7 +16,14 @@ import {registerMetrics} from './register.js';
16
16
  * @param {boolean} opts.debug
17
17
  * @param {string} opts.static
18
18
  */
19
- export const startMetricsServer = ({appName, port, metrics, metricsTurnOff, debug, static: staticOpts}) => {
19
+ export const startMetricsServer = ({
20
+ appName,
21
+ port,
22
+ metrics,
23
+ metricsTurnOff,
24
+ debug,
25
+ static: staticOpts,
26
+ }) => {
20
27
  const register = registerMetrics({appName, port, metrics, metricsTurnOff});
21
28
 
22
29
  const app = express();
@@ -44,9 +51,13 @@ export const startMetricsServer = ({appName, port, metrics, metricsTurnOff, debu
44
51
  res.send(data);
45
52
  });
46
53
 
47
- app.listen(port, () => console.log([
48
- `[${String(new Date())}]\n${nameText(appName)}`,
49
- 'started on port',
50
- numText(port),
51
- ].join(' ')));
54
+ app.listen(port, () =>
55
+ console.log(
56
+ [
57
+ `[${String(new Date())}]\n${nameText(appName)}`,
58
+ 'started on port',
59
+ numText(port),
60
+ ].join(' '),
61
+ ),
62
+ );
52
63
  };
package/package.json CHANGED
@@ -1,19 +1,20 @@
1
1
  {
2
2
  "name": "@k03mad/simple-prom",
3
- "version": "11.0.0",
3
+ "version": "11.0.1",
4
4
  "description": "Simple prom-client library",
5
+ "license": "MIT",
5
6
  "maintainers": [
6
7
  "Kirill Molchanov <k03.mad@gmail.com"
7
8
  ],
8
- "main": "app/index.js",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/k03mad/simple-prom.git"
12
12
  },
13
- "license": "MIT",
14
13
  "type": "module",
15
- "engines": {
16
- "node": ">=24"
14
+ "main": "app/index.js",
15
+ "scripts": {
16
+ "lint": "oxlint --report-unused-disable-directives && oxfmt --check",
17
+ "prepare": "husky || true"
17
18
  },
18
19
  "dependencies": {
19
20
  "chalk": "5.6.2",
@@ -24,12 +25,12 @@
24
25
  "prom-client": "15.1.3"
25
26
  },
26
27
  "devDependencies": {
27
- "@k03mad/eslint-config": "34.1.2",
28
- "eslint": "10.0.0",
29
- "husky": "9.1.7"
28
+ "@k03mad/oxlint-config": "0.0.10",
29
+ "husky": "9.1.7",
30
+ "oxfmt": "0.34.0",
31
+ "oxlint": "1.49.0"
30
32
  },
31
- "scripts": {
32
- "lint": "eslint ./ --cache",
33
- "prepare": "husky || true"
33
+ "engines": {
34
+ "node": ">=24"
34
35
  }
35
36
  }
package/eslint.config.js DELETED
@@ -1 +0,0 @@
1
- export {default} from '@k03mad/eslint-config';