Reporting Heartbeats via your AppSignal Integration

AppSignal for RubyThis feature requires version 3.7.0 or higher.
AppSignal for ElixirThis feature requires version 2.10.0 or higher.
AppSignal for Node.jsThis feature requires version 3.4.0 or higher.
AppSignal for PythonThis feature requires version 1.3.0 or higher.

The Heartbeats feature is currently only available to Beta Testers. If you think your application is a good candidate, send an email to support@appsignal.com!

AppSignal offers helper methods/functions that send heartbeats automatically with the following integrations:

This documentation will explain how you can use AppSignal's helpers to send heartbeats from your app's processes.

Heartbeat types

Our helpers allow you to monitor background processes by sending AppSignal Start and Finish heartbeats:

  • Start Heartbeat notify AppSignal that a process has started, its status will be updated to Running.
  • Finish Heartbeat notify AppSignal that a process has been completed, its status will be updated to:
    • Success: if the process is completed within the Heartbeat's maximum job duration.
    • Late: if the process completes after the pre-defined maximum job duration.

Monitoring options

You can use AppSignal's helpers to either:

  • Send a single Finish Heartbeat to notify AppSignal when a process is completed.
  • Send two separate heartbeats: a Start Heartbeat to signal the start of a process and a Finish Heartbeat to signal its completion to AppSignal.

When sending both a Start and Finish Heartbeat AppSignal can report the actual run time of the process being monitored.

Send Finish Heartbeats

To send a Finish Heartbeat execute the heartbeat helper function at the end of the process you are monitoring.

The heartbeat helper requires you to pass the name of the heartbeat you are monitoring, as it's defined in AppSignal.

For example, when sending a Finish Heartbeat from a process, with the Heartbeat name of send_invoices:

elixir
nodejs
python
ruby
elixir
def send_invoices do # ... your code here ... Appsignal.heartbeat("send_invoices") end
javascript
// Don't forget to import the `heartbeat` helper function: import { heartbeat } from "@appsignal/nodejs"; function sendInvoices() { // ... your code here ... heartbeat("send_invoices"); }
python
# Don't forget to import the `heartbeat` helper function from appsignal import heartbeat def send_invoices(): # ... your code here ... heartbeat("send_invoices")
ruby
def send_invoices # ... your code here ... Appsignal.heartbeat("send_invoices") end

Send Start and Finish Heartbeats

Depending on your programming language you can pass either a function or block to the heartbeat helper to report when the process starts and finishes, allowing you to see the process duration.

elixir
nodejs
python
ruby
elixir
def send_invoices do Appsignal.heartbeat("send_invoices", fn -> # ... your code here ... end) end
javascript
// Don't forget to import the `heartbeat` helper function. import { heartbeat } from "@appsignal/nodejs"; function sendInvoices() { heartbeat("send_invoices", () => { // ... your code here ... }); } // If the function passed to `heartbeat` returns a promise, the finish event will be reported to AppSignal if the promise resolves allowing you to track the duration of async functions: import { heartbeat } from "@appsignal/nodejs"; async function sendInvoices() { await heartbeat("send_invoices", async () => { // ... your async code here ... }); } // If the promise is rejected, or if it never resolves, the finish event will not be reported to AppSignal.
python
# Don't forget to import the `heartbeat` helper function. from appsignal import heartbeat def send_invoices(): # ... your code here ... heartbeat("send_invoices", send_invoices)
ruby
def send_invoices() Appsignal.heartbeat("send_invoices") do # ... your code here ... end end

Exceptions

If an exception is raised within the function or method being monitored, the finish event will not be reported to AppSignal, triggering a missing heartbeat notification.

If the process from where the exception is raised is an AppSignal supported integration then an exception will be reported to AppSignal independently from the heartbeat:

Reviewing heartbeats occurrences in AppSignal

Once configured AppSignal will begin to display occurrences information for your heartbeats.

You can read more about occurrences in our Heartbeat Occurrences documentation.