Skip to content

Commit 4264fc0

Browse files
authored
chore(webapp): More false errors turned to logs (#2422)
* Remove variables from dequeue log message * Continue snapshot throw json * Waiting for deploy error removed * Realtime ECONNRESET is expected * Redis worker logErrors changes, removed ids * Preview branch without a branch shouldn't log an error, it's a user provided issue * "Task run is not in a cancellable state" isn't an error, it's expected * "CreateCheckpointService: Child run already resumed" is expected * "CreateCheckpointService: Batch already resumed" is expected * "Failed to insert events, will attempt bisection" changed to info, we have errors for complete failures * Ignore "PrismaClient error" * Don't log Redis worker DLQ errors if we're ignoring * "Failed to parse machine config" is fine, sometimes a config is null or undefined * "Failed to parse machine config" for v3 * MetadataTooLargeError shouldn't log an error
1 parent da79c2b commit 4264fc0

16 files changed

+99
-40
lines changed

apps/webapp/app/db.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ function getClient() {
201201
message: log.message,
202202
target: log.target,
203203
},
204+
ignoreError: true,
204205
});
205206
});
206207
}

apps/webapp/app/models/runtimeEnvironment.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export async function findEnvironmentByApiKey(
3737

3838
if (environment.type === "PREVIEW") {
3939
if (!branchName) {
40-
logger.error("findEnvironmentByApiKey(): Preview env with no branch name provided", {
40+
logger.warn("findEnvironmentByApiKey(): Preview env with no branch name provided", {
4141
environmentId: environment.id,
4242
});
4343
return null;

apps/webapp/app/routes/engine.v1.worker-actions.runs.$runFriendlyId.snapshots.$snapshotFriendlyId.continue.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ export const loader = createLoaderWorkerApiRoute(
2727

2828
return json(continuationResult);
2929
} catch (error) {
30-
logger.error("Failed to suspend run", { runFriendlyId, snapshotFriendlyId, error });
31-
throw error;
30+
logger.warn("Failed to suspend run", { runFriendlyId, snapshotFriendlyId, error });
31+
if (error instanceof Error) {
32+
throw json({ error: error.message }, { status: 422 });
33+
}
34+
35+
throw json({ error: "Failed to continue run execution" }, { status: 422 });
3236
}
3337
}
3438
);

apps/webapp/app/services/realtime/redisRealtimeStreams.server.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,15 @@ export class RedisRealtimeStreams implements StreamIngestor, StreamResponder {
184184

185185
return new Response(null, { status: 200 });
186186
} catch (error) {
187+
if (error instanceof Error) {
188+
if ("code" in error && error.code === "ECONNRESET") {
189+
logger.info("[RealtimeStreams][ingestData] Connection reset during ingestData:", {
190+
error,
191+
});
192+
return new Response(null, { status: 500 });
193+
}
194+
}
195+
187196
logger.error("[RealtimeStreams][ingestData] Error in ingestData:", { error });
188197

189198
return new Response(null, { status: 500 });

apps/webapp/app/v3/alertsWorker.server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function initializeWorker() {
3333
retry: {
3434
maxAttempts: 3,
3535
},
36+
logErrors: false,
3637
},
3738
"v3.performDeploymentAlerts": {
3839
schema: z.object({
@@ -42,6 +43,7 @@ function initializeWorker() {
4243
retry: {
4344
maxAttempts: 3,
4445
},
46+
logErrors: false,
4547
},
4648
"v3.deliverAlert": {
4749
schema: z.object({
@@ -51,6 +53,7 @@ function initializeWorker() {
5153
retry: {
5254
maxAttempts: 3,
5355
},
56+
logErrors: false,
5457
},
5558
},
5659
concurrency: {

apps/webapp/app/v3/eventRepository.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ export class EventRepository {
12461246
span.setAttribute("prisma_error_code", errorDetails.code);
12471247
}
12481248

1249-
logger.error("Failed to insert events, will attempt bisection", {
1249+
logger.info("Failed to insert events, will attempt bisection", {
12501250
error: errorDetails,
12511251
});
12521252

apps/webapp/app/v3/machinePresets.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function machinePresetFromConfig(config: unknown): MachinePreset {
66
const parsedConfig = MachineConfig.safeParse(config);
77

88
if (!parsedConfig.success) {
9-
logger.error("Failed to parse machine config", { config });
9+
logger.info("Failed to parse machine config", { config });
1010

1111
return machinePresetFromName("small-1x");
1212
}

apps/webapp/app/v3/marqs/sharedQueueConsumer.server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,8 @@ export class SharedQueueConsumer {
621621
const worker = deployment?.worker;
622622

623623
if (!deployment || !worker) {
624-
logger.error("No matching deployment found for task run", {
624+
// This happens when a run is "WAITING_FOR_DEPLOY" and is expected
625+
logger.info("No matching deployment found for task run", {
625626
queueMessage: message.data,
626627
messageId: message.messageId,
627628
});

apps/webapp/app/v3/runEngineHandlers.server.ts

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { updateMetadataService } from "~/services/metadata/updateMetadataInstanc
1717
import { findEnvironmentFromRun } from "~/models/runtimeEnvironment.server";
1818
import { env } from "~/env.server";
1919
import { getTaskEventStoreTableForRun } from "./taskEventStore.server";
20+
import { MetadataTooLargeError } from "~/utils/packets";
2021

2122
export function registerRunEngineEventBusHandlers() {
2223
engine.eventBus.on("runSucceeded", async ({ time, run }) => {
@@ -381,17 +382,31 @@ export function registerRunEngineEventBusHandlers() {
381382
try {
382383
await updateMetadataService.call(run.id, run.metadata, env);
383384
} catch (e) {
384-
logger.error("[runMetadataUpdated] Failed to update metadata", {
385-
taskRun: run.id,
386-
error:
387-
e instanceof Error
388-
? {
389-
name: e.name,
390-
message: e.message,
391-
stack: e.stack,
392-
}
393-
: e,
394-
});
385+
if (e instanceof MetadataTooLargeError) {
386+
logger.warn("[runMetadataUpdated] Failed to update metadata, too large", {
387+
taskRun: run.id,
388+
error:
389+
e instanceof Error
390+
? {
391+
name: e.name,
392+
message: e.message,
393+
stack: e.stack,
394+
}
395+
: e,
396+
});
397+
} else {
398+
logger.error("[runMetadataUpdated] Failed to update metadata", {
399+
taskRun: run.id,
400+
error:
401+
e instanceof Error
402+
? {
403+
name: e.name,
404+
message: e.message,
405+
stack: e.stack,
406+
}
407+
: e,
408+
});
409+
}
395410
}
396411
});
397412

apps/webapp/app/v3/services/alerts/deliverAlert.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ export class DeliverAlertService extends BaseService {
926926
});
927927

928928
if (!response.ok) {
929-
logger.error("[DeliverAlert] Failed to send alert webhook", {
929+
logger.info("[DeliverAlert] Failed to send alert webhook", {
930930
status: response.status,
931931
statusText: response.statusText,
932932
url: webhook.url,

0 commit comments

Comments
 (0)