@@ -40,7 +40,7 @@ function getBytes(res) {
40
40
function requestStats ( ) {
41
41
const timePoints = { } ;
42
42
const result = {
43
- type : 'request' ,
43
+ category : 'request' ,
44
44
} ;
45
45
statsData . requesting += 1 ;
46
46
let done = false ;
@@ -78,13 +78,16 @@ function requestStats() {
78
78
timing . transfer = timePoints . close - timePoints . data ;
79
79
}
80
80
timing . all = timePoints . close - timePoints . start ;
81
+ const status = ( this . res && this . res . statusCode ) || 0 ;
81
82
Object . assign ( result , {
82
83
requesting : statsData . requesting ,
83
84
method : this . method ,
84
85
/* eslint no-underscore-dangle:0 */
85
86
host : this . _headers && this . _headers . host ,
86
87
url : this . path ,
87
- status : ( this . res && this . res . statusCode ) || - 1 ,
88
+ /* eslint no-bitwise:0 */
89
+ type : status / 100 | 0 ,
90
+ status,
88
91
bytes : getBytes ( this . res ) ,
89
92
timing,
90
93
} ) ;
@@ -128,13 +131,16 @@ function responseStats() {
128
131
const socketUse = Date . now ( ) - startedAt ;
129
132
socket . once ( 'close' , ( ) => {
130
133
statsData . responsing -= 1 ;
134
+ const status = this . statusCode || 0 ;
131
135
const result = {
132
- type : 'response' ,
136
+ category : 'response' ,
133
137
method : this . req . method ,
134
138
timing : {
135
139
all : Date . now ( ) - startedAt ,
136
140
socket : socketUse ,
137
141
} ,
142
+ /* eslint no-bitwise:0 */
143
+ type : status / 100 | 0 ,
138
144
status : this . statusCode ,
139
145
url : this . req && this . req . originalUrl ,
140
146
bytes : getBytes ( this . req ) ,
0 commit comments