Define a tracker interface and replace auth token tracking
Summary: Define the tracker interface and replace the existing authentication token verification tracking. Subsequent diffs will add analytics for remaining connectivity areas. Need to answer: - No tokens rate over time - Unable to verify tokens rate over time Reviewed By: antonk52 Differential Revision: D46219661 fbshipit-source-id: dfc41cae664bc1ef211d312990120111fca3808b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8aed5cfb9c
commit
694f6f284e
29
desktop/flipper-server-core/src/utils/tracker.tsx
Normal file
29
desktop/flipper-server-core/src/utils/tracker.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {getLogger} from 'flipper-common';
|
||||
|
||||
type TrackerEvents = {
|
||||
'server-auth-token-verification': {
|
||||
successful: boolean;
|
||||
present: boolean;
|
||||
error?: string;
|
||||
};
|
||||
};
|
||||
|
||||
class ServerCoreTracker {
|
||||
track<Event extends keyof TrackerEvents>(
|
||||
event: Event,
|
||||
payload: TrackerEvents[Event],
|
||||
): void {
|
||||
getLogger().track('usage', event, payload);
|
||||
}
|
||||
}
|
||||
|
||||
export const tracker = new ServerCoreTracker();
|
||||
Reference in New Issue
Block a user