-
Notifications
You must be signed in to change notification settings - Fork 57
/
configuration.js
100 lines (80 loc) · 2.94 KB
/
configuration.js
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
'use strict';
const os = require('os');
function config(name, env, format, value, rules = []) {
return { name, env, format, value, rules, };
}
function xprofctl(configurable, describe, choices) {
return { configurable, describe, choices, };
}
module.exports = () => {
return [
{
...xprofctl(false),
...config('log_dir', 'XPROFILER_LOG_DIR', 'string', os.tmpdir(), ['path']),
},
{
...xprofctl(false),
...config('log_interval', 'XPROFILER_LOG_INTERVAL', 'number', 60), // seconds
},
{
...xprofctl(true, '日志级别: info, error, debug', [0, 1, 2],),
...config('log_level', 'XPROFILER_LOG_LEVEL', 'number', 1), // 0: info, 1: error, 2: debug
},
{
...xprofctl(true, '日志输出位置: 文件, 控制台', [0, 1]),
...config('log_type', 'XPROFILER_LOG_TYPE', 'number', 0), // 0: file, 1: console
},
{
...xprofctl(false),
...config('log_format_alinode', 'XPROFILER_LOG_FORMAT_ALINODE', 'boolean', false),
},
{
...xprofctl(false),
...config('patch_http', 'XPROFILER_PATCH_HTTP', 'boolean', true),
},
{
...xprofctl(false),
...config('patch_http_timeout', 'XPROFILER_PATCH_HTTP_TIMEOUT', 'number', 30), // seconds
},
{
...xprofctl(false),
...config('check_throw', 'XPROFILER_CHECK_THROW', 'boolean', true),
},
{
...xprofctl(false),
...config('auto_incr_heap_limit_size', 'XPROFILER_AUTO_INCR_HEAP_LIMIT_SIZE', 'number', 256), // MB
},
{
...xprofctl(true, enable => `${enable ? '开启' : '关闭'} libuv 句柄详情采集`),
...config('enable_log_uv_handles', 'XPROFILER_ENABLE_LOG_UV_HANDLES', 'boolean', true),
},
{
...xprofctl(false),
...config('enable_fatal_error_hook', 'XPROFILER_ENABLE_FATAL_ERROR_HOOK', 'boolean', true),
},
{
...xprofctl(true, enable => `${enable ? '开启' : '关闭'} FatalError 时自动 Report`),
...config('enable_fatal_error_report', 'XPROFILER_ENABLE_FATAL_ERROR_REPORT', 'boolean', true),
},
{
...xprofctl(true, enable => `${enable ? '开启' : '关闭'} FatalError 时自动 Coredump`),
...config('enable_fatal_error_coredump', 'XPROFILER_ENABLE_FATAL_ERROR_COREDUMP', 'boolean', false),
},
{
...xprofctl(true, enable => `在 CPU 采样期间${enable ? '开启' : '关闭'} HTTP Profiling`),
...config('enable_http_profiling', 'XPROFILER_ENABLE_HTTP_PROFILING', 'boolean', false),
},
{
...xprofctl(true, enable => `${enable ? '启用' : '禁用'} Node.js 自动增加堆上限`),
...config('enable_auto_incr_heap_limit', 'XPROFILER_ENABLE_AUTO_INCR_HEAP_LIMIT', 'boolean', false),
},
{
...xprofctl(false),
...config('enable_avoid_rss_leak', 'XPROFILER_ENABLE_AVOID_RSS_LEAK', 'boolean', false),
},
{
...xprofctl(false),
...config('m_mmap_threshold', 'XPROFILER_M_MMAP_THRESHOLD', 'number', 128), // KB
},
];
};