Tracing Hapi application can be done in two methods:

  1. Auto-tracing using the environment variable.
  2. Calling the SDK.

Calling the SDK is simple, and should be done in your main js file where the application is being initialized:

const epsagon = require('epsagon-frameworks');

  token: 'epsagon-token',
  appName: 'app-name-stage',
  metadataOnly: false,

Tagging traces or setting custom errors can be by:

  method: 'GET',
  handler: (request, h) => {
      request.epsagon.label('key', 'value');
      request.epsagon.setError(Error('My custom error'));

Did this page help you?