Features

Jobs and schedules

Background jobs as recorded runs, failures grouped into issues, and a notification when a scheduled job misses its run.

PeekInside records background jobs the way it records requests: each run, how long it took, how it ended, and everything it did (its queries, outgoing calls, log lines and exceptions, on a timeline). The Jobs page shows them three ways:

View What it shows
Runs Every run, live, with a chart of runs over time. A run opens beside the list: its error, data, exceptions, log lines, timeline, and the job's other recent runs
Jobs Each job (a name, in its queue): runs, failures, failure rate, p50 and p95 durations, its last run and its activity
Schedules Jobs that run on a schedule: on time, due, missed or failing, when each runs next, its latest runs and its alerts

Recorded without code changes#

Library What becomes a run
node-cron Each run of a task (cron.schedule(...)), with its cron expression
cron Each tick of a CronJob, with its cron expression
BullMQ Each job a Worker processes, with its queue, attempt and data; repeatable jobs with their schedule
@nestjs/schedule Each run of a @Cron, @Interval or @Timeout method, named after its class and method (ReportsService.sendDigest, or the name you gave it), with its cron expression or interval. A method that throws is a failed run: Nest's scheduler only logs the error, PeekInside records it

Name your node-cron tasks ({ name: 'send-invoices' }): a task without a name is listed by its schedule ("Daily at 20:00").

Finding runs#

The search box looks through the job's name, its queue, the error it failed with and the user (decrypted in your browser), and -word leaves runs out. Failed keeps the failed runs. Filters narrows by:

Filter Keeps runs
Trigger started by their schedule, a queue, or PeekInside.job()
Attempt on their first attempt, or retries
Duration at least as long as a preset, or between two durations
Started in the last 15 minutes up to the last 7 days; or click (or drag across) the chart's bars
Has that threw an exception, logged, ran queries, called out, or had a user
Environment, release, job, queue from the ones picked, each counted

Filters in force show as chips beside the button; a click removes one. The page's address keeps them, so a filtered page can be bookmarked or shared. Filters search the runs loaded (the newest 5,000 at most); Load older runs looks further back.

Any other job#

Wrap it in PeekInside.job(). The function runs exactly as it would without PeekInside: same result, same error thrown.

await PeekInside.job('send-invoices', () => sendInvoices(), {
  schedule: '0 * * * *',      // its cron expression: PeekInside tells you when it misses a run
  data: { batch: 42 }         // shown with the run (the first 8 KB)
});
Option Description
schedule Its cron expression (five fields, or six with seconds; @hourly, @daily; @every 5m)
timezone The schedule's time zone, such as Europe/Paris (UTC by default)
queue The queue it came from
attempt Which attempt this is
data The job's input

Failures are exceptions#

A run that throws (or rejects) is recorded as failed, and its error as an exception with mechanism job. Exceptions from jobs are grouped into issues with the others, so the same failure every night is one issue, with how many times it happened and in which release.

Scheduled jobs#

Jobs with a schedule are listed under Schedules: when they last ran, when they're due next, their latest runs, and their state:

State Meaning
On schedule The next run isn't due yet
Due The next run is due and hasn't arrived, within the grace period
Missed The run is overdue past the grace period (half the time between runs, from one minute to ten)
Last run failed It ran on time, and failed

With PeekInside Cloud, when a scheduled job misses its run, the members who read jobs get a notification in the app, once per miss, and another when it runs again. Those who want them by email too turn that on in their notification settings (with Pro and up); and a connected Slack channel gets a message, unless owners and admins keep job alerts out of it. The Jobs page can mute one job's alerts.

Missed runs are checked every minute, and whenever PeekInside receives data.

Time zones#

A schedule is read in its time zone: the one you gave the library (node-cron's timezone, cron's and @Cron's timeZone, BullMQ's tz), else your server's own, which is the one these libraries use without one. PeekInside.job() reads its schedule in UTC unless you pass timezone.

SDK versions before 1.2.5 didn't record the server's zone, so PeekInside read those schedules in UTC: a task that runs at 20:00 in Kolkata looked five and a half hours late. When a schedule's runs line up with another zone than the one it's read in, Schedules says so ("Its runs line up with UTC+05:30") and sets your zone in one click. Any zone can be set from a job's menu, and alerts follow it.

What PeekInside Cloud can read#

A job's name, queue and schedule are readable, like a request's method: the Jobs page groups by them and the alert check reads the schedule. So are when it ran, its duration, status and attempt. The error it failed with, the user, its data and its timeline are encrypted on your server, like requests. Keep secrets out of job names.

Turn automatic recording off with captureJobs: false; PeekInside.job() keeps working.