Track session length
Differential Revision: D51172955 fbshipit-source-id: d4f93564a94e232066347c945fa4798033dc0da1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8ef29c8160
commit
6e19c4155c
@@ -28,6 +28,7 @@ import {
|
||||
import {URLSearchParams} from 'url';
|
||||
import {tracker} from '../tracker';
|
||||
import {getFlipperServerConfig} from '../FlipperServerConfig';
|
||||
import {performance} from 'perf_hooks';
|
||||
|
||||
const safe = (f: () => void) => {
|
||||
try {
|
||||
@@ -53,6 +54,8 @@ export function attachSocketServer(
|
||||
companionEnv: FlipperServerCompanionEnv,
|
||||
) {
|
||||
socket.on('connection', (client, req) => {
|
||||
const t0 = performance.now();
|
||||
|
||||
const clientAddress =
|
||||
(req.socket.remoteAddress &&
|
||||
` ${req.socket.remoteAddress}:${req.socket.remotePort}`) ||
|
||||
@@ -246,6 +249,7 @@ export function attachSocketServer(
|
||||
tracker.track('server-client-close', {
|
||||
code,
|
||||
error,
|
||||
sessionLength: performance.now() - t0,
|
||||
});
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user