@dex-monit/observability-sdk-node 1.0.11 → 1.0.13
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/dist/lib/console-capture.d.ts +6 -1
- package/dist/lib/console-capture.d.ts.map +1 -1
- package/dist/lib/console-capture.js +42 -2
- package/dist/lib/http-interceptor.d.ts +78 -0
- package/dist/lib/http-interceptor.d.ts.map +1 -0
- package/dist/lib/http-interceptor.js +368 -0
- package/dist/lib/monitoring-client.d.ts +8 -0
- package/dist/lib/monitoring-client.d.ts.map +1 -1
- package/dist/lib/monitoring-client.js +10 -0
- package/dist/lib/sdk-node.d.ts +1 -0
- package/dist/lib/sdk-node.d.ts.map +1 -1
- package/dist/lib/sdk-node.js +1 -0
- package/dist/lib/sdk-node.module.d.ts +2 -0
- package/dist/lib/sdk-node.module.d.ts.map +1 -1
- package/dist/lib/sdk-node.module.js +23 -6
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { MonitoringClient } from './monitoring-client.js';
|
|
2
2
|
/**
|
|
3
3
|
* Start capturing console output and sending to monitoring
|
|
4
|
+
* @param monitoringClient - The monitoring client to send logs to
|
|
5
|
+
* @param options - Options for console capture
|
|
6
|
+
* @param options.skipNestJsLogs - Skip logs that appear to come from NestJS Logger (to avoid duplicates)
|
|
4
7
|
*/
|
|
5
|
-
export declare function startConsoleCapture(monitoringClient: MonitoringClient
|
|
8
|
+
export declare function startConsoleCapture(monitoringClient: MonitoringClient, options?: {
|
|
9
|
+
skipNestJsLogs?: boolean;
|
|
10
|
+
}): void;
|
|
6
11
|
/**
|
|
7
12
|
* Stop capturing console output
|
|
8
13
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console-capture.d.ts","sourceRoot":"","sources":["../../src/lib/console-capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"console-capture.d.ts","sourceRoot":"","sources":["../../src/lib/console-capture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAyB1D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GACzC,IAAI,CA2CN;AAyCD;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAczC;AAqBD;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD"}
|
|
@@ -7,13 +7,18 @@ const CONSOLE_TO_SEVERITY = {
|
|
|
7
7
|
};
|
|
8
8
|
let originalMethods = null;
|
|
9
9
|
let isCapturing = false;
|
|
10
|
+
let skipNestLogs = false;
|
|
10
11
|
/**
|
|
11
12
|
* Start capturing console output and sending to monitoring
|
|
13
|
+
* @param monitoringClient - The monitoring client to send logs to
|
|
14
|
+
* @param options - Options for console capture
|
|
15
|
+
* @param options.skipNestJsLogs - Skip logs that appear to come from NestJS Logger (to avoid duplicates)
|
|
12
16
|
*/
|
|
13
|
-
export function startConsoleCapture(monitoringClient) {
|
|
17
|
+
export function startConsoleCapture(monitoringClient, options = {}) {
|
|
14
18
|
if (isCapturing) {
|
|
15
19
|
return;
|
|
16
20
|
}
|
|
21
|
+
skipNestLogs = options.skipNestJsLogs ?? false;
|
|
17
22
|
// Store original methods
|
|
18
23
|
originalMethods = {
|
|
19
24
|
log: console.log.bind(console),
|
|
@@ -31,7 +36,7 @@ export function startConsoleCapture(monitoringClient) {
|
|
|
31
36
|
original(...args);
|
|
32
37
|
// Skip if it's our own SDK log to avoid infinite loops
|
|
33
38
|
const message = formatConsoleArgs(args);
|
|
34
|
-
if (
|
|
39
|
+
if (shouldSkipLog(message)) {
|
|
35
40
|
return;
|
|
36
41
|
}
|
|
37
42
|
// Send to monitoring (fire and forget)
|
|
@@ -45,6 +50,40 @@ export function startConsoleCapture(monitoringClient) {
|
|
|
45
50
|
}
|
|
46
51
|
isCapturing = true;
|
|
47
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Check if a log message should be skipped
|
|
55
|
+
*/
|
|
56
|
+
function shouldSkipLog(message) {
|
|
57
|
+
// Skip SDK internal logs
|
|
58
|
+
if (message.startsWith('[DEX SDK]') ||
|
|
59
|
+
message.startsWith('[MonitoringClient]') ||
|
|
60
|
+
message.startsWith('[RemoteLogger]')) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
// Skip NestJS Logger output if configured
|
|
64
|
+
// NestJS Logger format: "[Nest] PID - DATE LEVEL [Context] Message"
|
|
65
|
+
// or just colored output with ANSI codes
|
|
66
|
+
if (skipNestLogs) {
|
|
67
|
+
// Check for NestJS log patterns
|
|
68
|
+
// Pattern 1: [Nest] prefix
|
|
69
|
+
if (message.includes('[Nest]')) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
// Pattern 2: ANSI color codes followed by LOG/WARN/ERROR/DEBUG
|
|
73
|
+
if (/\x1b\[\d+m\s*(LOG|WARN|ERROR|DEBUG|VERBOSE)\s*\x1b/.test(message)) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
// Pattern 3: Timestamp pattern from NestJS "MM/DD/YYYY, HH:MM:SS"
|
|
77
|
+
if (/\d{1,2}\/\d{1,2}\/\d{4},\s+\d{1,2}:\d{2}:\d{2}\s+(AM|PM)?\s*(LOG|WARN|ERROR|DEBUG|VERBOSE)?/.test(message)) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
// Pattern 4: Context in brackets [ContextName]
|
|
81
|
+
if (/^\s*\[[\w-]+\]\s+/.test(message)) {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
48
87
|
/**
|
|
49
88
|
* Stop capturing console output
|
|
50
89
|
*/
|
|
@@ -59,6 +98,7 @@ export function stopConsoleCapture() {
|
|
|
59
98
|
console.debug = originalMethods.debug;
|
|
60
99
|
originalMethods = null;
|
|
61
100
|
isCapturing = false;
|
|
101
|
+
skipNestLogs = false;
|
|
62
102
|
}
|
|
63
103
|
/**
|
|
64
104
|
* Format console arguments into a single message string
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { Request, Response } from 'express';
|
|
4
|
+
import { MonitoringClient } from './monitoring-client.js';
|
|
5
|
+
export declare const HTTP_TRACE_MONITORING_TOKEN = "HTTP_TRACE_MONITORING_CLIENT";
|
|
6
|
+
export interface HttpTrace {
|
|
7
|
+
id: string;
|
|
8
|
+
timestamp: string;
|
|
9
|
+
method: string;
|
|
10
|
+
url: string;
|
|
11
|
+
path: string;
|
|
12
|
+
statusCode: number;
|
|
13
|
+
duration: number;
|
|
14
|
+
ip: string;
|
|
15
|
+
userAgent?: string;
|
|
16
|
+
referer?: string;
|
|
17
|
+
contentType?: string;
|
|
18
|
+
contentLength?: number;
|
|
19
|
+
requestId?: string;
|
|
20
|
+
transactionId?: string;
|
|
21
|
+
userId?: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
query?: Record<string, unknown>;
|
|
24
|
+
params?: Record<string, unknown>;
|
|
25
|
+
responseSize?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Get all captured HTTP traces
|
|
29
|
+
*/
|
|
30
|
+
export declare function getHttpTraces(): HttpTrace[];
|
|
31
|
+
/**
|
|
32
|
+
* Get traces filtered by criteria
|
|
33
|
+
*/
|
|
34
|
+
export declare function filterTraces(options: {
|
|
35
|
+
method?: string;
|
|
36
|
+
statusCode?: number;
|
|
37
|
+
minDuration?: number;
|
|
38
|
+
path?: string;
|
|
39
|
+
since?: Date;
|
|
40
|
+
}): HttpTrace[];
|
|
41
|
+
/**
|
|
42
|
+
* Clear all traces
|
|
43
|
+
*/
|
|
44
|
+
export declare function clearTraces(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Get trace statistics
|
|
47
|
+
*/
|
|
48
|
+
export declare function getTraceStats(): {
|
|
49
|
+
total: number;
|
|
50
|
+
byMethod: Record<string, number>;
|
|
51
|
+
byStatus: Record<string, number>;
|
|
52
|
+
avgDuration: number;
|
|
53
|
+
slowestEndpoints: Array<{
|
|
54
|
+
path: string;
|
|
55
|
+
avgDuration: number;
|
|
56
|
+
count: number;
|
|
57
|
+
}>;
|
|
58
|
+
errorRate: number;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* HTTP Interceptor for capturing all requests
|
|
62
|
+
*/
|
|
63
|
+
export declare class HttpTraceInterceptor implements NestInterceptor {
|
|
64
|
+
private monitoringClient?;
|
|
65
|
+
constructor(monitoringClient?: MonitoringClient);
|
|
66
|
+
intercept(context: ExecutionContext, next: CallHandler): Observable<unknown>;
|
|
67
|
+
private recordTrace;
|
|
68
|
+
private getLevel;
|
|
69
|
+
private getClientIp;
|
|
70
|
+
private getResponseSize;
|
|
71
|
+
private sendTraceToMonitoring;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Middleware to capture HTTP requests (alternative to interceptor)
|
|
75
|
+
* Use this if you need to capture requests before NestJS routing
|
|
76
|
+
*/
|
|
77
|
+
export declare function createHttpTraceMiddleware(): (req: Request, res: Response, next: () => void) => void;
|
|
78
|
+
//# sourceMappingURL=http-interceptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-interceptor.d.ts","sourceRoot":"","sources":["../../src/lib/http-interceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,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AAa,IAAI;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9E,SAAS,EAAE,MAAM,CAAC;CACnB,CAmEA;AAED;;GAEG;AACH,qBACa,oBAAqB,YAAW,eAAe;IAC1D,OAAO,CAAC,gBAAgB,CAAC,CAAmB;gBAEhC,gBAAgB,CAAC,EAAE,gBAAgB;IAI/C,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC;IAyE5E,OAAO,CAAC,WAAW;IAoCnB,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,eAAe;YAWT,qBAAqB;CA0CpC;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,KAC/B,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,MAAM,IAAI,UA6EtD"}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { __esDecorate, __runInitializers } from "tslib";
|
|
2
|
+
import { Injectable, } from '@nestjs/common';
|
|
3
|
+
import { tap, catchError } from 'rxjs/operators';
|
|
4
|
+
import { addBreadcrumb } from './monitoring-client.js';
|
|
5
|
+
import { RequestContextService } from '@dex-monit/observability-request-context';
|
|
6
|
+
// Token for injecting monitoring client
|
|
7
|
+
export const HTTP_TRACE_MONITORING_TOKEN = 'HTTP_TRACE_MONITORING_CLIENT';
|
|
8
|
+
// In-memory storage for recent traces (circular buffer)
|
|
9
|
+
const MAX_TRACES = 1000;
|
|
10
|
+
let traces = [];
|
|
11
|
+
let traceIndex = 0;
|
|
12
|
+
/**
|
|
13
|
+
* Get all captured HTTP traces
|
|
14
|
+
*/
|
|
15
|
+
export function getHttpTraces() {
|
|
16
|
+
return [...traces].sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get traces filtered by criteria
|
|
20
|
+
*/
|
|
21
|
+
export function filterTraces(options) {
|
|
22
|
+
return getHttpTraces().filter((trace) => {
|
|
23
|
+
if (options.method && trace.method !== options.method)
|
|
24
|
+
return false;
|
|
25
|
+
if (options.statusCode && trace.statusCode !== options.statusCode)
|
|
26
|
+
return false;
|
|
27
|
+
if (options.minDuration && trace.duration < options.minDuration)
|
|
28
|
+
return false;
|
|
29
|
+
if (options.path && !trace.path.includes(options.path))
|
|
30
|
+
return false;
|
|
31
|
+
if (options.since && new Date(trace.timestamp) < options.since)
|
|
32
|
+
return false;
|
|
33
|
+
return true;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Clear all traces
|
|
38
|
+
*/
|
|
39
|
+
export function clearTraces() {
|
|
40
|
+
traces = [];
|
|
41
|
+
traceIndex = 0;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Get trace statistics
|
|
45
|
+
*/
|
|
46
|
+
export function getTraceStats() {
|
|
47
|
+
const allTraces = getHttpTraces();
|
|
48
|
+
const total = allTraces.length;
|
|
49
|
+
if (total === 0) {
|
|
50
|
+
return {
|
|
51
|
+
total: 0,
|
|
52
|
+
byMethod: {},
|
|
53
|
+
byStatus: {},
|
|
54
|
+
avgDuration: 0,
|
|
55
|
+
slowestEndpoints: [],
|
|
56
|
+
errorRate: 0,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const byMethod = {};
|
|
60
|
+
const byStatus = {};
|
|
61
|
+
const endpointStats = {};
|
|
62
|
+
let totalDuration = 0;
|
|
63
|
+
let errorCount = 0;
|
|
64
|
+
for (const trace of allTraces) {
|
|
65
|
+
// By method
|
|
66
|
+
byMethod[trace.method] = (byMethod[trace.method] || 0) + 1;
|
|
67
|
+
// By status category
|
|
68
|
+
const statusCategory = `${Math.floor(trace.statusCode / 100)}xx`;
|
|
69
|
+
byStatus[statusCategory] = (byStatus[statusCategory] || 0) + 1;
|
|
70
|
+
// Duration
|
|
71
|
+
totalDuration += trace.duration;
|
|
72
|
+
// Errors
|
|
73
|
+
if (trace.statusCode >= 400) {
|
|
74
|
+
errorCount++;
|
|
75
|
+
}
|
|
76
|
+
// Endpoint stats
|
|
77
|
+
const key = `${trace.method} ${trace.path}`;
|
|
78
|
+
if (!endpointStats[key]) {
|
|
79
|
+
endpointStats[key] = { totalDuration: 0, count: 0 };
|
|
80
|
+
}
|
|
81
|
+
endpointStats[key].totalDuration += trace.duration;
|
|
82
|
+
endpointStats[key].count++;
|
|
83
|
+
}
|
|
84
|
+
// Calculate slowest endpoints
|
|
85
|
+
const slowestEndpoints = Object.entries(endpointStats)
|
|
86
|
+
.map(([path, stats]) => ({
|
|
87
|
+
path,
|
|
88
|
+
avgDuration: Math.round(stats.totalDuration / stats.count),
|
|
89
|
+
count: stats.count,
|
|
90
|
+
}))
|
|
91
|
+
.sort((a, b) => b.avgDuration - a.avgDuration)
|
|
92
|
+
.slice(0, 10);
|
|
93
|
+
return {
|
|
94
|
+
total,
|
|
95
|
+
byMethod,
|
|
96
|
+
byStatus,
|
|
97
|
+
avgDuration: Math.round(totalDuration / total),
|
|
98
|
+
slowestEndpoints,
|
|
99
|
+
errorRate: Math.round((errorCount / total) * 100),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* HTTP Interceptor for capturing all requests
|
|
104
|
+
*/
|
|
105
|
+
let HttpTraceInterceptor = (() => {
|
|
106
|
+
let _classDecorators = [Injectable()];
|
|
107
|
+
let _classDescriptor;
|
|
108
|
+
let _classExtraInitializers = [];
|
|
109
|
+
let _classThis;
|
|
110
|
+
var HttpTraceInterceptor = class {
|
|
111
|
+
static { _classThis = this; }
|
|
112
|
+
static {
|
|
113
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
114
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
115
|
+
HttpTraceInterceptor = _classThis = _classDescriptor.value;
|
|
116
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
117
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
118
|
+
}
|
|
119
|
+
monitoringClient;
|
|
120
|
+
constructor(monitoringClient) {
|
|
121
|
+
this.monitoringClient = monitoringClient;
|
|
122
|
+
}
|
|
123
|
+
intercept(context, next) {
|
|
124
|
+
if (context.getType() !== 'http') {
|
|
125
|
+
return next.handle();
|
|
126
|
+
}
|
|
127
|
+
const startTime = Date.now();
|
|
128
|
+
const http = context.switchToHttp();
|
|
129
|
+
const request = http.getRequest();
|
|
130
|
+
const response = http.getResponse();
|
|
131
|
+
const requestContext = RequestContextService.get();
|
|
132
|
+
// Extract request info
|
|
133
|
+
const method = request.method;
|
|
134
|
+
const url = request.originalUrl || request.url;
|
|
135
|
+
const path = request.path || url.split('?')[0];
|
|
136
|
+
const ip = this.getClientIp(request);
|
|
137
|
+
const userAgent = request.headers['user-agent'];
|
|
138
|
+
const referer = request.headers['referer'];
|
|
139
|
+
const contentType = request.headers['content-type'];
|
|
140
|
+
const contentLength = request.headers['content-length']
|
|
141
|
+
? parseInt(request.headers['content-length'], 10)
|
|
142
|
+
: undefined;
|
|
143
|
+
return next.handle().pipe(tap((responseBody) => {
|
|
144
|
+
const duration = Date.now() - startTime;
|
|
145
|
+
const statusCode = response.statusCode;
|
|
146
|
+
this.recordTrace({
|
|
147
|
+
method,
|
|
148
|
+
url,
|
|
149
|
+
path,
|
|
150
|
+
statusCode,
|
|
151
|
+
duration,
|
|
152
|
+
ip,
|
|
153
|
+
userAgent,
|
|
154
|
+
referer,
|
|
155
|
+
contentType,
|
|
156
|
+
contentLength,
|
|
157
|
+
requestId: requestContext?.requestId,
|
|
158
|
+
transactionId: requestContext?.transactionId,
|
|
159
|
+
query: request.query,
|
|
160
|
+
params: request.params,
|
|
161
|
+
responseSize: this.getResponseSize(responseBody),
|
|
162
|
+
});
|
|
163
|
+
}), catchError((error) => {
|
|
164
|
+
const duration = Date.now() - startTime;
|
|
165
|
+
const statusCode = error.status || error.statusCode || 500;
|
|
166
|
+
this.recordTrace({
|
|
167
|
+
method,
|
|
168
|
+
url,
|
|
169
|
+
path,
|
|
170
|
+
statusCode,
|
|
171
|
+
duration,
|
|
172
|
+
ip,
|
|
173
|
+
userAgent,
|
|
174
|
+
referer,
|
|
175
|
+
contentType,
|
|
176
|
+
contentLength,
|
|
177
|
+
requestId: requestContext?.requestId,
|
|
178
|
+
transactionId: requestContext?.transactionId,
|
|
179
|
+
query: request.query,
|
|
180
|
+
params: request.params,
|
|
181
|
+
error: error.message,
|
|
182
|
+
});
|
|
183
|
+
throw error;
|
|
184
|
+
}));
|
|
185
|
+
}
|
|
186
|
+
recordTrace(data) {
|
|
187
|
+
const trace = {
|
|
188
|
+
id: `trace-${Date.now()}-${Math.random().toString(36).substring(7)}`,
|
|
189
|
+
timestamp: new Date().toISOString(),
|
|
190
|
+
...data,
|
|
191
|
+
};
|
|
192
|
+
// Store in circular buffer
|
|
193
|
+
if (traces.length < MAX_TRACES) {
|
|
194
|
+
traces.push(trace);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
traces[traceIndex] = trace;
|
|
198
|
+
traceIndex = (traceIndex + 1) % MAX_TRACES;
|
|
199
|
+
}
|
|
200
|
+
// Add breadcrumb
|
|
201
|
+
addBreadcrumb({
|
|
202
|
+
category: 'http',
|
|
203
|
+
type: 'http',
|
|
204
|
+
message: `${data.method} ${data.path}`,
|
|
205
|
+
level: this.getLevel(data.statusCode),
|
|
206
|
+
data: {
|
|
207
|
+
url: data.url,
|
|
208
|
+
method: data.method,
|
|
209
|
+
status_code: data.statusCode,
|
|
210
|
+
duration: data.duration,
|
|
211
|
+
reason: data.error,
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
// Send to monitoring if client is configured
|
|
215
|
+
if (this.monitoringClient?.isEnabled()) {
|
|
216
|
+
this.sendTraceToMonitoring(trace);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
getLevel(statusCode) {
|
|
220
|
+
if (statusCode >= 500)
|
|
221
|
+
return 'error';
|
|
222
|
+
if (statusCode >= 400)
|
|
223
|
+
return 'warning';
|
|
224
|
+
return 'info';
|
|
225
|
+
}
|
|
226
|
+
getClientIp(request) {
|
|
227
|
+
const forwardedFor = request.headers['x-forwarded-for'];
|
|
228
|
+
if (forwardedFor) {
|
|
229
|
+
const ips = Array.isArray(forwardedFor)
|
|
230
|
+
? forwardedFor[0]
|
|
231
|
+
: forwardedFor.split(',')[0];
|
|
232
|
+
return ips.trim();
|
|
233
|
+
}
|
|
234
|
+
const realIp = request.headers['x-real-ip'];
|
|
235
|
+
if (realIp) {
|
|
236
|
+
return Array.isArray(realIp) ? realIp[0] : realIp;
|
|
237
|
+
}
|
|
238
|
+
return request.ip || request.socket?.remoteAddress || 'unknown';
|
|
239
|
+
}
|
|
240
|
+
getResponseSize(body) {
|
|
241
|
+
if (!body)
|
|
242
|
+
return undefined;
|
|
243
|
+
try {
|
|
244
|
+
const str = typeof body === 'string' ? body : JSON.stringify(body);
|
|
245
|
+
return Buffer.byteLength(str, 'utf8');
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
return undefined;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
async sendTraceToMonitoring(trace) {
|
|
252
|
+
// Send to dedicated traces endpoint
|
|
253
|
+
try {
|
|
254
|
+
const config = this.monitoringClient?.getConfig();
|
|
255
|
+
if (!config)
|
|
256
|
+
return;
|
|
257
|
+
const response = await fetch(`${config.apiUrl}/traces`, {
|
|
258
|
+
method: 'POST',
|
|
259
|
+
headers: {
|
|
260
|
+
'Content-Type': 'application/json',
|
|
261
|
+
'X-Dex-Key': config.apiKey,
|
|
262
|
+
},
|
|
263
|
+
body: JSON.stringify({
|
|
264
|
+
traceId: trace.id,
|
|
265
|
+
method: trace.method,
|
|
266
|
+
url: trace.url,
|
|
267
|
+
path: trace.path,
|
|
268
|
+
statusCode: trace.statusCode,
|
|
269
|
+
duration: trace.duration,
|
|
270
|
+
ip: trace.ip,
|
|
271
|
+
userAgent: trace.userAgent,
|
|
272
|
+
referer: trace.referer,
|
|
273
|
+
contentType: trace.contentType,
|
|
274
|
+
contentLength: trace.contentLength,
|
|
275
|
+
responseSize: trace.responseSize,
|
|
276
|
+
requestId: trace.requestId,
|
|
277
|
+
transactionId: trace.transactionId,
|
|
278
|
+
userId: trace.userId,
|
|
279
|
+
error: trace.error,
|
|
280
|
+
query: trace.query,
|
|
281
|
+
params: trace.params,
|
|
282
|
+
timestamp: trace.timestamp,
|
|
283
|
+
}),
|
|
284
|
+
});
|
|
285
|
+
if (!response.ok) {
|
|
286
|
+
console.error('[DEX SDK] Failed to send trace:', response.status);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
// Silently fail
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
return HttpTraceInterceptor = _classThis;
|
|
295
|
+
})();
|
|
296
|
+
export { HttpTraceInterceptor };
|
|
297
|
+
/**
|
|
298
|
+
* Middleware to capture HTTP requests (alternative to interceptor)
|
|
299
|
+
* Use this if you need to capture requests before NestJS routing
|
|
300
|
+
*/
|
|
301
|
+
export function createHttpTraceMiddleware() {
|
|
302
|
+
return (req, res, next) => {
|
|
303
|
+
const startTime = Date.now();
|
|
304
|
+
const method = req.method;
|
|
305
|
+
const url = req.originalUrl || req.url;
|
|
306
|
+
const path = req.path || url.split('?')[0];
|
|
307
|
+
// Get client IP
|
|
308
|
+
const forwardedFor = req.headers['x-forwarded-for'];
|
|
309
|
+
let ip = req.ip || req.socket?.remoteAddress || 'unknown';
|
|
310
|
+
if (forwardedFor) {
|
|
311
|
+
ip = Array.isArray(forwardedFor)
|
|
312
|
+
? forwardedFor[0]
|
|
313
|
+
: forwardedFor.split(',')[0].trim();
|
|
314
|
+
}
|
|
315
|
+
// Capture response
|
|
316
|
+
const originalEnd = res.end.bind(res);
|
|
317
|
+
res.end = function (chunk, encoding, cb) {
|
|
318
|
+
const duration = Date.now() - startTime;
|
|
319
|
+
const requestContext = RequestContextService.get();
|
|
320
|
+
const trace = {
|
|
321
|
+
id: `trace-${Date.now()}-${Math.random().toString(36).substring(7)}`,
|
|
322
|
+
timestamp: new Date().toISOString(),
|
|
323
|
+
method,
|
|
324
|
+
url,
|
|
325
|
+
path,
|
|
326
|
+
statusCode: res.statusCode,
|
|
327
|
+
duration,
|
|
328
|
+
ip,
|
|
329
|
+
userAgent: req.headers['user-agent'],
|
|
330
|
+
referer: req.headers['referer'],
|
|
331
|
+
contentType: req.headers['content-type'],
|
|
332
|
+
requestId: requestContext?.requestId,
|
|
333
|
+
transactionId: requestContext?.transactionId,
|
|
334
|
+
query: req.query,
|
|
335
|
+
};
|
|
336
|
+
// Store trace
|
|
337
|
+
if (traces.length < MAX_TRACES) {
|
|
338
|
+
traces.push(trace);
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
traces[traceIndex] = trace;
|
|
342
|
+
traceIndex = (traceIndex + 1) % MAX_TRACES;
|
|
343
|
+
}
|
|
344
|
+
// Add breadcrumb
|
|
345
|
+
addBreadcrumb({
|
|
346
|
+
category: 'http',
|
|
347
|
+
type: 'http',
|
|
348
|
+
message: `${method} ${path}`,
|
|
349
|
+
level: res.statusCode >= 500
|
|
350
|
+
? 'error'
|
|
351
|
+
: res.statusCode >= 400
|
|
352
|
+
? 'warning'
|
|
353
|
+
: 'info',
|
|
354
|
+
data: {
|
|
355
|
+
url,
|
|
356
|
+
method,
|
|
357
|
+
status_code: res.statusCode,
|
|
358
|
+
duration,
|
|
359
|
+
},
|
|
360
|
+
});
|
|
361
|
+
if (typeof encoding === 'function') {
|
|
362
|
+
return originalEnd(chunk, encoding);
|
|
363
|
+
}
|
|
364
|
+
return originalEnd(chunk, encoding, cb);
|
|
365
|
+
};
|
|
366
|
+
next();
|
|
367
|
+
};
|
|
368
|
+
}
|
|
@@ -95,6 +95,14 @@ export declare class MonitoringClient {
|
|
|
95
95
|
* Get the configured project
|
|
96
96
|
*/
|
|
97
97
|
getProject(): string;
|
|
98
|
+
/**
|
|
99
|
+
* Get the client configuration (for HTTP trace sending)
|
|
100
|
+
*/
|
|
101
|
+
getConfig(): {
|
|
102
|
+
apiUrl: string;
|
|
103
|
+
apiKey: string;
|
|
104
|
+
project: string;
|
|
105
|
+
};
|
|
98
106
|
}
|
|
99
107
|
/**
|
|
100
108
|
* Create a monitoring client instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitoring-client.d.ts","sourceRoot":"","sources":["../../src/lib/monitoring-client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,QAAQ,EAGR,UAAU,EACX,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAEL,eAAe,EAChB,MAAM,mCAAmC,CAAC;AA4E3C;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yBAAyB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mCAAmC;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EACf,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,IAAI,CAQN"}
|
|
@@ -400,6 +400,16 @@ export class MonitoringClient {
|
|
|
400
400
|
getProject() {
|
|
401
401
|
return this.config.project;
|
|
402
402
|
}
|
|
403
|
+
/**
|
|
404
|
+
* Get the client configuration (for HTTP trace sending)
|
|
405
|
+
*/
|
|
406
|
+
getConfig() {
|
|
407
|
+
return {
|
|
408
|
+
apiUrl: this.config.apiUrl,
|
|
409
|
+
apiKey: this.config.apiKey,
|
|
410
|
+
project: this.config.project,
|
|
411
|
+
};
|
|
412
|
+
}
|
|
403
413
|
}
|
|
404
414
|
/**
|
|
405
415
|
* Create a monitoring client instance
|
package/dist/lib/sdk-node.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-node.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-node.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"sdk-node.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-node.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
|
package/dist/lib/sdk-node.js
CHANGED
|
@@ -18,6 +18,8 @@ export interface SdkNodeModuleConfig {
|
|
|
18
18
|
captureConsole?: boolean;
|
|
19
19
|
/** Whether to capture NestJS native Logger (default: true) */
|
|
20
20
|
captureNestLogger?: boolean;
|
|
21
|
+
/** Whether to capture HTTP requests (default: true) */
|
|
22
|
+
captureHttpRequests?: boolean;
|
|
21
23
|
}
|
|
22
24
|
export { LOGGER_TOKEN };
|
|
23
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-node.module.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-node.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEb,kBAAkB,EAClB,UAAU,EACV,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAEL,sBAAsB,EAEvB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk-node.module.d.ts","sourceRoot":"","sources":["../../src/lib/sdk-node.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EAEb,kBAAkB,EAClB,UAAU,EACV,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAEL,sBAAsB,EAEvB,MAAM,wBAAwB,CAAC;AAShC,OAAO,EAEL,YAAY,EACZ,YAAY,EACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,2BAA2B;IAC3B,MAAM,EAAE,YAAY,CAAC;IACrB,yFAAyF;IACzF,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,2CAA2C;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0EAA0E;IAC1E,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,gEAAgE;IAChE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC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