chore: fix telemetry run creation
This commit is contained in:
@@ -861,7 +861,7 @@ async function executeRun(id: string, userId: string, requestedFormats?: string[
|
||||
);
|
||||
}
|
||||
|
||||
capture("maxun-oss-run-created-api", {
|
||||
capture("maxun-oss-run-created", {
|
||||
runId: plainRun.runId,
|
||||
userId: userId,
|
||||
robotId: recording.recording_meta.id,
|
||||
|
||||
@@ -752,7 +752,9 @@ router.post("/sdk/crawl", requireAPIKey, async (req: AuthenticatedRequest, res:
|
||||
url: url,
|
||||
robotType: 'crawl',
|
||||
crawlConfig: crawlConfig,
|
||||
source: 'sdk'
|
||||
source: 'sdk',
|
||||
robot_meta: robot.recording_meta,
|
||||
recording: robot.recording,
|
||||
});
|
||||
|
||||
return res.status(201).json({
|
||||
@@ -846,7 +848,9 @@ router.post("/sdk/search", requireAPIKey, async (req: AuthenticatedRequest, res:
|
||||
searchQuery: searchConfig.query,
|
||||
searchProvider: searchConfig.provider || 'duckduckgo',
|
||||
searchLimit: searchConfig.limit || 10,
|
||||
source: 'sdk'
|
||||
source: 'sdk',
|
||||
robot_meta: robot.recording_meta,
|
||||
recording: robot.recording,
|
||||
});
|
||||
|
||||
return res.status(201).json({
|
||||
|
||||
@@ -349,12 +349,13 @@ async function processRunExecution(job: Job<ExecuteRunData>) {
|
||||
logger.log('warn', `Failed to send webhooks for markdown robot run ${data.runId}: ${webhookError.message}`);
|
||||
}
|
||||
|
||||
capture("maxun-oss-run-created-manual", {
|
||||
capture("maxun-oss-run-created", {
|
||||
runId: data.runId,
|
||||
user_id: data.userId,
|
||||
status: "success",
|
||||
robot_type: "scrape",
|
||||
formats,
|
||||
source: "manual"
|
||||
});
|
||||
|
||||
await destroyRemoteBrowser(browserId, data.userId);
|
||||
@@ -385,12 +386,13 @@ async function processRunExecution(job: Job<ExecuteRunData>) {
|
||||
logger.log('warn', `Failed to send run-failed notification for markdown robot run ${data.runId}: ${socketError.message}`);
|
||||
}
|
||||
|
||||
capture("maxun-oss-run-created-manual", {
|
||||
capture("maxun-oss-run-created", {
|
||||
runId: data.runId,
|
||||
user_id: data.userId,
|
||||
status: "failed",
|
||||
robot_type: "scrape",
|
||||
formats,
|
||||
source: "manual"
|
||||
});
|
||||
|
||||
await destroyRemoteBrowser(browserId, data.userId);
|
||||
@@ -523,7 +525,7 @@ async function processRunExecution(job: Job<ExecuteRunData>) {
|
||||
|
||||
// Capture metrics
|
||||
capture(
|
||||
'maxun-oss-run-created-manual',
|
||||
'maxun-oss-run-created',
|
||||
{
|
||||
runId: data.runId,
|
||||
user_id: data.userId,
|
||||
@@ -534,6 +536,7 @@ async function processRunExecution(job: Job<ExecuteRunData>) {
|
||||
listItemsExtracted: totalListItemsExtracted,
|
||||
extractedScreenshotsCount,
|
||||
is_llm: (recording.recording_meta as any).isLLM,
|
||||
source: 'manual'
|
||||
}
|
||||
);
|
||||
|
||||
@@ -693,7 +696,7 @@ async function processRunExecution(job: Job<ExecuteRunData>) {
|
||||
logger.log('warn', `Failed to emit failure event in main catch: ${socketError.message}`);
|
||||
}
|
||||
|
||||
capture('maxun-oss-run-created-manual', {
|
||||
capture('maxun-oss-run-created', {
|
||||
runId: data.runId,
|
||||
user_id: data.userId,
|
||||
created_at: new Date().toISOString(),
|
||||
@@ -702,6 +705,7 @@ async function processRunExecution(job: Job<ExecuteRunData>) {
|
||||
partial_data_extracted: partialDataExtracted,
|
||||
totalRowsExtracted: partialData?.totalSchemaItemsExtracted + partialData?.totalListItemsExtracted + partialData?.extractedScreenshotsCount || 0,
|
||||
is_llm: (recording?.recording_meta as any)?.isLLM,
|
||||
source: 'manual'
|
||||
});
|
||||
|
||||
try {
|
||||
|
||||
@@ -886,13 +886,14 @@ router.post('/runs/run/:id', requireSignIn, async (req: AuthenticatedRequest, re
|
||||
}
|
||||
logger.log('info', `Error while running a robot with id: ${req.params.id} - ${message}`);
|
||||
capture(
|
||||
'maxun-oss-run-created-manual',
|
||||
'maxun-oss-run-created',
|
||||
{
|
||||
runId: req.params.id,
|
||||
user_id: req.user?.id,
|
||||
created_at: new Date().toISOString(),
|
||||
status: 'failed',
|
||||
error_message: message,
|
||||
source: 'manual'
|
||||
}
|
||||
);
|
||||
return res.send(false);
|
||||
@@ -1407,7 +1408,9 @@ router.post('/recordings/crawl', requireSignIn, async (req: AuthenticatedRequest
|
||||
robotName: robotName,
|
||||
url: url,
|
||||
robotType: 'crawl',
|
||||
crawlConfig: crawlConfig
|
||||
crawlConfig: crawlConfig,
|
||||
robot_meta: newRobot.recording_meta,
|
||||
recording: newRobot.recording,
|
||||
});
|
||||
|
||||
return res.status(201).json({
|
||||
@@ -1493,7 +1496,9 @@ router.post('/recordings/search', requireSignIn, async (req: AuthenticatedReques
|
||||
robotType: 'search',
|
||||
searchQuery: searchConfig.query,
|
||||
searchProvider: searchConfig.provider || 'duckduckgo',
|
||||
searchLimit: searchConfig.limit || 10
|
||||
searchLimit: searchConfig.limit || 10,
|
||||
robot_meta: newRobot.recording_meta,
|
||||
recording: newRobot.recording,
|
||||
});
|
||||
|
||||
return res.status(201).json({
|
||||
|
||||
@@ -390,12 +390,13 @@ async function executeRun(id: string, userId: string) {
|
||||
);
|
||||
}
|
||||
|
||||
capture("maxun-oss-run-created-scheduled", {
|
||||
capture("maxun-oss-run-created", {
|
||||
runId: plainRun.runId,
|
||||
user_id: userId,
|
||||
status: "success",
|
||||
robot_type: "scrape",
|
||||
formats
|
||||
formats,
|
||||
source: "scheduled"
|
||||
});
|
||||
|
||||
await destroyRemoteBrowser(plainRun.browserId, userId);
|
||||
@@ -429,12 +430,13 @@ async function executeRun(id: string, userId: string) {
|
||||
);
|
||||
}
|
||||
|
||||
capture("maxun-oss-run-created-scheduled", {
|
||||
capture("maxun-oss-run-created", {
|
||||
runId: plainRun.runId,
|
||||
user_id: userId,
|
||||
status: "failed",
|
||||
robot_type: "scrape",
|
||||
formats
|
||||
formats,
|
||||
source: "scheduled"
|
||||
});
|
||||
|
||||
await destroyRemoteBrowser(plainRun.browserId, userId);
|
||||
@@ -529,7 +531,7 @@ async function executeRun(id: string, userId: string) {
|
||||
const totalRowsExtracted = totalSchemaItemsExtracted + totalListItemsExtracted;
|
||||
|
||||
capture(
|
||||
'maxun-oss-run-created-scheduled',
|
||||
'maxun-oss-run-created',
|
||||
{
|
||||
runId: id,
|
||||
created_at: new Date().toISOString(),
|
||||
@@ -539,6 +541,7 @@ async function executeRun(id: string, userId: string) {
|
||||
listItemsExtracted: totalListItemsExtracted,
|
||||
extractedScreenshotsCount,
|
||||
is_llm: (recording.recording_meta as any).isLLM,
|
||||
source: 'scheduled'
|
||||
}
|
||||
);
|
||||
|
||||
@@ -656,12 +659,13 @@ async function executeRun(id: string, userId: string) {
|
||||
logger.log('warn', `Failed to emit failure event in main catch: ${socketError.message}`);
|
||||
}
|
||||
capture(
|
||||
'maxun-oss-run-created-scheduled',
|
||||
'maxun-oss-run-created',
|
||||
{
|
||||
runId: id,
|
||||
created_at: new Date().toISOString(),
|
||||
status: 'failed',
|
||||
is_llm: (recording?.recording_meta as any)?.isLLM,
|
||||
source: 'scheduled'
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user