Skip to main content
The HyperProbe Node.js SDK runs as an extremely lightweight in-process agent. It hooks directly into the V8 Virtual Machine inspector layer to execute non-blocking debugging, variable captures, metrics, and log injection in microseconds.

Technical Prerequisites

  • Runtime: Node.js 18 and later.
  • Metadata: Access to the active git commit SHA (mandatory for matching local source coordinates to production builds).
  • Source Maps: Mandatory for transpiled or bundled projects (TypeScript, Esbuild, Webpack).

Installation

Add the SDK as a dependency using your package manager:

🗺️ Configuring Source Maps for Transpilers

If your project is transpiled or bundled, source maps are strictly mandatory for the SDK agent to translate compiled bytecode coordinates back to your local source files.
Ensure "sourceMap": true is enabled in your compiler options:
tsconfig.json

Initialization Walkthrough

Follow these steps to initialize the HyperProbe agent inside your application:
1

Create your initialization file

Create a dedicated file named hyperprobe.ts (or hyperprobe.js) inside your project source root. Select your module syntax below:
src/hyperprobe.ts
2

Import it in your entrypoint

In your main application entrypoint (e.g., index.ts, server.ts, or app.js), import your newly created ./hyperprobe module as early as possible before starting your web server:
Environment Variables Loading Order: You should import ./hyperprobe as early as possible. However, if you are configuring parameters inside hyperprobe.ts that rely on environment variables (such as those loaded via dotenv), ensure that you import/initialize ./hyperprobe after your environment configuration loader has run completely, if needed.
3

Configure your Dockerfile

To enable Docker-based deployments, define a GIT_COMMIT build argument inside your Dockerfile with a default value of unknown.This ensures that existing local builds or developers’ environments do not fail if they do not yet pass a build argument—safely fallback-disabling the HyperProbe agent until a valid SHA is injected:
Dockerfile
4

Run local Docker builds

For building and testing Docker containers locally on your laptop, inject your active git head using standard command line arguments:
5

Inject correct SHA in CI/CD (The PR Merge Trap)

To protect alignment, HyperProbe refuses to start if commitSha resolves to "unknown". Map your CI/CD platform’s built-in commit SHA environment variable to GIT_COMMIT at deployment.Always use your CI/CD engine’s native environment variables to pass the real commit SHA:
⚠️ Beware of the PR Merge Commit Trap: By default, GitHub Actions checking out on a pull_request trigger checkout a virtual merge commit (testing how your branch merges into main) instead of the actual branch commit you pushed.If you run git rev-parse HEAD or use ${{ github.sha }} inside a PR workflow, coordinate mapping will fail because your local VS Code environment is pointing to your actual branch head.To bypass this, always configure GitHub Actions on PRs to use: ${{ github.event.pull_request.head.sha || github.sha }}

⚙️ Configuration & Environment Variables Reference

You can configure the agent by passing properties inside your HyperProbe.start() options object, or by overriding them using environment variables. The code block below illustrates a complete initialization containing all available options, along with their default values and corresponding HYPERPROBE_* environment variables which can override them:
src/hyperprobe.ts
Environment Variable Precedence: Any environment variable specified (e.g. setting HYPERPROBE_HITS_PER_SEC=5 inside your server environment) will automatically override the code-level option passed to HyperProbe.start().