@libp2p/prometheus-metrics 4.1.3 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -89,6 +89,13 @@ export interface PrometheusMetricsInit {
89
89
  * pass true here
90
90
  */
91
91
  preserveExistingMetrics?: boolean;
92
+ /**
93
+ * The current filesystem usage is reported as the metric
94
+ * `nodejs_fs_usage_bytes` using the `statfs` function from `node:fs` - the
95
+ * default location to stat is the current working directory, configured this
96
+ * location here
97
+ */
98
+ statfsLocation?: string;
92
99
  }
93
100
  export interface PrometheusCalculatedMetricOptions<T = number> extends CalculatedMetricOptions<T> {
94
101
  registry?: Registry;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AAIH,OAAO,EAAyB,KAAK,oCAAoC,EAAY,KAAK,QAAQ,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAA;AASjJ,OAAO,KAAK,EAAE,eAAe,EAAmD,uBAAuB,EAA6D,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAsF,MAAM,mBAAmB,CAAA;AAKhV,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAK/D,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAEnB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAE/B;;OAEG;IACH,cAAc,CAAC,EAAE,oCAAoC,CAAC,mBAAmB,CAAC,CAAA;IAE1E;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AAED,MAAM,WAAW,iCAAiC,CAAC,CAAC,GAAC,MAAM,CAAE,SAAQ,uBAAuB,CAAC,CAAC,CAAC;IAC7F,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED,MAAM,W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CAAC,GAAC,MAAM,CAAE,SAAQ,uBAAuB,CAAC,CAAC,CAAC;IAC7F,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED,MAAM,WAAW,oCAAoC,CAAC,CAAC,GAAC,MAAM,CAAE,SAAQ,0BAA0B,CAAC,CAAC,CAAC;IACnG,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED,MAAM,WAAW,kCAAkC,CAAC,CAAC,GAAC,MAAM,CAAE,SAAQ,wBAAwB,CAAC,CAAC,CAAC;IAC/F,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,eAAe,CAAA;CACxB;AAmWD,wBAAgB,iBAAiB,CAAE,IAAI,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,CAAC,UAAU,EAAE,2BAA2B,KAAK,OAAO,CAI9H"}
package/dist/src/index.js CHANGED
@@ -65,6 +65,8 @@
65
65
  * rate(libp2p_tcp_dialer_errors_total[30s])
66
66
  * ```
67
67
  */
68
+ import { statfs } from 'node:fs/promises';
69
+ import { totalmem } from 'node:os';
68
70
  import { serviceCapabilities } from '@libp2p/interface';
69
71
  import each from 'it-foreach';
70
72
  import { collectDefaultMetrics, register } from 'prom-client';
@@ -120,6 +122,23 @@ class PrometheusMetrics {
120
122
  };
121
123
  }
122
124
  });
125
+ const totalMemoryMetric = this.registerMetric('nodejs_memory_total_bytes');
126
+ totalMemoryMetric.update(totalmem());
127
+ this.log('Collecting filesystem metrics');
128
+ this.registerMetricGroup('nodejs_fs_usage_bytes', {
129
+ label: 'filesystem',
130
+ calculate: async () => {
131
+ const stats = await statfs(init?.statfsLocation ?? process.cwd());
132
+ const total = stats.bsize * stats.blocks;
133
+ const available = stats.bsize * stats.bavail;
134
+ return {
135
+ total,
136
+ free: stats.bsize * stats.bfree,
137
+ available,
138
+ used: (available / total) * 100
139
+ };
140
+ }
141
+ });
123
142
  }
124
143
  [Symbol.toStringT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IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACnD,CAAC;QAED,IAAI,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QAEnC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,GAAG,CAAC,8BAA8B,EAAE,IAAI,CAAC,CAAA;YAE9C,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;gBAC3B,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAC3C,CAAC;YAED,OAAO,WAAW,CAAA;QACpB,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAA;QACxC,WAAW,GAAG,IAAI,sBAAsB,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC,CAAA;QAEpF,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;QAE9B,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE,CAAC;YAC3B,OAAO,WAAW,CAAA;QACpB,CAAC;IACH,CAAC;CACF;AAED,MAAM,UAAU,iBAAiB,CAAE,IAAqC;IACtE,OAAO,CAAC,UAAU,EAAE,EAAE;QACpB,OAAO,IAAI,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IAChD,CAAC,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/prometheus-metrics",
3
- "version": "4.1.3",
3
+ "version": "4.2.0",
4
4
  "description": "Collect libp2p metrics for scraping by Prometheus or Graphana",
5
5
  "author": "",
6
6
  "license": "Apache-2.0 OR MIT",
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@libp2p/crypto": "^5.0.4",
59
- "@libp2p/interface-compliance-tests": "^6.1.3",
59
+ "@libp2p/interface-compliance-tests": "^6.1.4",
60
60
  "@libp2p/logger": "^5.1.0",
61
61
  "@libp2p/peer-id": "^5.0.4",
62
62
  "@multiformats/multiaddr": "^12.2.3",
package/src/index.ts CHANGED
@@ -66,6 +66,8 @@
66
66
  * ```
67
67
  */
68
68
 
69
+ import { statfs } from 'node:fs/promises'
70
+ import { totalmem } from 'node:os'
69
71
  import { serviceCapabilities } from '@libp2p/interface'
70
72
  import each from 'it-foreach'
71
73
  import { collectDefaultMetrics, type DefaultMetricsCollectorConfiguration, register, type Registry, type RegistryContentType } from 'prom-client'
@@ -111,6 +113,14 @@ export interface PrometheusMetricsInit {
111
113
  * pass true here
112
114
  */
113
115
  preserveExistingMetrics?: boolean
116
+
117
+ /**
118
+ * The current filesystem usage is reported as the metric
119
+ * `nodejs_fs_usage_bytes` using the `statfs` function from `node:fs` - the
120
+ * default location to stat is the current working directory, configured this
121
+ * location here
122
+ */
123
+ statfsLocation?: string
114
124
  }
115
125
 
116
126
  export interface PrometheusCalculatedMetricOptions<T=number> extends CalculatedMetricOptions<T> {
@@ -178,6 +188,25 @@ class PrometheusMetrics implements Metrics {
178
188
  }
179
189
  }
180
190
  })
191
+ const totalMemoryMetric = this.registerMetric('nodejs_memory_total_bytes')
192
+ totalMemoryMetric.update(totalmem())
193
+
194
+ this.log('Collecting filesystem metrics')
195
+ this.registerMetricGroup('nodejs_fs_usage_bytes', {
196
+ label: 'filesystem',
197
+ calculate: async () => {
198
+ const stats = await statfs(init?.statfsLocation ?? process.cwd())
199
+ const total = stats.bsize * stats.blocks
200
+ const available = stats.bsize * stats.bavail
201
+
202
+ return {
203
+ total,
204
+ free: stats.bsize * stats.bfree,
205
+ available,
206
+ used: (available / total) * 100
207
+ }
208
+ }
209
+ })
181
210
  }
182
211
 
183
212
  readonly [Symbol.toStringTag] = '@libp2p/metrics-prometheus'