@libp2p/prometheus-metrics 3.0.15 → 3.0.16
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/README.md +25 -8
- package/dist/src/index.d.ts +8 -8
- package/dist/src/index.js +8 -8
- package/package.json +7 -6
- package/src/index.ts +8 -8
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# @libp2p/prometheus-metrics
|
|
2
|
+
|
|
1
3
|
[](http://libp2p.io/)
|
|
2
4
|
[](https://discuss.libp2p.io)
|
|
3
5
|
[](https://codecov.io/gh/libp2p/js-libp2p)
|
|
@@ -7,6 +9,21 @@
|
|
|
7
9
|
|
|
8
10
|
# About
|
|
9
11
|
|
|
12
|
+
<!--
|
|
13
|
+
|
|
14
|
+
!IMPORTANT!
|
|
15
|
+
|
|
16
|
+
Everything in this README between "# About" and "# Install" is automatically
|
|
17
|
+
generated and will be overwritten the next time the doc generator is run.
|
|
18
|
+
|
|
19
|
+
To make changes to this section, please update the @packageDocumentation section
|
|
20
|
+
of src/index.js or src/index.ts
|
|
21
|
+
|
|
22
|
+
To experiment with formatting, please run "npm run docs" from the root of this
|
|
23
|
+
repo and examine the changes made.
|
|
24
|
+
|
|
25
|
+
-->
|
|
26
|
+
|
|
10
27
|
Configure your libp2p node with Prometheus metrics:
|
|
11
28
|
|
|
12
29
|
```typescript
|
|
@@ -20,10 +37,10 @@ const node = await createLibp2p({
|
|
|
20
37
|
|
|
21
38
|
Then use the `prom-client` module to supply metrics to the Prometheus/Graphana client using your http framework:
|
|
22
39
|
|
|
23
|
-
```
|
|
40
|
+
```JavaScript
|
|
24
41
|
import client from 'prom-client'
|
|
25
42
|
|
|
26
|
-
async handler (request, h) {
|
|
43
|
+
async function handler (request, h) {
|
|
27
44
|
return h.response(await client.register.metrics())
|
|
28
45
|
.type(client.register.contentType)
|
|
29
46
|
}
|
|
@@ -31,29 +48,29 @@ async handler (request, h) {
|
|
|
31
48
|
|
|
32
49
|
All Prometheus metrics are global so there's no other work required to extract them.
|
|
33
50
|
|
|
34
|
-
|
|
51
|
+
## Queries
|
|
35
52
|
|
|
36
53
|
Some useful queries are:
|
|
37
54
|
|
|
38
|
-
|
|
55
|
+
### Data sent/received
|
|
39
56
|
|
|
40
57
|
```
|
|
41
58
|
rate(libp2p_data_transfer_bytes_total[30s])
|
|
42
59
|
```
|
|
43
60
|
|
|
44
|
-
|
|
61
|
+
### CPU usage
|
|
45
62
|
|
|
46
63
|
```
|
|
47
64
|
rate(process_cpu_user_seconds_total[30s]) * 100
|
|
48
65
|
```
|
|
49
66
|
|
|
50
|
-
|
|
67
|
+
### Memory usage
|
|
51
68
|
|
|
52
69
|
```
|
|
53
70
|
nodejs_memory_usage_bytes
|
|
54
71
|
```
|
|
55
72
|
|
|
56
|
-
|
|
73
|
+
### DHT query time
|
|
57
74
|
|
|
58
75
|
```
|
|
59
76
|
libp2p_kad_dht_wan_query_time_seconds
|
|
@@ -65,7 +82,7 @@ or
|
|
|
65
82
|
libp2p_kad_dht_lan_query_time_seconds
|
|
66
83
|
```
|
|
67
84
|
|
|
68
|
-
|
|
85
|
+
### TCP transport dialer errors
|
|
69
86
|
|
|
70
87
|
```
|
|
71
88
|
rate(libp2p_tcp_dialer_errors_total[30s])
|
package/dist/src/index.d.ts
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Then use the `prom-client` module to supply metrics to the Prometheus/Graphana client using your http framework:
|
|
16
16
|
*
|
|
17
|
-
* ```
|
|
17
|
+
* ```JavaScript
|
|
18
18
|
* import client from 'prom-client'
|
|
19
19
|
*
|
|
20
|
-
* async handler (request, h) {
|
|
20
|
+
* async function handler (request, h) {
|
|
21
21
|
* return h.response(await client.register.metrics())
|
|
22
22
|
* .type(client.register.contentType)
|
|
23
23
|
* }
|
|
@@ -25,29 +25,29 @@
|
|
|
25
25
|
*
|
|
26
26
|
* All Prometheus metrics are global so there's no other work required to extract them.
|
|
27
27
|
*
|
|
28
|
-
*
|
|
28
|
+
* ## Queries
|
|
29
29
|
*
|
|
30
30
|
* Some useful queries are:
|
|
31
31
|
*
|
|
32
|
-
*
|
|
32
|
+
* ### Data sent/received
|
|
33
33
|
*
|
|
34
34
|
* ```
|
|
35
35
|
* rate(libp2p_data_transfer_bytes_total[30s])
|
|
36
36
|
* ```
|
|
37
37
|
*
|
|
38
|
-
*
|
|
38
|
+
* ### CPU usage
|
|
39
39
|
*
|
|
40
40
|
* ```
|
|
41
41
|
* rate(process_cpu_user_seconds_total[30s]) * 100
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
|
-
*
|
|
44
|
+
* ### Memory usage
|
|
45
45
|
*
|
|
46
46
|
* ```
|
|
47
47
|
* nodejs_memory_usage_bytes
|
|
48
48
|
* ```
|
|
49
49
|
*
|
|
50
|
-
*
|
|
50
|
+
* ### DHT query time
|
|
51
51
|
*
|
|
52
52
|
* ```
|
|
53
53
|
* libp2p_kad_dht_wan_query_time_seconds
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
* libp2p_kad_dht_lan_query_time_seconds
|
|
60
60
|
* ```
|
|
61
61
|
*
|
|
62
|
-
*
|
|
62
|
+
* ### TCP transport dialer errors
|
|
63
63
|
*
|
|
64
64
|
* ```
|
|
65
65
|
* rate(libp2p_tcp_dialer_errors_total[30s])
|
package/dist/src/index.js
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Then use the `prom-client` module to supply metrics to the Prometheus/Graphana client using your http framework:
|
|
16
16
|
*
|
|
17
|
-
* ```
|
|
17
|
+
* ```JavaScript
|
|
18
18
|
* import client from 'prom-client'
|
|
19
19
|
*
|
|
20
|
-
* async handler (request, h) {
|
|
20
|
+
* async function handler (request, h) {
|
|
21
21
|
* return h.response(await client.register.metrics())
|
|
22
22
|
* .type(client.register.contentType)
|
|
23
23
|
* }
|
|
@@ -25,29 +25,29 @@
|
|
|
25
25
|
*
|
|
26
26
|
* All Prometheus metrics are global so there's no other work required to extract them.
|
|
27
27
|
*
|
|
28
|
-
*
|
|
28
|
+
* ## Queries
|
|
29
29
|
*
|
|
30
30
|
* Some useful queries are:
|
|
31
31
|
*
|
|
32
|
-
*
|
|
32
|
+
* ### Data sent/received
|
|
33
33
|
*
|
|
34
34
|
* ```
|
|
35
35
|
* rate(libp2p_data_transfer_bytes_total[30s])
|
|
36
36
|
* ```
|
|
37
37
|
*
|
|
38
|
-
*
|
|
38
|
+
* ### CPU usage
|
|
39
39
|
*
|
|
40
40
|
* ```
|
|
41
41
|
* rate(process_cpu_user_seconds_total[30s]) * 100
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
|
-
*
|
|
44
|
+
* ### Memory usage
|
|
45
45
|
*
|
|
46
46
|
* ```
|
|
47
47
|
* nodejs_memory_usage_bytes
|
|
48
48
|
* ```
|
|
49
49
|
*
|
|
50
|
-
*
|
|
50
|
+
* ### DHT query time
|
|
51
51
|
*
|
|
52
52
|
* ```
|
|
53
53
|
* libp2p_kad_dht_wan_query_time_seconds
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
* libp2p_kad_dht_lan_query_time_seconds
|
|
60
60
|
* ```
|
|
61
61
|
*
|
|
62
|
-
*
|
|
62
|
+
* ### TCP transport dialer errors
|
|
63
63
|
*
|
|
64
64
|
* ```
|
|
65
65
|
* rate(libp2p_tcp_dialer_errors_total[30s])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/prometheus-metrics",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.16",
|
|
4
4
|
"description": "Collect libp2p metrics for scraping by Prometheus or Graphana",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "Apache-2.0 OR MIT",
|
|
@@ -41,24 +41,25 @@
|
|
|
41
41
|
"clean": "aegir clean",
|
|
42
42
|
"lint": "aegir lint",
|
|
43
43
|
"dep-check": "aegir dep-check",
|
|
44
|
+
"doc-check": "aegir doc-check",
|
|
44
45
|
"build": "aegir build",
|
|
45
46
|
"test": "aegir test -t node",
|
|
46
47
|
"test:node": "aegir test -t node --cov",
|
|
47
48
|
"test:electron-main": "aegir test -t electron-main --cov"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
50
|
-
"@libp2p/interface": "^1.1.
|
|
51
|
+
"@libp2p/interface": "^1.1.4",
|
|
51
52
|
"it-foreach": "^2.0.6",
|
|
52
53
|
"it-stream-types": "^2.0.1",
|
|
53
54
|
"prom-client": "^15.1.0",
|
|
54
55
|
"uint8arraylist": "^2.4.8"
|
|
55
56
|
},
|
|
56
57
|
"devDependencies": {
|
|
57
|
-
"@libp2p/interface-compliance-tests": "^5.3.
|
|
58
|
-
"@libp2p/logger": "^4.0.
|
|
59
|
-
"@libp2p/peer-id-factory": "^4.0.
|
|
58
|
+
"@libp2p/interface-compliance-tests": "^5.3.2",
|
|
59
|
+
"@libp2p/logger": "^4.0.7",
|
|
60
|
+
"@libp2p/peer-id-factory": "^4.0.7",
|
|
60
61
|
"@multiformats/multiaddr": "^12.1.14",
|
|
61
|
-
"aegir": "^42.2.
|
|
62
|
+
"aegir": "^42.2.4",
|
|
62
63
|
"it-drain": "^3.0.5",
|
|
63
64
|
"it-pipe": "^3.0.1",
|
|
64
65
|
"p-defer": "^4.0.0"
|
package/src/index.ts
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
*
|
|
15
15
|
* Then use the `prom-client` module to supply metrics to the Prometheus/Graphana client using your http framework:
|
|
16
16
|
*
|
|
17
|
-
* ```
|
|
17
|
+
* ```JavaScript
|
|
18
18
|
* import client from 'prom-client'
|
|
19
19
|
*
|
|
20
|
-
* async handler (request, h) {
|
|
20
|
+
* async function handler (request, h) {
|
|
21
21
|
* return h.response(await client.register.metrics())
|
|
22
22
|
* .type(client.register.contentType)
|
|
23
23
|
* }
|
|
@@ -25,29 +25,29 @@
|
|
|
25
25
|
*
|
|
26
26
|
* All Prometheus metrics are global so there's no other work required to extract them.
|
|
27
27
|
*
|
|
28
|
-
*
|
|
28
|
+
* ## Queries
|
|
29
29
|
*
|
|
30
30
|
* Some useful queries are:
|
|
31
31
|
*
|
|
32
|
-
*
|
|
32
|
+
* ### Data sent/received
|
|
33
33
|
*
|
|
34
34
|
* ```
|
|
35
35
|
* rate(libp2p_data_transfer_bytes_total[30s])
|
|
36
36
|
* ```
|
|
37
37
|
*
|
|
38
|
-
*
|
|
38
|
+
* ### CPU usage
|
|
39
39
|
*
|
|
40
40
|
* ```
|
|
41
41
|
* rate(process_cpu_user_seconds_total[30s]) * 100
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
|
-
*
|
|
44
|
+
* ### Memory usage
|
|
45
45
|
*
|
|
46
46
|
* ```
|
|
47
47
|
* nodejs_memory_usage_bytes
|
|
48
48
|
* ```
|
|
49
49
|
*
|
|
50
|
-
*
|
|
50
|
+
* ### DHT query time
|
|
51
51
|
*
|
|
52
52
|
* ```
|
|
53
53
|
* libp2p_kad_dht_wan_query_time_seconds
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
* libp2p_kad_dht_lan_query_time_seconds
|
|
60
60
|
* ```
|
|
61
61
|
*
|
|
62
|
-
*
|
|
62
|
+
* ### TCP transport dialer errors
|
|
63
63
|
*
|
|
64
64
|
* ```
|
|
65
65
|
* rate(libp2p_tcp_dialer_errors_total[30s])
|