@promster/undici 15.0.0 → 15.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.
@@ -1 +1 @@
1
- export { createPoolMetricsExporter, observedPools } from "./pool-metrics.js";
1
+ export { createPoolMetricsExporter, addObservedPool } from "./pool-metrics.js";
@@ -11,6 +11,6 @@ export declare class ObservedPools {
11
11
  get(origin: string): Pool | undefined;
12
12
  [Symbol.iterator](): IterableIterator<[string, Pool]>;
13
13
  }
14
- declare const observedPools: ObservedPools;
15
- declare function createPoolMetricsExporter(pools: Record<string, Pool>, options?: TPoolsMetricsExporterOptions): void;
16
- export { createPoolMetricsExporter, observedPools, type TPoolsMetricsExporterOptions, };
14
+ declare function addObservedPool(origin: string, pool: Pool): void;
15
+ declare function createPoolMetricsExporter(initialPools?: Record<string, Pool>, options?: TPoolsMetricsExporterOptions): void;
16
+ export { createPoolMetricsExporter, addObservedPool, type TPoolsMetricsExporterOptions, };
@@ -33,10 +33,15 @@ class ObservedPools {
33
33
  }
34
34
  }
35
35
  const observedPools = new ObservedPools();
36
- function createPoolMetricsExporter(pools, options) {
36
+ function addObservedPool(origin, pool) {
37
+ observedPools.add(origin, pool);
38
+ }
39
+ function createPoolMetricsExporter(initialPools, options) {
37
40
  var _options$metricPrefix;
38
41
  const metricName = `${(_options$metricPrefix = options === null || options === void 0 ? void 0 : options.metricPrefix) !== null && _options$metricPrefix !== void 0 ? _options$metricPrefix : ''}nodejs_undici_pool_stats`;
39
- observedPools.addMany(pools);
42
+ if (initialPools) {
43
+ observedPools.addMany(initialPools);
44
+ }
40
45
  new metrics.Prometheus.Gauge({
41
46
  name: metricName,
42
47
  help: 'Statistics for Undici connection pools. See https://github.com/nodejs/undici/blob/main/docs/docs/api/PoolStats.md',
@@ -60,5 +65,5 @@ function createPoolMetricsExporter(pools, options) {
60
65
  });
61
66
  }
62
67
 
68
+ exports.addObservedPool = addObservedPool;
63
69
  exports.createPoolMetricsExporter = createPoolMetricsExporter;
64
- exports.observedPools = observedPools;
@@ -33,10 +33,15 @@ class ObservedPools {
33
33
  }
34
34
  }
35
35
  const observedPools = new ObservedPools();
36
- function createPoolMetricsExporter(pools, options) {
36
+ function addObservedPool(origin, pool) {
37
+ observedPools.add(origin, pool);
38
+ }
39
+ function createPoolMetricsExporter(initialPools, options) {
37
40
  var _options$metricPrefix;
38
41
  const metricName = `${(_options$metricPrefix = options === null || options === void 0 ? void 0 : options.metricPrefix) !== null && _options$metricPrefix !== void 0 ? _options$metricPrefix : ''}nodejs_undici_pool_stats`;
39
- observedPools.addMany(pools);
42
+ if (initialPools) {
43
+ observedPools.addMany(initialPools);
44
+ }
40
45
  new metrics.Prometheus.Gauge({
41
46
  name: metricName,
42
47
  help: 'Statistics for Undici connection pools. See https://github.com/nodejs/undici/blob/main/docs/docs/api/PoolStats.md',
@@ -60,5 +65,5 @@ function createPoolMetricsExporter(pools, options) {
60
65
  });
61
66
  }
62
67
 
68
+ exports.addObservedPool = addObservedPool;
63
69
  exports.createPoolMetricsExporter = createPoolMetricsExporter;
64
- exports.observedPools = observedPools;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promster/undici",
3
- "version": "15.0.0",
3
+ "version": "15.0.1",
4
4
  "description": "Undici server integrations of promster",
5
5
  "main": "dist/promster-undici.cjs.js",
6
6
  "typings": "dist/promster-undici.cjs.d.ts",
@@ -39,8 +39,8 @@
39
39
  "dependencies": {
40
40
  "merge-options": "3.0.4",
41
41
  "tslib": "2.6.3",
42
- "@promster/metrics": "15.0.0",
43
- "@promster/types": "15.0.0"
42
+ "@promster/metrics": "15.0.1",
43
+ "@promster/types": "15.0.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "20.16.13",
@@ -49,8 +49,8 @@
49
49
  "parse-prometheus-text-format": "1.1.1",
50
50
  "undici": "7.7.0",
51
51
  "express": "4.21.2",
52
- "@promster/server": "15.0.0",
53
- "@promster/express": "15.0.0"
52
+ "@promster/server": "15.0.1",
53
+ "@promster/express": "15.0.1"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "prom-client": "13.x.x || 14.x || 15.x",