Node.js / Express APM

Get the most out of Middleware OpsAI for your Node.js Express applications by using the Middleware Node.js SDK (version 2.2.0 or newer).

🚀 Key Features

  • Supports function code capturing for runtime exceptions
  • Works seamlessly with Express Framework

🛠️ APM Setup

  1. Install the Middleware package:

  2. Initialize the tracker at the top of your entry file:

⚡ Exception Code Capturing

Register Error Handler provided by Middleware Node.js SDK to capture Exception Code

⚙️ VCS Metadata Configuration (Recommended)

If your app has a .git directory, the APM will auto-fetch repository URL, commit SHA, and other metadata for OpsAI.

If your app is containerized or does not have a .git directory, set these environment variables to send VCS info to OpsAI (this helps generate solution PRs):

These are just example commands to fetch values from Git. You can set these environment variables in any way that fits your workflow, such as through your CI/CD pipeline or other automation tools.

📚 Resources