We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1db5492 commit 27fd89fCopy full SHA for 27fd89f
src/lib/request/index.ts
@@ -1,11 +1,14 @@
1
import request = require('./request');
2
import alerts = require('../alerts');
3
+import { MetricsCollector } from '../metrics';
4
5
// A hybrid async function: both returns a promise and takes a callback
6
export = async (
7
payload: any,
8
callback?: (err: Error | null, res?, body?) => void,
9
) => {
10
+ const totalNetworkTimeTimer = MetricsCollector.NETWORK_TIME.createInstance();
11
+ totalNetworkTimeTimer.start();
12
try {
13
const result = await request(payload);
14
if (result.body.alerts) {
@@ -21,5 +24,7 @@ export = async (
21
24
return callback(error);
22
25
}
23
26
throw error;
27
+ } finally {
28
+ totalNetworkTimeTimer.stop();
29
30
};
0 commit comments