Socket
Socket
Sign inDemoInstall

@appsignal/nodejs

Package Overview
Dependencies
253
Maintainers
8
Versions
122
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @appsignal/nodejs

The AppSignal for Node.js library.


Version published
Maintainers
8
Created

Changelog

Source

3.0.25

Added

  • ab7f3c7 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.

  • daa8982 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

  • 33bce2e 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.

  • 285f89e 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.

  • 3204cdd 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

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

Readme

Source

AppSignal for Node.js

The AppSignal for Node.js library.

npm (scoped) Build Status code style: prettier

Installation

Please follow our installation guide in our documentation. We try to automatically instrument as many packages as possible, but may not always be able to. Make to sure follow any instructions to add manual instrumentation.

Development

Installation

This repository is a mono-managed repository. First install mono on your local machine by following the mono installation steps.

Then install the dependencies and prepare the project for development use using mono:

mono bootstrap

You can then run the following to start the compiler in watch mode.

npm run build:watch --parallel

You can also build the library without watching the directory:

mono build

Version management configuration is provided for asdf.

Testing

The tests for this library use Jest as the test runner. Once you've installed the dependencies, you can run the following command in the root of this repository to run the tests for all packages, or in the directory of a package to run only the tests pertaining to that package:

mono test

Contributing

Thinking of contributing to this repo? Awesome! 🚀

Please follow our Contributing guide in our documentation and follow our Code of Conduct.

Also, we would be very happy to send you Stroopwafels. Have look at everyone we send a package to so far on our Stroopwafels page.

Support

Contact us and speak directly with the engineers working on AppSignal. They will help you get set up, tweak your code and make sure you get the most out of using AppSignal.

FAQs

Last updated on 06 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc