Skip to content

Commit ba0a4a9

Browse files
committed
Publish package v3.4.0
Update version number and CHANGELOG.md.
1 parent 7edf312 commit ba0a4a9

File tree

5 files changed

+88
-95
lines changed

5 files changed

+88
-95
lines changed

.changesets/add-heartbeats-support.md

Lines changed: 0 additions & 55 deletions
This file was deleted.

.changesets/appsignal-stop-must-be-awaited.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

.changesets/implement-ignore-logs.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,92 @@
11
# AppSignal for Node.js Changelog
22

3+
## 3.4.0
4+
5+
_Published on 2024-04-22._
6+
7+
### Added
8+
9+
- [81bd0a9](https://github.com/appsignal/appsignal-nodejs/commit/81bd0a95fc696d49228cc1375a4e59058d7ecbe1) minor - _Heartbeats are currently only available to beta testers. If you are interested in trying it out, [send an email to [email protected]](mailto:[email protected]?subject=Heartbeat%20beta)!_
10+
11+
---
12+
13+
Add heartbeats support. You can send heartbeats directly from your code, to
14+
track the execution of certain processes:
15+
16+
```javascript
17+
import { heartbeat } from "@appsignal/nodejs"
18+
19+
function sendInvoices() {
20+
// ... your code here ...
21+
heartbeat("send_invoices")
22+
}
23+
```
24+
25+
You can pass a function to `heartbeat`, to report to AppSignal both when the
26+
process starts, and when it finishes, allowing you to see the duration of the
27+
process:
28+
29+
```javascript
30+
import { heartbeat } from "@appsignal/nodejs"
31+
32+
function sendInvoices() {
33+
heartbeat("send_invoices", () => {
34+
// ... your code here ...
35+
})
36+
}
37+
```
38+
39+
If an exception is raised within the function, the finish event will not be
40+
reported to AppSignal, triggering a notification about the missing heartbeat.
41+
The exception will bubble outside of the heartbeat function.
42+
43+
If the function passed to `heartbeat` returns a promise, the finish event will
44+
be reported to AppSignal if the promise resolves. This means that you can use
45+
heartbeats to track the duration of async functions:
46+
47+
```javascript
48+
import { heartbeat } from "@appsignal/nodejs"
49+
50+
async function sendInvoices() {
51+
await heartbeat("send_invoices", async () => {
52+
// ... your async code here ...
53+
})
54+
}
55+
```
56+
57+
If the promise is rejected, or if it never resolves, the finish event will
58+
not be reported to AppSignal.
59+
- [9985d08](https://github.com/appsignal/appsignal-nodejs/commit/9985d08044c4cdd9ecdeff16ab40d68e852aa662) patch - Implement the `ignoreLogs` configuration option, which can also be configured as the `APPSIGNAL_IGNORE_LOGS` environment variable.
60+
61+
The value of `ignoreLogs` is a list (comma-separated, when using the environment variable) of log line messages that should be ignored. For example, the value `"start"` will cause any message containing the word "start" to be ignored. Any log line message containing a value in `ignoreLogs` will not be reported to AppSignal.
62+
63+
The values can use a small subset of regular expression syntax (specifically, `^`, `$` and `.*`) to narrow or expand the scope of lines that should be matched.
64+
65+
For example, the value `"^start$"` can be used to ignore any message that is _exactly_ the word "start", but not messages that merely contain it, like "Process failed to start". The value `"Task .* succeeded"` can be used to ignore messages about task success regardless of the specific task name.
66+
67+
### Changed
68+
69+
- [6224018](https://github.com/appsignal/appsignal-nodejs/commit/62240184e81840a7c5722bde55e386ac15f88e0c) patch - `Appsignal.stop()` now returns a promise. For your application to wait until
70+
AppSignal has been gracefully stopped, this promise must be awaited:
71+
72+
```javascript
73+
import { Appsignal } from "@appsignal/nodejs"
74+
75+
await Appsignal.stop()
76+
process.exit(0)
77+
```
78+
79+
In older Node.js versions where top-level await is not available, terminate
80+
the application when the promise is settled:
81+
82+
```javascript
83+
import { Appsignal } from "@appsignal/nodejs"
84+
85+
Appsignal.stop().finally(() => {
86+
process.exit(0)
87+
})
88+
```
89+
390
## 3.3.4
491

592
_Published on 2024-04-19._

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@appsignal/nodejs",
3-
"version": "3.3.4",
3+
"version": "3.4.0",
44
"main": "dist/index",
55
"types": "dist/index",
66
"license": "MIT",

0 commit comments

Comments
 (0)