config.js
4.87 KB
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/**
* config.js
* @author: feng.chen<feng.chen@yoho.cn>
* @date: 2017/04/13
*/
'use strict';
const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
module.exports = {
app: 'yoho-apm',
appVersion: '0.0.1', // 调用api的版本
port: 6009,
siteUrl: '//shop.yohobuy.com',
cookieDomain: '.yohobuy.com',
domains: [/yohobuy\.com^/],
loggers: {
infoFile: {
name: 'info',
level: 'info',
filename: '/Data/logs/yoho-apm/info/info.log',
maxFiles: 7
},
errorFile: {
name: 'error',
level: 'error',
filename: '/Data/logs/yoho-apm/error/error.log',
handleExceptions: true,
maxFiles: 7
},
console: {
close: false,
level: 'debug',
colorize: 'all',
prettyPrint: true
}
},
sourceMap: {
domain: 'http://static-ci.yoho.cn'
},
reportApi: {
host: 'influxd.yoho.cn',
db: 'web-apm',
measurement: 'api-info',
duration: 2000,
records: 1
},
reportRoute: {
host: 'influxd.yoho.cn',
db: 'web-apm',
measurement: 'route-info',
duration: 2000,
records: 1
},
mysql: {
host: 'localhost',
userName: 'root',
password: 'root',
port: '3306',
db: 'yoho_apm_test'
},
table: {
slow: 'slow_duration_new',
error: 'error_report',
perf: 'perf_report'
},
slowRoute: {
min: 1000,
max: 10 * 1000
// min: 0,
// max: 10 * 1000
},
zookeeperServer: '127.0.0.1:2181',
redis: {
connect: {
// host: '127.0.0.1',
host: '192.168.102.49',
port: '6379',
enable_offline_queue: false,
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
console.log('connect redis server fail');
}
if (options.attempt < 10) {
return Math.min(options.attempt * 100, 1000);
} else if (options.attempt > 10 && options.attempt < 100) {
return 1000;
} else {
return 1000 * 10;
}
}
}
},
REQUEST_LIMIT: {
// 10s 最多访问5次
10: 5,
// 30s 最多访问10次
30: 10,
// 60s 最多访问15次
60: 15,
// 100s 最多访问100次
600: 100
}
};
if (isProduction) {
Object.assign(module.exports, {
reportApi: {
host: '10.66.0.139',
port: 8086,
db: 'web-apm',
measurement: 'api-info',
duration: 2000,
records: 10
},
reportRoute: {
host: '10.66.0.139',
port: 8086,
db: 'web-apm',
measurement: 'route-info',
duration: 2000,
records: 10
},
sourceMap: {
domain: 'http://10.66.101.9:6006'
},
mysql: {
host: '10.66.0.139',
port: '3306',
db: 'webapm',
userName: 'root',
password: 'yB877Jy7tV6juIYk'
},
zookeeperServer: 'web.zookeeper.yohoops.org:2181',
redis: {
connect: {
host: 'redis.web.yohoops.org',
port: '6379',
password: 'redis9646',
enable_offline_queue: false,
retry_strategy(options) {
if (options.error && options.error.code === 'ECONNREFUSED') {
console.log('connect redis server fail');
}
if (options.attempt < 10) {
return Math.min(options.attempt * 100, 1000);
} else if (options.attempt > 10 && options.attempt < 100) {
return 1000;
} else {
return 1000 * 10;
}
}
}
}
});
}
if (isTest) {
Object.assign(module.exports, {
reportApi: {
host: 'influxdblog.web.yohoops.org',
db: 'web-apm',
measurement: 'api-info',
duration: 2000,
records: 10
},
reportRoute: {
host: 'influxdblog.web.yohoops.org',
db: 'web-apm',
measurement: 'route-info',
duration: 2000,
records: 10
},
sourceMap: {
domain: 'http://10.66.101.9:6006'
},
mysql: {
host: '192.168.102.219',
userName: 'yh_test',
password: 'yh_test',
port: '3306',
db: 'yoho_apm_test'
}
});
}