diff --git a/server/src/api/record.ts b/server/src/api/record.ts index cbf4f67e..7c665001 100644 --- a/server/src/api/record.ts +++ b/server/src/api/record.ts @@ -761,6 +761,14 @@ async function executeRun(id: string, userId: string, requestedFormats?: string[ ); } + capture("maxun-oss-run-created-api", { + runId: plainRun.runId, + user_id: userId, + status: "success", + robot_type: "scrape", + formats + }); + await destroyRemoteBrowser(plainRun.browserId, userId); return { @@ -800,6 +808,14 @@ async function executeRun(id: string, userId: string, requestedFormats?: string[ ); } + capture("maxun-oss-run-created-api", { + runId: plainRun.runId, + user_id: userId, + status: "failed", + robot_type: "scrape", + formats + }); + await destroyRemoteBrowser(plainRun.browserId, userId); throw error; diff --git a/server/src/pgboss-worker.ts b/server/src/pgboss-worker.ts index 66e852b8..f5d719b4 100644 --- a/server/src/pgboss-worker.ts +++ b/server/src/pgboss-worker.ts @@ -268,6 +268,14 @@ async function processRunExecution(job: Job) { logger.log('warn', `Failed to send webhooks for markdown robot run ${data.runId}: ${webhookError.message}`); } + capture("maxun-oss-run-created-manual", { + runId: data.runId, + user_id: data.userId, + status: "success", + robot_type: "scrape", + formats, + }); + await destroyRemoteBrowser(browserId, data.userId); return { success: true }; @@ -296,6 +304,14 @@ async function processRunExecution(job: Job) { logger.log('warn', `Failed to send run-failed notification for markdown robot run ${data.runId}: ${socketError.message}`); } + capture("maxun-oss-run-created-manual", { + runId: data.runId, + user_id: data.userId, + status: "failed", + robot_type: "scrape", + formats, + }); + await destroyRemoteBrowser(browserId, data.userId); throw error; diff --git a/server/src/routes/storage.ts b/server/src/routes/storage.ts index 44279e9c..8451c720 100644 --- a/server/src/routes/storage.ts +++ b/server/src/routes/storage.ts @@ -500,12 +500,12 @@ router.post('/recordings/scrape', requireSignIn, async (req: AuthenticatedReques logger.log('info', `Markdown robot created with id: ${newRobot.id}`); capture( - 'maxun-oss-markdown-robot-created', + 'maxun-oss-robot-created', { robot_meta: newRobot.recording_meta, - url: url, + recording: newRobot.recording, } - ); + ) return res.status(201).json({ message: 'Markdown robot created successfully.', diff --git a/server/src/workflow-management/scheduler/index.ts b/server/src/workflow-management/scheduler/index.ts index d5ba76f4..470cdacb 100644 --- a/server/src/workflow-management/scheduler/index.ts +++ b/server/src/workflow-management/scheduler/index.ts @@ -321,6 +321,14 @@ async function executeRun(id: string, userId: string) { ); } + capture("maxun-oss-run-created-scheduled", { + runId: plainRun.runId, + user_id: userId, + status: "success", + robot_type: "scrape", + formats + }); + await destroyRemoteBrowser(plainRun.browserId, userId); return true; @@ -352,6 +360,14 @@ async function executeRun(id: string, userId: string) { ); } + capture("maxun-oss-run-created-scheduled", { + runId: plainRun.runId, + user_id: userId, + status: "failed", + robot_type: "scrape", + formats + }); + await destroyRemoteBrowser(plainRun.browserId, userId); throw error;