Showing
3 changed files
with
24 additions
and
8 deletions
@@ -74,11 +74,18 @@ module.exports = { | @@ -74,11 +74,18 @@ module.exports = { | ||
74 | 74 | ||
75 | if (isProduction) { | 75 | if (isProduction) { |
76 | Object.assign(module.exports, { | 76 | Object.assign(module.exports, { |
77 | - report: { | 77 | + reportApi: { |
78 | host: '10.66.0.139', | 78 | host: '10.66.0.139', |
79 | port: 8086, | 79 | port: 8086, |
80 | db: 'web-apm', | 80 | db: 'web-apm', |
81 | - measurement: 'api-duration', | 81 | + measurement: 'api-info', |
82 | + duration: 2000, | ||
83 | + records: 10 | ||
84 | + }, | ||
85 | + reportRoute: { | ||
86 | + host: '10.66.0.139', | ||
87 | + db: '8086', | ||
88 | + measurement: 'route-info', | ||
82 | duration: 2000, | 89 | duration: 2000, |
83 | records: 10 | 90 | records: 10 |
84 | }, | 91 | }, |
@@ -95,10 +102,17 @@ if (isProduction) { | @@ -95,10 +102,17 @@ if (isProduction) { | ||
95 | } | 102 | } |
96 | if (isTest) { | 103 | if (isTest) { |
97 | Object.assign(module.exports, { | 104 | Object.assign(module.exports, { |
98 | - report: { | 105 | + reportApi: { |
106 | + host: 'influxdblog.web.yohoops.org', | ||
107 | + db: 'web-apm', | ||
108 | + measurement: 'api-info', | ||
109 | + duration: 2000, | ||
110 | + records: 10 | ||
111 | + }, | ||
112 | + reportRoute: { | ||
99 | host: 'influxdblog.web.yohoops.org', | 113 | host: 'influxdblog.web.yohoops.org', |
100 | db: 'web-apm', | 114 | db: 'web-apm', |
101 | - measurement: 'api-duration', | 115 | + measurement: 'route-info', |
102 | duration: 2000, | 116 | duration: 2000, |
103 | records: 10 | 117 | records: 10 |
104 | }, | 118 | }, |
@@ -11,7 +11,8 @@ function slowRouter(m) { | @@ -11,7 +11,8 @@ function slowRouter(m) { | ||
11 | udid: _.get(m, 'fields.udid', ''), | 11 | udid: _.get(m, 'fields.udid', ''), |
12 | api: _.get(m, 'tags.api', ''), | 12 | api: _.get(m, 'tags.api', ''), |
13 | route: _.get(m, 'tags.route', ''), | 13 | route: _.get(m, 'tags.route', ''), |
14 | - duration: _.get(m, 'fields.duration', '') | 14 | + duration: _.get(m, 'fields.duration', ''), |
15 | + create_time: _.get(m, 'time') | ||
15 | }; | 16 | }; |
16 | } | 17 | } |
17 | 18 | ||
@@ -28,7 +29,8 @@ function errorRouter(m) { | @@ -28,7 +29,8 @@ function errorRouter(m) { | ||
28 | column: _.get(m, 'fields.column', ''), | 29 | column: _.get(m, 'fields.column', ''), |
29 | script: _.get(m, 'fields.script', ''), | 30 | script: _.get(m, 'fields.script', ''), |
30 | message: _.get(m, 'fields.message', ''), | 31 | message: _.get(m, 'fields.message', ''), |
31 | - stack: _.get(m, 'fields.stack', '') | 32 | + stack: _.get(m, 'fields.stack', ''), |
33 | + create_time: _.get(m, 'time') | ||
32 | }; | 34 | }; |
33 | } | 35 | } |
34 | 36 |
@@ -8,7 +8,7 @@ const msg2row = require('./msg2row'); | @@ -8,7 +8,7 @@ const msg2row = require('./msg2row'); | ||
8 | const errorSender = new MysqlSender(config.table.error); | 8 | const errorSender = new MysqlSender(config.table.error); |
9 | const slowRouterSender = new MysqlSender(config.table.slow); | 9 | const slowRouterSender = new MysqlSender(config.table.slow); |
10 | 10 | ||
11 | -const influxSender = new Sender(config.report); | 11 | +const influxSender = new Sender(config.reportRoute); |
12 | 12 | ||
13 | const server = { | 13 | const server = { |
14 | async handle(data) { | 14 | async handle(data) { |
@@ -35,4 +35,4 @@ module.exports = function(req, res, next) { | @@ -35,4 +35,4 @@ module.exports = function(req, res, next) { | ||
35 | server.handle(data).then(() => { | 35 | server.handle(data).then(() => { |
36 | res.json(); | 36 | res.json(); |
37 | }).catch(next); | 37 | }).catch(next); |
38 | -}; | ||
38 | +}; |
-
Please register or login to post a comment