Node.js: Initialize using code
Hud's SDK needs to be imported and initialized as early as possible in your code to make sure it instruments any forthcoming modules' functions.
Note: the SDK does not instrument the functions in the file it's imported in.
Please be mindful: This approach is less recommended as it might result in missing metrics for functions that were loaded before Hud's importing point.
Copy the code snippet. Fill in the API key provided to you, and your unique service name.
Learn more about Hud Configuration.
//Hud automatically starts instrumentation
import { init } from 'hud-sdk';
...
//initialize the server session and sends data to Hud
init(API_KEY, SERVICE_NAME);
//Hud automatically starts instrumentation
const { init } = require('hud-sdk');
...
//initialize the server session and sends data to Hud
init(API_KEY, SERVICE_NAME);
Create the following mandatory environment variables that are used during Hud import.
HUD_ENABLE=true
Updated 17 days ago
Whatโs Next