Tracing a Sails.js Application provides two levels of tracing: basic tracing and function-level tracing.

Basic tracing collects request, response and error information, logs, and provides a timeline of external resource access (databases, HTTP endpoints, external services) of your unit (basically, endpoint or handler).

Function-level tracing also adds timings of the individual function calls to the timeline.

Setting up a Basic Tracing#

Thanks to the Sails' hooks system, it's really easy to set the tracing up.

  1. Install the Recap.Dev Hook
yarn add sails-hook-recap-dev


npm i --save sails-hook-recap-dev
  1. Configure the Sync Endpoint

In your config/env/production.js or other environments you'd like to trace your application on, add the following:

'recap-dev': {
syncEndpoint: ''

Read the official Sails.js documentation on the hooks configuration here

At this point, you should start getting tracing data with basic details.

Available configuration options:

  • syncEndpoint - Required, points to your Recap.Dev installation tracing endpoint.
  • filterRequest - Optional, function that accepts a request and returns true to trace the request or false to ignore it. Useful to ignore requests to assets. Default is:
filterRequest: (request) => request.originalUrl.startsWith('/api/')
  • disableAutomaticUnitNames - Optional, if set to true, no unit names will be created automatically. Note that you will need to call tracer.setUnitName to provide a unit name, otherwise it will be set as a current hostname.

Check the complete source code of an example NestJS project traced with here

Unit Name#

A unit is a minimal tracked component in Recap.Dev. By configuring unit names, you can select a granularity of your data to your liking.

The Recap.Dev Sails.js hook provides a default unit name strategy that concatenates the environment and the endpoint's routing URL, so the resulting unit name looks like the following:


You can always modify the unit's name in the current trace by setting disableAutomaticUnitNames to true and calling tracer.setUnitName like this:

import { tracer } from ''
const handler = (...) => {

Setting up a Function-level Tracing#

Click here to learn how to set up the function-level tracing for your application.