Packages

@appsignal/nodejs

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

Your version

3.0.25

6 Nov 2023Where it was published

3.9.5 is the newest release of 3.x.

In short

2 new1 fixed2 changed

Release note

Added

  • Patch - Add initializeOpentelemetrySdk configuration option. This allows those who
    would rather take control of how OpenTelemetry is initialised in their
    application to skip AppSignal's initialization of the OpenTelemetry SDK.

    Additionally, add an opentelemetryInstrumentations method on the client,
    which returns AppSignal's default OpenTelemetry instrumentations, already
    configured to work correctly with AppSignal. The provided list of
    instrumentations will follow the additionalInstrumentations and
    disableDefaultInstrumentations config options, if those are set.

    This is not the recommended way to use AppSignal for Node.js. Only use this
    config option and this method if you're really sure that you know what
    you're doing.

    When initialising OpenTelemetry, it is necessary to add the AppSignal span
    processor in order for data to be sent to AppSignal. For example, using the
    OpenTelemetry SDK:

    import { SpanProcessor, Appsignal } from "@appsignal/nodejs";
    // or: const { SpanProcessor, Appsignal } = require("@appsignal/nodejs")
    
    const sdk = new NodeSDK({
      spanProcessor: new SpanProcessor(Appsignal.client)
      instrumentations: Appsignal.client.opentelemetryInstrumentations()
    });
    
    sdk.start()

    The above snippet assumes that the AppSignal client has been initialised
    beforehand.

    When making use of this config option, the OpenTelemetry instrumentations
    must be configured in the same way as it is done in the AppSignal integration.
    In the above snippet, the instrumentations property in the OpenTelemetry SDK
    is set to the AppSignal client's list of OpenTelemetry instrumentations, which
    are configured to work correctly with AppSignal.

  • Patch - Add the setSqlBody tracing helper to set the body attribute on a span that contains a SQL query. When using this helper the given SQL query will be sanitized, reducing the chances of sending sensitive data to AppSignal.

    import { setSqlBody } from "@appsignal/nodejs";
    
    // Must be used in an instrumented context -- e.g. an Express route
    setSqlBody("SELECT * FROM users WHERE 'password' = 'secret'");
    // Will be stored as: "SELECT * FROM users WHERE 'password' = ?"

    When the setBody helper is also used, the setSqlBody overwrites the setBody attribute.

    More information about our tracing helpers can be found in our documentation.

Changed

  • Patch - Bump agent to b604345.

    • Add an exponential backoff to the retry sleep time to bind to the StatsD, NGINX and OpenTelemetry exporter ports. This gives the agent a longer time to connect to the ports if they become available within a 4 minute window.

    • Changes to the agent logger:

      • Logs from the agent and extension now use a more consistent format in logs for spans and transactions.

      • Logs that are for more internal use are moved to the trace log level and logs that are useful for debugging most support issues are moved to the debug log level. It should not be necessary to use log level 'trace' as often anymore. The 'debug' log level should be enough.

    • Add running_in_container to agent diagnose report, to be used primarily by the Python package as a way to detect if an app's host is a container or not.

    Bump agent to 8260fa1.

    • Add appsignal.sql_body magic span attribute for OpenTelemetry spans. When this attribute is detected, we store the value as the span/event body. This span is sanitized beforehand so it doesn't contain any sensitive data and helps to group events in our backend. When used in combination with the appsignal.body attribute, the new appsignal.sql_body attribute is leading.

    More information on AppSignal OpenTelemetry span attributes can be found in our docs.

  • Patch - Print more path details in the diagnose CLI output. It will now print details like if a path exists, the ownership of a path and if it's writable or not to help debug issues locally.

  • Patch - Bump agent to 1dd2a18.

    • When adding an SQL body attribute via the extension, instead of truncating the body first and sanitising it later, sanitise it first and truncate it later. This prevents an issue where queries containing very big values result in truncated sanitisations.

Fixed

  • Patch - Fix a TypeScript types compatibility error upon app compilation when using the AppSignal Express error handler.

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.