-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1123 from appsignal/implement-heartbeat-checkins
Implement heartbeat check-ins
- Loading branch information
Showing
22 changed files
with
550 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
bump: minor | ||
type: add | ||
--- | ||
|
||
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: | ||
|
||
```js | ||
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: | ||
|
||
```js | ||
import { checkIn } from "@appsignal/nodejs" | ||
|
||
function main() { | ||
checkIn.heartbeat("job_processor", {continuous: true}) | ||
startApp() | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.