File tree Expand file tree Collapse file tree
src/HttpClient/middlewares Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
88## [ Unreleased]
99
10+ ## [ 3.77.8] - 2022-12-15
11+ ### Changed
12+ - Remove socket metrics per origin
13+
1014## [ 3.77.7] - 2022-04-14
1115
1216### Fixed
@@ -1013,3 +1017,7 @@ instead
10131017## [ 0.48.0] - 2018-09-21
10141018### Changed
10151019- ` HttpClient ` now adds ` 'Accept-Encoding': 'gzip' ` header by default.
1020+
1021+
1022+ [ Unreleased ] : https://github.com/vtex/node-vtex-api/compare/v3.77.8...HEAD
1023+ [ 3.77.8 ] : https://github.com/vtex/node-vtex-api/compare/v3.77.7...v3.77.8
Original file line number Diff line number Diff line change 11{
22 "name" : " @vtex/api" ,
3- "version" : " 3.77.7 " ,
3+ "version" : " 3.77.8 " ,
44 "description" : " VTEX I/O API client" ,
55 "main" : " lib/index.js" ,
66 "typings" : " lib/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -92,28 +92,22 @@ export const requestMiddleware = (limit?: Limit) => async (ctx: MiddlewareContex
9292 ctx . response = await ( limit ? limit ( makeRequest ) : makeRequest ( ) )
9393}
9494
95- function countPerOrigin ( obj : { [ key : string ] : any [ ] } ) {
95+ function count ( obj : { [ key : string ] : any [ ] } ) {
9696 try {
97- return mapObjIndexed ( val => val . length , obj )
97+ return Object . values ( obj ) . reduce ( ( acc , val ) => acc += val . length , 0 )
9898 } catch ( _ ) {
99- return { }
99+ return 0
100100 }
101101}
102102
103103export function httpAgentStats ( ) {
104- const socketsPerOrigin = countPerOrigin ( httpAgent . sockets )
105- const sockets = sum ( values ( socketsPerOrigin ) )
106- const freeSocketsPerOrigin = countPerOrigin ( ( httpAgent as any ) . freeSockets )
107- const freeSockets = sum ( values ( freeSocketsPerOrigin ) )
108- const pendingRequestsPerOrigin = countPerOrigin ( httpAgent . requests )
109- const pendingRequests = sum ( values ( pendingRequestsPerOrigin ) )
104+ const sockets = count ( httpAgent . sockets )
105+ const freeSockets = count ( ( httpAgent as any ) . freeSockets )
106+ const pendingRequests = count ( httpAgent . requests )
110107
111108 return {
112109 freeSockets,
113- freeSocketsPerOrigin,
114110 pendingRequests,
115- pendingRequestsPerOrigin,
116111 sockets,
117- socketsPerOrigin,
118112 }
119113}
You can’t perform that action at this time.
0 commit comments