Sending check-in events using the AppSignal integrations

The AppSignal integrations for Ruby, Elixir, Node.js and Python offer helper methods and functions that allow you to easily send check-in events to AppSignal.

Cron check-in events

This feature requires AppSignal for Ruby version 3.13.0 or higher.
This feature requires AppSignal for Elixir version 2.12.2 or higher.
This feature requires AppSignal for Node.js version 3.4.9 or higher.
This feature requires AppSignal for Python version 1.3.8 or higher.

To notify AppSignal that a cron job has finished successfully, use the cron helper function, passing the name of the cron check-in as an argument.

Ruby
def send_invoices # ... your code here ... Appsignal::CheckIn.cron("send_invoices") end

It is safe to call the cron helper function many times in a short period, as the helper will only send a finish event to AppSignal at most once every ten seconds.

Monitoring the job's duration

To monitor the duration of a cron job, you can use the cron helper function with a block or function that contains the code you want to monitor. This will send events to AppSignal both when the job starts and when it finishes.

Ruby
def send_invoices() Appsignal::CheckIn.cron("send_invoices") do # ... your code here ... end end

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

If the context in which the exception is raised is an AppSignal-monitored context, then the exception will be reported to AppSignal. Otherwise, if you wish to report the exception to AppSignal, you can use our exception handling helpers for Ruby, Elixir, Node.js or Python.

Heartbeat check-in events

This feature requires AppSignal for Ruby version 4.1.0 or higher.
This feature requires AppSignal for Elixir version 2.13.0 or higher.
This feature requires AppSignal for Node.js version 3.5.0 or higher.
This feature requires AppSignal for Python version 1.4.0 or higher.

To send a heartbeat check-in event to AppSignal, use the heartbeat helper function, passing the name of the heartbeat check-in as an argument.

It is safe to call heartbeat many times, as the helper will only send a heartbeat event to AppSignal at most every ten seconds.

Ruby
loop do Appsignal::CheckIn.heartbeat("job_processor") # ... your code here ... end

Sending heartbeats continuously

To send heartbeat check-ins continuously, you can pass the { continuous: true } option to the heartbeat helper function. This is useful to monitor the lifetime of the process itself. The helper will send a heartbeat event to AppSignal every thirty seconds.

Ruby
Appsignal::CheckIn.heartbeat("job_processor", continuous: true)

Reviewing check-in occurrences in AppSignal

Once configured, AppSignal will begin to display information about occurrences for your check-ins.

You can read more about occurrences in our Check-in occurrences documentation.