Track browser connections
Reviewed By: lblasa Differential Revision: D50225630 fbshipit-source-id: 31842fcde494ec05edf2458396d466239397d2c8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
77d67c24db
commit
0e664d274a
@@ -27,6 +27,8 @@ import {
|
||||
} from 'flipper-server-companion';
|
||||
import {URLSearchParams} from 'url';
|
||||
import {getFlipperServerConfig} from '../FlipperServerConfig';
|
||||
import {tracker} from '../tracker';
|
||||
import {performance} from 'perf_hooks';
|
||||
|
||||
const safe = (f: () => void) => {
|
||||
try {
|
||||
@@ -50,6 +52,14 @@ export function attachSocketServer(
|
||||
server: FlipperServerImpl,
|
||||
companionEnv: FlipperServerCompanionEnv,
|
||||
) {
|
||||
const t0 = performance.now();
|
||||
const browserConnectionTimeout = setTimeout(() => {
|
||||
tracker.track('browser-connection-created', {
|
||||
successful: false,
|
||||
timeMS: performance.now() - t0,
|
||||
});
|
||||
}, 20000);
|
||||
|
||||
socket.on('connection', (client, req) => {
|
||||
const clientAddress =
|
||||
(req.socket.remoteAddress &&
|
||||
@@ -59,6 +69,12 @@ export function attachSocketServer(
|
||||
console.log('Client connected', clientAddress);
|
||||
numberOfConnectedClients++;
|
||||
|
||||
clearTimeout(browserConnectionTimeout);
|
||||
tracker.track('browser-connection-created', {
|
||||
successful: true,
|
||||
timeMS: performance.now() - t0,
|
||||
});
|
||||
|
||||
let connected = true;
|
||||
|
||||
let flipperServerCompanion: FlipperServerCompanion | undefined;
|
||||
|
||||
Reference in New Issue
Block a user