Install the RocketGraph SDK using npm:
npm install @rocketgraph/sdk
Add the following code to your application:
const { RocketGraph } = require('@rocketgraph/sdk');
const rocket = new RocketGraph({
apiKey: 'your-api-key',
projectId: 'your-project-id'
});
// Start monitoring
rocket.start();
The SDK can be configured with the following options:
apiKey
: Your RocketGraph API keyprojectId
: Your project identifierenvironment
: The environment (development, staging, production)logLevel
: Logging level (debug, info, warn, error)rocket.track('user_action', {
action: 'button_click',
userId: '123',
timestamp: new Date()
});
try {
// Your code here
} catch (error) {
rocket.captureError(error);
throw error;
}