← Changelog

Heartbeat check-ins and other improvements

Sep 26, 2024
Node.js3.5.0

Added

  • Add support for heartbeat check-ins.

    Use the checkIn.heartbeat method to send a single heartbeat check-in event from your application. This can be used, for example, in your application's main loop:

    JavaScript
    import { checkIn } from "@appsignal/nodejs";
     
    while (true) {
      checkIn.heartbeat("job_processor");
      await processJob();
    }

    Heartbeats are deduplicated and sent asynchronously, without blocking the current thread. Regardless of how often the .heartbeat method is called, at most one heartbeat with the same identifier will be sent every ten seconds.

    Pass {continuous: true} as the second argument to send heartbeats continuously during the entire lifetime of the current process. This can be used, for example, after your application has finished its boot process:

    JavaScript
    import { checkIn } from "@appsignal/nodejs";
     
    function main() {
      checkIn.heartbeat("job_processor", { continuous: true });
      startApp();
    }

Changed

  • Send check-ins concurrently. When calling Appsignal.checkIn.cron, instead of blocking the current process while the check-in events are sent, schedule them to be sent in a separate process.
  • Do not block Node.js shutdown. It is no longer necessary to call Appsignal.stop for the Node.js engine to allow itself to shut down. It should still be called and awaited in production scenarios and at the end of scripts, as it ensures that scheduled check-ins are delivered.

View the Node.js package v3.5.0 changelog for more information.

$appsignal install

Make your next crash make sense.

Free for 30 days. No credit card. Two-minute install.