@argus-ai/node
v0.1.0
Published
Argus Node.js SDK - Instrumentation for AI-native observability
Maintainers
Readme
@argus-ai/node
Argus Node.js SDK — instrumentation for AI-native observability, monitoring, and security.
Installation
npm install @argus-ai/nodeQuick Start
Initialize the SDK
import { init } from '@argus-ai/node';
init({
serverUrl: 'https://argus.example.com',
apiKey: 'your-api-key',
serviceName: 'my-service',
});Express Middleware
import express from 'express';
import { argusMiddleware } from '@argus-ai/node';
const app = express();
app.use(argusMiddleware());Trace Functions
import { trace } from '@argus-ai/node';
class UserService {
@trace('fetchUser')
async fetchUser(id: string) {
// Automatically creates a span with timing and error capture
}
}Capture Exceptions
import { captureException } from '@argus-ai/node';
try {
riskyOperation();
} catch (err) {
captureException(err as Error);
}Breadcrumbs
import { addBreadcrumb } from '@argus-ai/node';
addBreadcrumb('http', 'GET /api/users', { statusCode: 200 });Custom Events
import { event } from '@argus-ai/node';
event('payment_processed', { amount: 99.99, currency: 'USD' });Logging
import { ArgusLogger } from '@argus-ai/node';
const logger = new ArgusLogger('api');
logger.log('Request handled', { path: '/users' });
logger.error('Something failed', { code: 500 });Features
- Distributed Tracing — W3C Traceparent propagation across services
- Express Middleware — Automatic request/response instrumentation
- Function Tracing —
@tracedecorator for class methods - Exception Capture — Stack traces with breadcrumb context
- Breadcrumbs — Trail of events leading up to errors
- Custom Events — Send arbitrary telemetry data
- Structured Logging —
ArgusLoggerwith log levels and auto-forwarding - HTTP Instrumentation — Auto-instrument outgoing
fetchcalls - Serverless Support — Auto-detects AWS Lambda, Vercel, GCP Functions, Cloudflare Workers
- Non-blocking — Events are batched and flushed asynchronously
- AsyncLocalStorage — Trace context propagates through async calls automatically
License
MIT — see LICENSE for details.
