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:
Lorenzo Blasa
2023-05-26 08:02:12 -07:00
committed by Facebook GitHub Bot
parent 8aed5cfb9c
commit 694f6f284e
2 changed files with 47 additions and 6 deletions

View 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();