Skip to content

Open-source status page, incident response and uptime monitoring

🚑 otel

Thibault Le Ouay4f8bf68f261f
diff --git a/apps/web/src/app/api/checker/cron/_cron.ts b/apps/web/src/app/api/checker/cron/_cron.ts
index a55914870..559f3ccf2 100644
--- a/apps/web/src/app/api/checker/cron/_cron.ts
+++ b/apps/web/src/app/api/checker/cron/_cron.ts
@@ -45,7 +45,7 @@ export const cron = async ({
const parent = client.queuePath(
env.GCP_PROJECT_ID,
env.GCP_LOCATION,
- periodicity,
+ periodicity
);
const timestamp = Date.now();
@@ -54,7 +54,7 @@ export const cron = async ({
.select({ id: maintenance.id })
.from(maintenance)
.where(
- and(lte(maintenance.from, new Date()), gte(maintenance.to, new Date())),
+ and(lte(maintenance.from, new Date()), gte(maintenance.to, new Date()))
)
.as("currentMaintenance");
@@ -63,7 +63,7 @@ export const cron = async ({
.from(maintenancesToMonitors)
.innerJoin(
currentMaintenance,
- eq(maintenancesToMonitors.maintenanceId, currentMaintenance.id),
+ eq(maintenancesToMonitors.maintenanceId, currentMaintenance.id)
);
const result = await db
@@ -73,8 +73,8 @@ export const cron = async ({
and(
eq(monitor.periodicity, periodicity),
eq(monitor.active, true),
- notInArray(monitor.id, currentMaintenanceMonitors),
- ),
+ notInArray(monitor.id, currentMaintenanceMonitors)
+ )
)
.all();
@@ -98,7 +98,7 @@ export const cron = async ({
const monitorStatus = z.array(selectMonitorStatusSchema).safeParse(result);
if (!monitorStatus.success) {
console.error(
- `Error while fetching the monitor status ${monitorStatus.error.errors}`,
+ `Error while fetching the monitor status ${monitorStatus.error.errors}`
);
continue;
}
@@ -137,7 +137,7 @@ export const cron = async ({
const failed = allRequests.filter((r) => r.status === "rejected").length;
console.log(
- `End cron for ${periodicity} with ${allResult.length} jobs with ${success} success and ${failed} failed`,
+ `End cron for ${periodicity} with ${allResult.length} jobs with ${success} success and ${failed} failed`
);
};
// timestamp needs to be in ms
@@ -176,7 +176,10 @@ const createCronTask = async ({
timeout: row.timeout,
trigger: "cron",
otelConfig: row.otelEndpoint
- ? { endpoint: row.otelEndpoint, headers: row.otelHeaders }
+ ? {
+ endpoint: row.otelEndpoint,
+ headers: JSON.parse(row.otelHeaders || ""),
+ }
: undefined,
};
}
@@ -192,7 +195,10 @@ const createCronTask = async ({
timeout: row.timeout,
trigger: "cron",
otelConfig: row.otelEndpoint
- ? { endpoint: row.otelEndpoint, headers: row.otelHeaders }
+ ? {
+ endpoint: row.otelEndpoint,
+ headers: JSON.parse(row.otelHeaders || ""),
+ }
: undefined,
};
}