Track CSR processing

Summary:
Need to answer:

- Certificate exchange success rate, fails and errors a day per OS and device type.

Reviewed By: antonk52

Differential Revision: D46221301

fbshipit-source-id: 03c6993aa15f56fdf98a7abd57d00b2af0e9ce1a
This commit is contained in:
Lorenzo Blasa
2023-05-26 08:02:12 -07:00
committed by Facebook GitHub Bot
parent f25591580c
commit 27909e8296
2 changed files with 18 additions and 3 deletions

View File

@@ -282,7 +282,6 @@ export class ServerController
this.timestamps.set(id, { this.timestamps.set(id, {
insecureStart: Date.now(), insecureStart: Date.now(),
}); });
this.logger.track('usage', 'untrusted-request-handler-called', clientQuery);
tracker.track('app-connection-insecure-attempt', clientQuery); tracker.track('app-connection-insecure-attempt', clientQuery);
@@ -302,7 +301,6 @@ export class ServerController
appDirectory: string, appDirectory: string,
medium: CertificateExchangeMedium, medium: CertificateExchangeMedium,
): Promise<{deviceId: string}> { ): Promise<{deviceId: string}> {
// TODO: track CSR processing.
let certificateProvider: CertificateProvider; let certificateProvider: CertificateProvider;
switch (clientQuery.os) { switch (clientQuery.os) {
case 'Android': { case 'Android': {
@@ -375,9 +373,20 @@ export class ServerController
}, 30 * 1000), }, 30 * 1000),
); );
tracker.track('app-connection-certificate-exchange', {
...clientQuery,
successful: true,
device_id: response.deviceId,
});
resolve(response); resolve(response);
}) })
.catch((error) => { .catch((error: Error) => {
tracker.track('app-connection-certificate-exchange', {
...clientQuery,
successful: false,
error: error.message,
});
reject(error); reject(error);
}); });
}); });

View File

@@ -17,6 +17,11 @@ type AppConnectionPayload = {
medium?: number | undefined; medium?: number | undefined;
}; };
type AppConnectionCertificateExchangePayload = AppConnectionPayload & {
successful: boolean;
error?: string;
};
type TrackerEvents = { type TrackerEvents = {
'server-started': {port: number; tcp: boolean}; 'server-started': {port: number; tcp: boolean};
'server-auth-token-verification': { 'server-auth-token-verification': {
@@ -29,6 +34,7 @@ type TrackerEvents = {
'app-connection-created': AppConnectionPayload; 'app-connection-created': AppConnectionPayload;
'app-connection-secure-attempt': AppConnectionPayload; 'app-connection-secure-attempt': AppConnectionPayload;
'app-connection-insecure-attempt': AppConnectionPayload; 'app-connection-insecure-attempt': AppConnectionPayload;
'app-connection-certificate-exchange': AppConnectionCertificateExchangePayload;
}; };
class ServerCoreTracker { class ServerCoreTracker {