Track state changes

Summary: Track server connectivity state changes, queries will follow.

Reviewed By: antonk52

Differential Revision: D50928297

fbshipit-source-id: 9f3a3b799481556bab7339d710736448fed6004c
This commit is contained in:
Lorenzo Blasa
2023-11-02 10:42:15 -07:00
committed by Facebook GitHub Bot
parent afae1bd141
commit 87cb9bd77a

View File

@@ -97,11 +97,18 @@ async function start() {
getLogger().info('[flipper-client][ui-browser] Create WS client');
let lastStateChangeMS = performance.now();
const flipperServer = await createFlipperServer(
location.hostname,
parseInt(location.port, 10),
tokenProvider,
(state: FlipperServerState) => {
const timestamp = performance.now();
getLogger().track('usage', 'browser-server-state-changed', {
state,
timeElapsedMS: timestamp - lastStateChangeMS,
});
lastStateChangeMS = timestamp;
switch (state) {
case FlipperServerState.CONNECTING:
getLogger().info('[flipper-client] Connecting to server');