/
pm2io.md
163 lines (156 loc) · 4.2 KB
/
pm2io.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
---
layout: page
title: Reference | PM2 Plus Documentation
menu: starter
lang: en
section: plus
permalink: "/en/plus/reference/pm2io/"
---
# The @pm2/io Library
[@pm2/io](https://github.com/keymetrics/pm2-io-apm/tree/master/test) is the library that comes with PM2 which is in charge of gathering the metrics that are displayed in PM2 Plus By default, the module just wraps your app but can be required in the code to refine the configuration or add custom metrics/actions.
## Initialisation options
```javascript
export class IOConfig {
/**
* Automatically catch unhandled errors
*/
catchExceptions?: boolean = true
/**
* Configure the metrics to add automatically to your process
*/
metrics?: {
eventLoop: boolean = true,
network: boolean = false,
http: boolean = true,
gc: boolean = true,
v8: boolean = true
}
/**
* Configure the default actions that you can run
*/
actions?: {
eventLoopDump?: boolean = true
}
/**
* Configure availables profilers that will be exposed
*/
profiling?: {
/**
* Toggle the CPU profiling actions
*/
cpuJS: boolean = true
/**
* Toggle the heap snapshot actions
*/
heapSnapshot: boolean = true
/**
* Toggle the heap sampling actions
*/
heapSampling: boolean = true
/**
* Force a specific implementation of profiler
*
* available:
* - 'addon' (using the v8-profiler-node8 addon)
* - 'inspector' (using the "inspector" api from node core)
* - 'none' (disable the profilers)
* - 'both' (will try to use inspector and fallback on addon if available)
*/
implementation: string = 'both'
}
/**
* Configure the transaction tracing options
*/
tracing?: {
/**
* Choose to enable the HTTP tracing system
*
* default is false
*/
enabled: boolean = false
/**
* Specify specific urls to ignore
*/
ignoreFilter?: {
url?: string[]
method?: string[]
}
// Log levels: 0-disabled,1-error,2-warn,3-info,4-debug
logLevel?: number
/**
* To disable a plugin in this list, you may override its path with a falsy
* value. Disabling any of the default plugins may cause unwanted behavior,
* so use caution.
*/
plugins?: {
connect?: boolean
express?: boolean
'generic-pool'?: boolean
hapi?: boolean
http?: boolean
knex?: boolean
koa?: boolean
'mongodb-core'?: boolean
mysql?: boolean
pg?: boolean
redis?: boolean
restify?: boolean
}
/**
* An upper bound on the number of traces to gather each second. If set to 0,
* sampling is disabled and all traces are recorded. Sampling rates greater
* than 1000 are not supported and will result in at most 1000 samples per
* second.
*/
samplingRate?: number
}
/**
* If you want to connect to PM2 Enterprise without using PM2, you should enable
* the standalone mode
*
* default is false
*/
standalone?: boolean = false
/**
* Define custom options for the standalone mode
*/
apmOptions?: {
/**
* public key of the bucket to which the agent need to connect
*/
publicKey: string
/**
* Secret key of the bucket to which the agent need to connect
*/
secretKey: string
/**
* The name of the application/service that will be reported to PM2 Enterprise
*/
appName: string
/**
* The name of the server as reported in PM2 Enterprise
*
* default is os.hostname()
*/
serverName?: string
/**
* Broadcast all the logs from your application to our backend
*/
sendLogs?: Boolean
/**
* Since logs can be forwared to our backend you may want to ignore specific
* logs (containing sensitive data for example)
*/
logFilter?: string | RegExp
/**
* Proxy URI to use when reaching internet
* Supporting socks5,http,https,pac,socks4
* see https://github.com/TooTallNate/node-proxy-agent
*
* example: socks5://username:password@some-socks-proxy.com:9050
*/
proxy?: string
}
}
```
You can pass whatever options you want to `io.init`, it will automatically update its configuration.