@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 +84 -44
- package/package.json +1 -1
- package/vantatrace-sdk-0.1.2.tgz +0 -0
- package/vantatrace-0.1.0.tgz +0 -0
- package/vantatrace-sdk-0.1.0.tgz +0 -0
- package/vantatrace-sdk-0.1.1.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,50 +1,75 @@
|
|
|
1
|
-
# VantaTrace Node.js SDK
|
|
1
|
+
# 🚀 VantaTrace Node.js SDK
|
|
2
2
|
|
|
3
|
-
VantaTrace
|
|
3
|
+
**VantaTrace** is a lightweight, high-performance observability SDK for
|
|
4
|
+
Node.js microservices and Express.js APIs.
|
|
4
5
|
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
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
|
-
|
|
35
|
+
------------------------------------------------------------------------
|
|
13
36
|
|
|
14
|
-
|
|
15
|
-
Initialize the VantaTrace client at the top of your application entrypoint:
|
|
37
|
+
## ⚡ Quick Start
|
|
16
38
|
|
|
17
|
-
|
|
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',
|
|
22
|
-
serviceName: 'order-service',
|
|
23
|
-
environment: '
|
|
45
|
+
apiKey: 'YOUR_PROJECT_API_KEY',
|
|
46
|
+
serviceName: 'order-service',
|
|
47
|
+
environment: 'production',
|
|
48
|
+
debug: false
|
|
24
49
|
});
|
|
25
50
|
```
|
|
26
51
|
|
|
27
|
-
|
|
28
|
-
|
|
52
|
+
------------------------------------------------------------------------
|
|
53
|
+
|
|
54
|
+
### 2. Enable Global Error Tracking
|
|
29
55
|
|
|
30
|
-
```javascript
|
|
56
|
+
``` javascript
|
|
31
57
|
vantaTrace.initGlobalHandlers();
|
|
32
58
|
```
|
|
33
59
|
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
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
|
-
|
|
56
|
-
|
|
80
|
+
------------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
### 4. Manual Error Capturing
|
|
57
83
|
|
|
58
|
-
```javascript
|
|
84
|
+
``` javascript
|
|
59
85
|
try {
|
|
60
|
-
|
|
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',
|
|
92
|
+
severity: 'warning',
|
|
67
93
|
metadata: {
|
|
68
94
|
orderId: 'ord_128d9a',
|
|
69
|
-
amount: 149.
|
|
95
|
+
amount: 149.5
|
|
70
96
|
}
|
|
71
97
|
});
|
|
72
98
|
}
|
|
73
99
|
```
|
|
74
100
|
|
|
75
|
-
|
|
76
|
-
You can also use dedicated helper methods to automatically assign severity:
|
|
101
|
+
------------------------------------------------------------------------
|
|
77
102
|
|
|
78
|
-
|
|
79
|
-
// Capture a critical system failure
|
|
80
|
-
vantaTrace.captureCritical(error, { userId: 'user_8872' });
|
|
103
|
+
## ⚙️ Severity Levels
|
|
81
104
|
|
|
82
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
package/vantatrace-0.1.0.tgz
DELETED
|
Binary file
|
package/vantatrace-sdk-0.1.0.tgz
DELETED
|
Binary file
|
package/vantatrace-sdk-0.1.1.tgz
DELETED
|
Binary file
|