From 542a99d23a4998b64c7b91941d88a5ea3b6959a8 Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Fri, 17 Apr 2026 19:16:13 +0200 Subject: [PATCH] refactor: use console.info for log consistency and clean up deprecated code --- README.md | 14 +------------- src/aggregation.ts | 2 +- src/index.ts | 8 ++++---- src/processor/maintenance-import.ts | 2 -- src/regional/checker.ts | 2 +- status-page/src/components/MonitorCard.astro | 2 -- 6 files changed, 7 insertions(+), 23 deletions(-) delete mode 100644 src/processor/maintenance-import.ts diff --git a/README.md b/README.md index b8e49a3..84ac4c1 100644 --- a/README.md +++ b/README.md @@ -159,18 +159,6 @@ You can configure scheduled maintenance windows for individual monitors, suspend **Syntax** Each monitor supports a `maintenance` array, with one or more objects specifying a `start` and `end` timestamp in UTC ISO8601 format. -```yaml -- name: 'web-api' - type: http - target: 'https://example.com/health' - maintenance: - - start: '2026-05-10T23:00:00Z' - end: '2026-05-11T01:00:00Z' - - start: '2026-06-01T02:00:00Z' - end: '2026-06-01T03:30:00Z' - alerts: ['default'] -``` - **Behavior** - At any time when `now` (UTC) is within a window, the monitor is shown as "maintenance": @@ -411,7 +399,7 @@ npm run check:pages # pages (astro check + tsc) - [ ] Add support for TLS checks (certificate validity, expiration). Apparently, the Workers API does not support certificate data access, even at the socket level. An external service may be required. - [ ] Refine the status page to look... well... less IA generated. -- [x] Per-monitor maintenance windows (docs and config example added) +- [x] Per-monitor maintenance windows - [ ] Initial support for incident management (manual status overrides, incident timeline). - [x] Branded status page (simple custom banner). - [ ] Add support for notifications other than webhooks. diff --git a/src/aggregation.ts b/src/aggregation.ts index 3eeb27f..9657a98 100644 --- a/src/aggregation.ts +++ b/src/aggregation.ts @@ -32,7 +32,7 @@ export async function handleAggregation(env: Env): Promise { await deleteOldRawData(env.DB, now); await deleteOldHourlyData(env.DB, now); - console.warn( + console.info( JSON.stringify({ event: 'aggregation_complete', hour: new Date(hourStart * 1000).toISOString(), diff --git a/src/index.ts b/src/index.ts index 29fd863..3fc8db2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -131,7 +131,7 @@ const worker = { }) ); - console.warn( + console.info( JSON.stringify({ event: 'scheduled_complete', checks: checks.length, @@ -161,7 +161,7 @@ async function executeCheck(check: CheckRequest, env: Env): Promise // If region is specified and we have Durable Object binding, run check from that region if (check.region && env.REGIONAL_CHECKER_DO) { try { - console.warn( + console.info( JSON.stringify({ event: 'regional_check_start', monitor: check.name, region: check.region }) ); @@ -186,7 +186,7 @@ async function executeCheck(check: CheckRequest, env: Env): Promise // Ignore kill errors - Durable Object will be garbage collected } - console.warn( + console.info( JSON.stringify({ event: 'regional_check_complete', monitor: check.name, @@ -216,7 +216,7 @@ async function executeCheck(check: CheckRequest, env: Env): Promise } async function executeLocalCheck(check: CheckRequest): Promise { - console.warn(JSON.stringify({ event: 'local_check_start', monitor: check.name })); + console.info(JSON.stringify({ event: 'local_check_start', monitor: check.name })); switch (check.type) { case 'http': { return executeHttpCheck(check); diff --git a/src/processor/maintenance-import.ts b/src/processor/maintenance-import.ts deleted file mode 100644 index ff0eb60..0000000 --- a/src/processor/maintenance-import.ts +++ /dev/null @@ -1,2 +0,0 @@ -// Temporary import for next edit -import { isInMaintenance } from '../utils/maintenance.js'; diff --git a/src/regional/checker.ts b/src/regional/checker.ts index 17a6a55..73e96e8 100644 --- a/src/regional/checker.ts +++ b/src/regional/checker.ts @@ -6,7 +6,7 @@ import type { CheckRequest, CheckResult } from '../types.js'; export class RegionalChecker extends DurableObject { async runCheck(check: CheckRequest): Promise { - console.warn(JSON.stringify({ event: 'regional_check_run', monitor: check.name })); + console.info(JSON.stringify({ event: 'regional_check_run', monitor: check.name })); try { // Execute the check locally in this Durable Object's region diff --git a/status-page/src/components/MonitorCard.astro b/status-page/src/components/MonitorCard.astro index bf010b7..f349b9e 100644 --- a/status-page/src/components/MonitorCard.astro +++ b/status-page/src/components/MonitorCard.astro @@ -1,7 +1,5 @@ --- import type { ApiMonitorStatus } from '@worker/types'; -// Allow maintenance as a valid runtime state: -type MonitorStatus = ApiMonitorStatus['status'] | 'maintenance'; import UptimeBars from './UptimeBars.astro'; interface Props {