hyperswarm-stats 1.1.1 → 1.1.2

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.
Files changed (2) hide show
  1. package/index.js +48 -48
  2. package/package.json +2 -3
package/index.js CHANGED
@@ -9,9 +9,9 @@ class HyperswarmStats {
9
9
  this._packetsTransmittedOverClosedSwarmStreams = 0
10
10
  this._bytesReceivedOverClosedSwarmStreams = 0
11
11
  this._packetsReceivedOverClosedSwarmStreams = 0
12
- this._retransmitsOfClosedSwarmStreams = 0
13
- this._fastRecoveriesOfClosedSwarmStreams = 0
14
- this._rtoCountOfClosedSwarmStreams = 0
12
+ // this._retransmitsOfClosedSwarmStreams = 0
13
+ // this._fastRecoveriesOfClosedSwarmStreams = 0
14
+ // this._rtoCountOfClosedSwarmStreams = 0
15
15
 
16
16
  swarm.on('connection', conn => {
17
17
  conn.on('close', () => {
@@ -19,9 +19,9 @@ class HyperswarmStats {
19
19
  this._packetsTransmittedOverClosedSwarmStreams += conn.rawStream?.packetsTransmitted || 0
20
20
  this._bytesReceivedOverClosedSwarmStreams += conn.rawStream?.bytesReceived || 0
21
21
  this._packetsReceivedOverClosedSwarmStreams += conn.rawStream?.packetsReceived || 0
22
- this._retransmitsOfClosedSwarmStreams += conn.rawStream?.retransmits
23
- this._fastRecoveriesOfClosedSwarmStreams += conn.rawStream?.fastRecoveries
24
- this._rtoCountOfClosedSwarmStreams += conn.rawStream?.rtoCount
22
+ // this._retransmitsOfClosedSwarmStreams += conn.rawStream?.retransmits
23
+ // this._fastRecoveriesOfClosedSwarmStreams += conn.rawStream?.fastRecoveries
24
+ // this._rtoCountOfClosedSwarmStreams += conn.rawStream?.rtoCount
25
25
  })
26
26
  })
27
27
  }
@@ -60,32 +60,32 @@ class HyperswarmStats {
60
60
  return totalMTU / count
61
61
  }
62
62
 
63
- getRetransmitsAcrossAllStreams () {
64
- let countFromCurrentConns = 0
65
- for (const conn of this.swarm.connections) {
66
- countFromCurrentConns += conn.rawStream?.retransmits || 0
67
- }
63
+ // getRetransmitsAcrossAllStreams () {
64
+ // let countFromCurrentConns = 0
65
+ // for (const conn of this.swarm.connections) {
66
+ // countFromCurrentConns += conn.rawStream?.retransmits || 0
67
+ // }
68
68
 
69
- return countFromCurrentConns + this._retransmitsOfClosedSwarmStreams
70
- }
69
+ // return countFromCurrentConns + this._retransmitsOfClosedSwarmStreams
70
+ // }
71
71
 
72
- getFastRecoveriesAcrossAllStreams () {
73
- let countFromCurrentConns = 0
74
- for (const conn of this.swarm.connections) {
75
- countFromCurrentConns += conn.rawStream?.fastRecoveries || 0
76
- }
72
+ // getFastRecoveriesAcrossAllStreams () {
73
+ // let countFromCurrentConns = 0
74
+ // for (const conn of this.swarm.connections) {
75
+ // countFromCurrentConns += conn.rawStream?.fastRecoveries || 0
76
+ // }
77
77
 
78
- return countFromCurrentConns + this._fastRecoveriesOfClosedSwarmStreams
79
- }
78
+ // return countFromCurrentConns + this._fastRecoveriesOfClosedSwarmStreams
79
+ // }
80
80
 
81
- getRTOCountAcrossAllStreams () {
82
- let countFromCurrentConns = 0
83
- for (const conn of this.swarm.connections) {
84
- countFromCurrentConns += conn.rawStream?.rtoCount || 0
85
- }
81
+ // getRTOCountAcrossAllStreams () {
82
+ // let countFromCurrentConns = 0
83
+ // for (const conn of this.swarm.connections) {
84
+ // countFromCurrentConns += conn.rawStream?.rtoCount || 0
85
+ // }
86
86
 
87
- return countFromCurrentConns + this._rtoCountOfClosedSwarmStreams
88
- }
87
+ // return countFromCurrentConns + this._rtoCountOfClosedSwarmStreams
88
+ // }
89
89
 
90
90
  getBytesTransmittedAcrossAllStreams () {
91
91
  let bytesFromCurrentConns = 0
@@ -221,27 +221,27 @@ class HyperswarmStats {
221
221
  }
222
222
  })
223
223
 
224
- new promClient.Gauge({ // eslint-disable-line no-new
225
- name: 'hyperswarm_total_retransmits_over_swarm_streams',
226
- help: 'Total UDX retransmits (after a lost packet), summed across the streams exposed explicitly by hyperswarm connections',
227
- collect () {
228
- this.set(self.getRetransmitsAcrossAllStreams())
229
- }
230
- })
231
- new promClient.Gauge({ // eslint-disable-line no-new
232
- name: 'hyperswarm_total_fast_recoveries_over_swarm_streams',
233
- help: 'Total UDX fast recoveries summed across the streams exposed explicitly by hyperswarm connections',
234
- collect () {
235
- this.set(self.getFastRecoveriesAcrossAllStreams())
236
- }
237
- })
238
- new promClient.Gauge({ // eslint-disable-line no-new
239
- name: 'hyperswarm_total_rto_count_over_swarm_streams',
240
- help: 'Total UDX retransmission time-outs, summed across the streams exposed explicitly by hyperswarm connections',
241
- collect () {
242
- this.set(self.getRTOCountAcrossAllStreams())
243
- }
244
- })
224
+ // new promClient.Gauge({ // eslint-disable-line no-new
225
+ // name: 'hyperswarm_total_retransmits_over_swarm_streams',
226
+ // help: 'Total UDX retransmits (after a lost packet), summed across the streams exposed explicitly by hyperswarm connections',
227
+ // collect () {
228
+ // this.set(self.getRetransmitsAcrossAllStreams())
229
+ // }
230
+ // })
231
+ // new promClient.Gauge({ // eslint-disable-line no-new
232
+ // name: 'hyperswarm_total_fast_recoveries_over_swarm_streams',
233
+ // help: 'Total UDX fast recoveries summed across the streams exposed explicitly by hyperswarm connections',
234
+ // collect () {
235
+ // this.set(self.getFastRecoveriesAcrossAllStreams())
236
+ // }
237
+ // })
238
+ // new promClient.Gauge({ // eslint-disable-line no-new
239
+ // name: 'hyperswarm_total_rto_count_over_swarm_streams',
240
+ // help: 'Total UDX retransmission time-outs, summed across the streams exposed explicitly by hyperswarm connections',
241
+ // collect () {
242
+ // this.set(self.getRTOCountAcrossAllStreams())
243
+ // }
244
+ // })
245
245
  }
246
246
  }
247
247
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperswarm-stats",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Hyperswarm stats with prometheus support",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -32,7 +32,6 @@
32
32
  "standard": "^17.1.0"
33
33
  },
34
34
  "dependencies": {
35
- "hyperdht-stats": "1.0.0",
36
- "udx-native": "^1.12.0"
35
+ "hyperdht-stats": "1.0.0"
37
36
  }
38
37
  }