NodeJS

The Aspecto SDK is an OpenTelemetry-based product.

Install our Node.js library using npm:

$ npm install @aspecto/opentelemetry

Auto Instrument

  1. Use node -r (or --require) cli option to preload Aspecto SDK before application start:

-r @aspecto/opentelemetry/auto-instrument

e.g. your node invocation should look like this:

// before
node ./app

// after
node -r @aspecto/opentelemetry/auto-instrument ./app

2. Set aspectoAuth and other optional SDK options via environment variables or aspecto.json file.

For example:

ASPECTO_AUTH="*your-token-goes-here*" node -r @aspecto/opentelemetry/auto-instrument ./app

Initialise in Code

After obtaining your token here, before any other import, add the following call at the top of your app entry point:

require('@aspecto/opentelemetry')({
    aspectoAuth: '*your-token-goes-here*'
});
// ... other imports ...

Send traffic to your service

So far, you have configured your application to send telemetry to Aspecto for any inbound or outbound requests. Next, you will need to make requests to your service in order to generate the telemetry that will be sent to Aspecto.

Interact with your application by making a few requests. Telemetry data should now appear in the Aspecto UI!

Continue to the next step to start investigate your tracing data.

See the advanced page for specific configurations

Last updated