Node.js Custom Instrumentation
  • 1 Minute to read
  • Dark
    Light
  • PDF

Node.js Custom Instrumentation

  • Dark
    Light
  • PDF

Article Summary

Configuration

Custom Instrumentation allows you to track classes and functions not natively supported in our Node.js Profiler. This requires adding an instrumentation section to your stackify.js configuration file.

Example:

/**
 * Stackify Node APM Configuration
 */
exports.config = {
  /**
   * Your application name.
   */
  application_name: 'Node Application',
  /**
   * Your environment name.
   */
  environment_name: 'Production',
  /**
   * Your custom instrumentation.
   */
  instrumentations: [
    // custom instrumentation on a local class file
    {
      module: './other.js',
      class: 'Other',
      method: 'execute'
    },
    // custom instrumentation on a 3rd party module class
    {
      module: 'random',
      class: 'Random',
      method: 'boolean'
    }
  ]
}

Tracked Functions

Tracked Functions allows you to track a specific method call across requests, data will show up in your application dashboard under the Tracked Functions tab.

Example:

{
    module: 'random',
    class: 'Random',
    method: 'boolean',
    trackedFunction: true,
}

Was this article helpful?