Skip to content

Conversation

@unflxw
Copy link
Contributor

@unflxw unflxw commented Sep 13, 2024

Part of https://github.com/appsignal/integration-guide/issues/169.

Add an Appsignal.CheckIn.heartbeat helper that emits a single heartbeat for the check-in identifier given.

When called with continuous: true as the second argument, it starts and links a separate Elixir process that emits a heartbeat every thirty seconds.

Unlike the equivalent functionality in the Ruby integration, which spawns a thread that will stay alive for the lifetime of the Ruby process, the Elixir process is linked to the process that spawned it, meaning it will be shut down when its parent process is shut down. This allows it to be used to track the lifetime of individual Elixir processes.

Additionally, it is also possible to add Appsignal.CheckIn.Heartbeat as a child process to a supervisor, meaning its lifetime will be tied to that of the other processes supervised by it.

Finally, the functionality seen in the Ruby integration could also be achieved by manually calling Appsignal.CheckIn.Heartbeat.start/1, keeping the process unlinked and therefore alive for the entirety of the Elixir node's lifetime, though this is unlikely to be the preferred usage under the Elixir process model.

@unflxw unflxw added the feature A new feature for this component. label Sep 13, 2024
@unflxw unflxw self-assigned this Sep 13, 2024
@unflxw unflxw force-pushed the implement-heartbeat-checkins branch from 6eed79d to 60d6f99 Compare September 13, 2024 12:53
Add an `Appsignal.CheckIn.heartbeat` helper that emits a single
heartbeat for the check-in identifier given.

When called with `continuous: true` as the second argument, it
starts and links a separate Elixir process that emits a heartbeat
every thirty seconds.

Unlike the equivalent functionality in the Ruby integration, which
spawns a thread that will stay alive for the lifetime of the Ruby
process, the Elixir process is linked to the process that spawned
it, meaning it will be shut down when its parent process is shut
down. This allows it to be used to track the lifetime of individual
Elixir processes.

Additionally, it is also possible to add `Appsignal.CheckIn.Heartbeat`
as a child process to a supervisor, meaning its lifetime will be tied
to that of the other processes supervised by it.

Finally, the functionality seen in the Ruby integration could also be
achieved by manually calling `Appsignal.CheckIn.Heartbeat.start/1`,
keeping the process unlinked and therefore alive for the entirety of
the Elixir node's lifetime, though this is unlikely to be the
preferred usage under the Elixir process model.
@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

6 similar comments
@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper
Copy link


This is a message from the daily scheduled checks.

New issue guide | Backlog management | Rules | Feedback

@unflxw unflxw merged commit ea5fd25 into main Sep 26, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature for this component.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants