File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,6 @@ const {
3636 NODE_PERFORMANCE_MILESTONE_PRELOAD_MODULE_LOAD_END
3737} = constants ;
3838
39- const { sessionStats, streamStats } = process . binding ( 'http2' ) ;
40-
4139const L = require ( 'internal/linkedlist' ) ;
4240const kInspect = require ( 'internal/util' ) . customInspectSymbol ;
4341const { inherits } = require ( 'util' ) ;
@@ -85,9 +83,14 @@ const IDX_SESSION_STATS_DATA_SENT = 6;
8583const IDX_SESSION_STATS_DATA_RECEIVED = 7 ;
8684const IDX_SESSION_STATS_MAX_CONCURRENT_STREAMS = 8 ;
8785
86+ let sessionStats ;
87+ let streamStats ;
88+
8889function collectHttp2Stats ( entry ) {
8990 switch ( entry . name ) {
9091 case 'Http2Stream' :
92+ if ( streamStats === undefined )
93+ streamStats = process . binding ( 'http2' ) . streamStats ;
9194 entry . id =
9295 streamStats [ IDX_STREAM_STATS_ID ] >>> 0 ;
9396 entry . timeToFirstByte =
@@ -102,6 +105,8 @@ function collectHttp2Stats(entry) {
102105 streamStats [ IDX_STREAM_STATS_RECEIVEDBYTES ] ;
103106 break ;
104107 case 'Http2Session' :
108+ if ( sessionStats === undefined )
109+ sessionStats = process . binding ( 'http2' ) . sessionStats ;
105110 entry . type =
106111 sessionStats [ IDX_SESSION_STATS_TYPE ] >>> 0 === 0 ? 'server' : 'client' ;
107112 entry . pingRTT =
You can’t perform that action at this time.
0 commit comments