Monitor TypeScript Cron Jobs

Learn how to monitor TypeScript scheduled tasks with full type safety using the official Spanwise SDK.

Features

  • Full TypeScript support with exported types
  • Built-in wrap() helper for automatic lifecycle
  • Zero-config retry and timeout handling
  • Works with all Node.js schedulers

Code Examples

SDK with wrap()
import { Spanwise } from 'spanwise';
import cron from 'node-cron';

const spanwise = new Spanwise({
  apiKey: process.env.HASPULSE_API_KEY!
});

// wrap() automatically sends start/success/fail
cron.schedule('*/5 * * * *', async () => {
  await spanwise.wrap('YOUR_CHECK_ID', async () => {
    await processQueue();
  });
});
SDK manual ping
import { Spanwise, type PingOptions } from 'spanwise';

const spanwise = new Spanwise({
  apiKey: process.env.HASPULSE_API_KEY!
});

// Full control with type-safe options
await spanwise.ping('YOUR_CHECK_ID', { type: 'start' });

try {
  const result = await processQueue();
  await spanwise.ping('YOUR_CHECK_ID'); // success
  return result;
} catch (error) {
  await spanwise.ping('YOUR_CHECK_ID', { type: 'fail' });
  throw error;
}

How It Works

  1. 1
    Create a check in Spanwise
    Set your expected schedule (e.g., every 5 minutes)
  2. 2
    Add the ping to your code
    Ping the unique URL when your job runs successfully
  3. 3
    Get alerted on failures
    If a ping doesn't arrive on time, we notify you

Related Integrations

Start monitoring in minutes

Create your first check and start receiving alerts when your scheduled jobs fail.

Get started free