Skip to content

Observability

Logging

Edge Worker logs various events to the stdin. You can change the log level by setting EDGE_WORKER_LOG_LEVEL environment variable:

supabase/functions/.env
EDGE_WORKER_LOG_LEVEL=debug

Available log levels are:

  • debug
  • info
  • error
  • (more will come)

By default, Edge Worker’s log level is info.

Heartbeats

Edge Worker sends heartbeats every 5 seconds and updates last_heartbeat_at column in edge_worker.workers table.

List of active workers

In order to get a list of active workers, we need to fetch those that have pinged in the last 6 seconds (+1s to account for delays):

SELECT *
FROM edge_worker.workers
WHERE last_heartbeat_at > now() - make_interval(secs => 6)

Helper SQL Views

Alterntively, use following SQL views to simplify those queries:

Active Workers

-- Active workers are workers that have sent a heartbeat in the last 6 seconds
create or replace view edge_worker.active_workers as
select
worker_id,
queue_name,
function_name,
started_at,
stopped_at,
last_heartbeat_at
from edge_worker.workers
where last_heartbeat_at > now() - make_interval(secs => 6);

Inactive Workers

-- Inactive workers are workers that have not sent
-- a heartbeat in the last 6 seconds
create or replace view edge_worker.inactive_workers as
select
worker_id,
queue_name,
function_name,
started_at,
stopped_at,
last_heartbeat_at
from edge_worker.workers
where last_heartbeat_at < now() - make_interval(secs => 6);