🛟 Don’t hesitate to contact us if you run into
any issues while upgrading your application’s AppSignal for Node.js package.
We’re here to help!
Installing 3.x
To install AppSignal for Node.js 3.x run the following command in your application’s root directory.npm
AppSignal Client
When upgrading from 2.x to 3.x, you need to change how your application initializes and accesses the AppSignal client.Initialize AppSignal Client
To initialize the AppSignal client and export it, you will need to create a newappsignal.cjs file, like in the example below:
--require ./appsignal.cjs) your appsignal.cjs file when starting your application. For example, in your application’s package.json file, like in the example below:
Javascript
Access AppSignal Client
In 3.x the AppSignal client is accessed from the globally exportedAppsignal.client object. The below examples show how to do this within the context of a custom metrics counter.
2.x
3.x
Integrations
AppSignal for Node.js 3.x supports all 2.x integrations out of the box. This means the packages for each integration no longer need to be installed. When moving to 3.x from 2.x you will need to remove any AppSignal integration packages installed for your application.Uninstall Integrations
To take advantage of the AppSignal for Node.js 3.x out-of-the-box integration support, you’ll first need to “undo” the integration installations that were necessary in the 2.x version.Remove AppSignal Package Dependent Code
Don’t forget to remove/uninstall the AppSignal integration package.Remove Apollo Server Integration
Remove the 2.x initialization of the Appsignal Apollo Server package and plugin from your application, and replace it with the 3.x installation instructions. Your Apollo application will be instrumented automatically.2.x
3.x
Apollo Server is instrumented automatically by the AppSignal for Node.js package. Read 3.x GraphQL Integration Documentation Once you’ve modified your integration code, you need to remove the Apollo AppSignal package from your application.Remove Express Integration
Remove the 2.x initialization of AppSignal Express package and middleware from your application, and replace it with the 3.x installation instructions.2.x
3.x
Remove Koa.js Integration
Remove the 2.x initialization of the Appsignal Koa package and instrumentation from your application.2.x
3.x
Koa.js is instrumented automatically by the AppSignal for Node.js package. Read 3.x Koa.js Integration Documentation Once you’ve modified your integration code, you need to remove the Koa.js package from your application.Remove Next.js Integration
The “Web Vitals Reporting” feature has been deprecated and is no longer available on AppSignal for Node.js 3.x.2.x
3.x
Next.js is instrumented automatically by the AppSignal for Node.js package. Read 3.x Next.js Integration DocumentationRemove Integration Package
Once the imports and code dependent on those imports are removed, you need to uninstall the integration package. This can be done by runningnpm uninstall, like in the example below.
Bash
npm uninstall commands will remove package dependencies and update your application’s package.json and npm’s package-lock.json file.
Replace @appsignal/express in the example above with the integration package name you are removing.
AppSignal Integration Package Names
The Tracer Object
There’s no longer a custom AppSignal tracer object. OpenTelemetry exposes a tracer provider which allows you to create new spans.2.x:
3.x:
Spans
There’s no longer a custom AppSignal span object. AppSignal’s tracer functions, such asrootSpan(), createSpan(), currentSpan() and withSpan() functions are no longer available.
Spans must be created by calling the startActiveSpan method on a tracer object. New spans are automatically the children of the span they were created in.
2.x:
3.x:
Span Attribute Helpers
The helper functions used to set span attributes have also changed.setSQL has been replaced with setBody, set has been renamed to setTag, and additional helper functions have been added. setName has been removed, as spans must be given a name when they are created.
2.x
3.x
Exception Handling
Tracer and span objects are no longer needed when usingsetError() and sendError().
2.x
3.x
InsendError(), helpers can be used to add additional data to the error span.