Try out success rate metric on processing CSRs

Summary:
This is semi-explorative to see how far we can get with this approach, but I think it'l be useful. If it is, we can factor the code into a nicer utility, that perhaps wraps promises or even just has succeeded/failed methods.

Using 1 and 0 instead of true and false so we can do numerical aggregates on it, like average, which will give the success rate.

This will allow queries such as:
* What percentage of attempts fail? - Not very useful because they get retried if they fail.
* What percentage of sessions that attempt, encounter a failure? - More useful, but still not perfect because they could retry and succeed.
* What percentage of sessions attempt and don't ever succeed? - Better but still not perfect because one device might succeed and another fail, but this will be rare.

Reviewed By: passy

Differential Revision: D13625987

fbshipit-source-id: 2b9f45cc888247d068cc52281443e9ece7985da8
This commit is contained in:
John Knox
2019-01-11 03:55:19 -08:00
committed by Facebook Github Bot
parent 005383f94b
commit 4a5dae8f4f
2 changed files with 11 additions and 1 deletions

View File

@@ -6,7 +6,7 @@
*/ */
export type LogTypes = 'error' | 'warn' | 'info' | 'debug'; export type LogTypes = 'error' | 'warn' | 'info' | 'debug';
export type TrackType = 'duration' | 'usage' | 'performance'; export type TrackType = 'duration' | 'usage' | 'performance' | 'success-rate';
import ScribeLogger from './ScribeLogger'; import ScribeLogger from './ScribeLogger';
export default class LogManager { export default class LogManager {

View File

@@ -190,10 +190,20 @@ export default class Server extends EventEmitter {
client, client,
deviceId: result.deviceId, deviceId: result.deviceId,
}); });
this.logger.track(
'success-rate',
'processCertificateSigningRequest',
1,
);
}) })
.catch(e => { .catch(e => {
subscriber.onError(e); subscriber.onError(e);
this.emit('client-setup-error', {client, error: e}); this.emit('client-setup-error', {client, error: e});
this.logger.track(
'success-rate',
'processCertificateSigningRequest',
0,
);
}); });
}); });
} }