Changelog

Improving AppSignal, one deploy at a time.

Nov 06, 2023

Custom OpenTelemetry SDK initialization and other improvements

Node.js3.0.25

Added

Add initializeOpentelemetrySdk configuration option

The initializeOpentelemetrySdk configuration option 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:

JavaScript
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.

Add setSqlBody tracing helper

The setSqlBody tracing helper sets 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.

JavaScript
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

  • 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.
  • Add an exponential backoff to the retry sleep time to bind to the StatsD, NGINX and OpenTelemetry HTTP ports. This gives the agent a longer time to connect to the ports if they become available within a 4 minute window.
  • Logs from the agent and extension now use a more consistent format for spans and transactions.
  • The "debug" log level should now be enough for debugging most support issues.

See the Node.js package 3.0.25 changelog for more information.

View all Node.js updates

Start your free trial

Don’t let the bad bugs bite. Try AppSignal for free.

AppSignal offers a 30-day free trial, no credit card is required. All features are available in all plans. Start monitoring your application in just a few clicks!