refactor: use capture
This commit is contained in:
@@ -13,7 +13,7 @@ import { browserPool } from "../server";
|
|||||||
import { io, Socket } from "socket.io-client";
|
import { io, Socket } from "socket.io-client";
|
||||||
import { BinaryOutputService } from "../storage/mino";
|
import { BinaryOutputService } from "../storage/mino";
|
||||||
import { AuthenticatedRequest } from "../routes/record"
|
import { AuthenticatedRequest } from "../routes/record"
|
||||||
import captureServerAnalytics from "../utils/analytics";
|
import {capture} from "../utils/analytics";
|
||||||
|
|
||||||
const formatRecording = (recordingData: any) => {
|
const formatRecording = (recordingData: any) => {
|
||||||
const recordingMeta = recordingData.recording_meta;
|
const recordingMeta = recordingData.recording_meta;
|
||||||
@@ -565,10 +565,7 @@ async function executeRun(id: string) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
captureServerAnalytics.capture({
|
capture('maxun-oss-run-created-api',{
|
||||||
distinctId: id,
|
|
||||||
event: 'maxun-oss-run-created-api',
|
|
||||||
properties: {
|
|
||||||
runId: id,
|
runId: id,
|
||||||
created_at: new Date().toISOString(),
|
created_at: new Date().toISOString(),
|
||||||
status: 'success',
|
status: 'success',
|
||||||
@@ -576,7 +573,7 @@ async function executeRun(id: string) {
|
|||||||
extractedRowsCount: totalRowsExtracted,
|
extractedRowsCount: totalRowsExtracted,
|
||||||
extractedScreenshotsCount: updatedRun.dataValues.binaryOutput['item-0'].length,
|
extractedScreenshotsCount: updatedRun.dataValues.binaryOutput['item-0'].length,
|
||||||
}
|
}
|
||||||
})
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
@@ -592,15 +589,14 @@ async function executeRun(id: string) {
|
|||||||
finishedAt: new Date().toLocaleString(),
|
finishedAt: new Date().toLocaleString(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
captureServerAnalytics.capture({
|
capture(
|
||||||
distinctId: id,
|
'maxun-oss-run-created-api',
|
||||||
event: 'maxun-oss-run-created-api',
|
{
|
||||||
properties: {
|
|
||||||
runId: id,
|
runId: id,
|
||||||
created_at: new Date().toISOString(),
|
created_at: new Date().toISOString(),
|
||||||
status: 'failed',
|
status: 'failed',
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
return {
|
return {
|
||||||
success: false,
|
success: false,
|
||||||
error: error.message,
|
error: error.message,
|
||||||
|
|||||||
Reference in New Issue
Block a user