@vantatrace/sdk 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,50 +1,75 @@
1
- # VantaTrace Node.js SDK
1
+ # 🚀 VantaTrace Node.js SDK
2
2
 
3
- VantaTrace SDK is a lightweight, zero-overhead exception tracking and telemetry client for server-side Node.js applications and Express.js APIs. It intercepts uncaught errors, captures unhandled promise rejections, gathers host/runtime contexts, and streams normalized telemetry payloads asynchronously to your VantaTrace central ingestion server.
3
+ **VantaTrace** is a lightweight, high-performance observability SDK for
4
+ Node.js microservices and Express.js APIs.
4
5
 
5
- ## Installation
6
+ It provides real-time **exception tracking, structured telemetry, and
7
+ runtime context capture**, enabling developers to detect, group, and
8
+ debug production issues with minimal overhead.
6
9
 
7
- Install the client package via npm:
8
- ```bash
10
+ Designed for modern distributed systems, VantaTrace runs fully
11
+ asynchronously and never blocks your application runtime.
12
+
13
+ ------------------------------------------------------------------------
14
+
15
+ ## ✨ Key Features
16
+
17
+ - ⚡ Zero-blocking architecture --- async ingestion pipeline\
18
+ - 🧠 Smart error grouping (fingerprinting) --- deduplicates identical
19
+ failures\
20
+ - 🔍 Rich runtime context --- request, system, and environment
21
+ metadata\
22
+ - 🔒 Secure by default --- automatic redaction of sensitive data\
23
+ - 🌐 Multi-service support --- built for microservices architecture\
24
+ - 📊 Structured telemetry --- normalized event payloads\
25
+ - 🧩 Express.js integration --- plug-and-play middleware
26
+
27
+ ------------------------------------------------------------------------
28
+
29
+ ## 📦 Installation
30
+
31
+ ``` bash
9
32
  npm install @vantatrace/sdk
10
33
  ```
11
34
 
12
- ## Quick Start
35
+ ------------------------------------------------------------------------
13
36
 
14
- ### 1. Initialization
15
- Initialize the VantaTrace client at the top of your application entrypoint:
37
+ ## Quick Start
16
38
 
17
- ```javascript
39
+ ### 1. Initialize SDK
40
+
41
+ ``` javascript
18
42
  import { VantaTrace } from '@vantatrace/sdk';
19
43
 
20
44
  const vantaTrace = new VantaTrace({
21
- apiKey: 'YOUR_PROJECT_API_KEY', // Obtain from VantaTrace Admin Console
22
- serviceName: 'order-service', // Name of your microservice
23
- environment: 'live', // 'live' or 'test'. Auto-inferred from API key prefix if debug: false // Set to true to print SDK internal diagnostics
45
+ apiKey: 'YOUR_PROJECT_API_KEY',
46
+ serviceName: 'order-service',
47
+ environment: 'production',
48
+ debug: false
24
49
  });
25
50
  ```
26
51
 
27
- ### 2. Auto-capture Global Exceptions
28
- To automatically intercept uncaught exceptions and unhandled promise rejections before the Node process exits:
52
+ ------------------------------------------------------------------------
53
+
54
+ ### 2. Enable Global Error Tracking
29
55
 
30
- ```javascript
56
+ ``` javascript
31
57
  vantaTrace.initGlobalHandlers();
32
58
  ```
33
59
 
34
- ### 3. Express.js Error Handler Middleware
35
- To log exceptions raised in Express request handlers and routes, mount the middleware at the bottom of your route definitions:
60
+ ------------------------------------------------------------------------
61
+
62
+ ### 3. Express Middleware Integration
36
63
 
37
- ```javascript
64
+ ``` javascript
38
65
  import express from 'express';
66
+
39
67
  const app = express();
40
68
 
41
- // ... Define routes and controller endpoints ...
42
- app.get('/checkout', (req, res) => {
69
+ app.get('/checkout', () => {
43
70
  throw new Error('Payment gateway timeout');
44
71
  });
45
72
 
46
- // The VantaTrace middleware MUST be registered after all route definitions,
47
- // but before other custom express error handling middlewares:
48
73
  app.use(vantaTrace.expressMiddleware());
49
74
 
50
75
  app.use((err, req, res, next) => {
@@ -52,46 +77,61 @@ app.use((err, req, res, next) => {
52
77
  });
53
78
  ```
54
79
 
55
- ### 4. Manual Exception Capturing
56
- To manually trace handled exceptions, assign custom contextual parameters, or specify severity:
80
+ ------------------------------------------------------------------------
81
+
82
+ ### 4. Manual Error Capturing
57
83
 
58
- ```javascript
84
+ ``` javascript
59
85
  try {
60
- // perform some actions
86
+ await processOrder();
61
87
  } catch (error) {
62
88
  vantaTrace.captureException(error, {
63
89
  userId: 'user_8872',
64
90
  route: '/api/v1/orders',
65
91
  method: 'POST',
66
- severity: 'warning', // optional: 'critical', 'warning', or 'info'
92
+ severity: 'warning',
67
93
  metadata: {
68
94
  orderId: 'ord_128d9a',
69
- amount: 149.50
95
+ amount: 149.5
70
96
  }
71
97
  });
72
98
  }
73
99
  ```
74
100
 
75
- #### Severity Shortcuts
76
- You can also use dedicated helper methods to automatically assign severity:
101
+ ------------------------------------------------------------------------
77
102
 
78
- ```javascript
79
- // Capture a critical system failure
80
- vantaTrace.captureCritical(error, { userId: 'user_8872' });
103
+ ## ⚙️ Severity Levels
81
104
 
82
- // Capture a warning
105
+ ``` javascript
106
+ vantaTrace.captureCritical(error);
83
107
  vantaTrace.captureWarning(error);
84
-
85
- // Capture general information / handled failures
86
108
  vantaTrace.captureInfo(error);
87
109
  ```
88
110
 
89
- ## Features
111
+ ------------------------------------------------------------------------
112
+
113
+ ## 🧠 How It Works
114
+
115
+ Application Error → SDK Capture → Context Enrichment → Fingerprinting →
116
+ Async Queue → Ingestion API → Dashboard
117
+
118
+ ------------------------------------------------------------------------
119
+
120
+ ## 🔒 Security
121
+
122
+ Sensitive fields are automatically redacted: password, token,
123
+ authorization, cookie, x-api-key
124
+
125
+ ------------------------------------------------------------------------
126
+
127
+ ## ⚡ Performance
128
+
129
+ - \<1ms overhead
130
+ - Async non-blocking execution
131
+ - Batched ingestion
132
+
133
+ ------------------------------------------------------------------------
134
+
135
+ ## 📊 Architecture
90
136
 
91
- - **Reference Normalization**: Safe serialization of deep call stacks, native errors, and custom properties.
92
- - **Asynchronous Delivery**: Telemetry reporting runs asynchronously to ensure it never blocks thread execution or delays HTTP responses.
93
- - **Auto-Redaction**: Middleware automatically filters out sensitive body parameters (`password`, `token`) and HTTP header keys (`Cookie`, `Authorization`, `x-api-key`) from collected logs.
94
- - **Host & System Telemetry**: Captures host platform hostname, Node runtime version, PID, CPU architecture, platform type, CPU load averages (`loadavg`), and process uptime automatically.
95
- - **Memory Tracking**: Auto-captures heap totals, heap usage, external memory footprint, and system-wide free/total RAM during exception triggers.
96
- - **Error Attributes Extraction**: Captures standard error code fields (`err.code`), HTTP statuses (`err.status`/`err.statusCode`), and any custom enumerable metadata attached to the exception.
97
- - **Request Context Enrichment**: Express middleware captures client IP address and sanitized headers to assist debugging.
137
+ Microservice SDK Ingestion API Fingerprinting Engine Dashboard
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vantatrace/sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Drop-in observability SDK for Node.js microservices powering error tracking, structured logging, and real-time telemetry pipelines.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
Binary file
Binary file
Binary file
Binary file