diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 14b1aa44dddc26..453fc54eb95132 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -92,11 +92,12 @@ const IDX_SESSION_STATS_DATA_SENT = 6; const IDX_SESSION_STATS_DATA_RECEIVED = 7; const IDX_SESSION_STATS_MAX_CONCURRENT_STREAMS = 8; +let http2; let sessionStats; let streamStats; function collectHttp2Stats(entry) { - const http2 = internalBinding('http2'); + if (http2 === undefined) http2 = internalBinding('http2'); switch (entry.name) { case 'Http2Stream': if (streamStats === undefined)