Packages

@appsignal/nodejs

3.9.5 · 11 Nov 2026MIT24.2k / weekRepositoryHomepagenpmAtom feed

Your version

3.4.0

22 Apr 2024Where it was published

3.9.5 is the newest release of 3.x.

In short

2 new1 changed

Release note

Published on 2024-04-22.

Added

  • Minor - Heartbeats are currently only available to beta testers. If you are interested in trying it out, send an email to support@appsignal.com!


    Add heartbeats support. You can send heartbeats directly from your code, to
    track the execution of certain processes:

    import { heartbeat } from "@appsignal/nodejs"
    
    function sendInvoices() {
      // ... your code here ...
      heartbeat("send_invoices")
    }

    You can pass a function to heartbeat, to report to AppSignal both when the
    process starts, and when it finishes, allowing you to see the duration of the
    process:

    import { heartbeat } from "@appsignal/nodejs"
    
    function sendInvoices() {
      heartbeat("send_invoices", () => {
        // ... your code here ...
      })
    }

    If an exception is raised within the function, the finish event will not be
    reported to AppSignal, triggering a notification about the missing heartbeat.
    The exception will bubble outside of the heartbeat function.

    If the function passed to heartbeat returns a promise, the finish event will
    be reported to AppSignal if the promise resolves. This means that you can use
    heartbeats 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.

  • Patch - Implement the ignoreLogs configuration option, which can also be configured as the APPSIGNAL_IGNORE_LOGS environment variable.

    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.

    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.

    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.

Changed

  • Patch - Appsignal.stop() now returns a promise. For your application to wait until
    AppSignal has been gracefully stopped, this promise must be awaited:

    import { Appsignal } from "@appsignal/nodejs"
    
    await Appsignal.stop()
    process.exit(0)

    In older Node.js versions where top-level await is not available, terminate
    the application when the promise is settled:

    import { Appsignal } from "@appsignal/nodejs"
    
    Appsignal.stop().finally(() => {
      process.exit(0)
    })

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.