@codebaz/nextdoctor-agent 0.1.0-beta.1
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/.turbo/turbo-build.log +3 -0
- package/README.md +568 -0
- package/dist/detectors/__tests__/cold-start-threshold.test.d.ts +2 -0
- package/dist/detectors/__tests__/cold-start-threshold.test.d.ts.map +1 -0
- package/dist/detectors/__tests__/cold-start-threshold.test.js +156 -0
- package/dist/detectors/__tests__/cold-start-threshold.test.js.map +1 -0
- package/dist/detectors/__tests__/dynamic-route-candidate.test.d.ts +2 -0
- package/dist/detectors/__tests__/dynamic-route-candidate.test.d.ts.map +1 -0
- package/dist/detectors/__tests__/dynamic-route-candidate.test.js +318 -0
- package/dist/detectors/__tests__/dynamic-route-candidate.test.js.map +1 -0
- package/dist/detectors/__tests__/fetch-no-cache.test.d.ts +2 -0
- package/dist/detectors/__tests__/fetch-no-cache.test.d.ts.map +1 -0
- package/dist/detectors/__tests__/fetch-no-cache.test.js +199 -0
- package/dist/detectors/__tests__/fetch-no-cache.test.js.map +1 -0
- package/dist/detectors/base-detector.d.ts +17 -0
- package/dist/detectors/base-detector.d.ts.map +1 -0
- package/dist/detectors/base-detector.js +50 -0
- package/dist/detectors/base-detector.js.map +1 -0
- package/dist/detectors/cold-start-threshold.detector.d.ts +11 -0
- package/dist/detectors/cold-start-threshold.detector.d.ts.map +1 -0
- package/dist/detectors/cold-start-threshold.detector.js +87 -0
- package/dist/detectors/cold-start-threshold.detector.js.map +1 -0
- package/dist/detectors/dynamic-route-candidate.detector.d.ts +23 -0
- package/dist/detectors/dynamic-route-candidate.detector.d.ts.map +1 -0
- package/dist/detectors/dynamic-route-candidate.detector.js +96 -0
- package/dist/detectors/dynamic-route-candidate.detector.js.map +1 -0
- package/dist/detectors/fetch-no-cache.detector.d.ts +12 -0
- package/dist/detectors/fetch-no-cache.detector.d.ts.map +1 -0
- package/dist/detectors/fetch-no-cache.detector.js +178 -0
- package/dist/detectors/fetch-no-cache.detector.js.map +1 -0
- package/dist/detectors/index.d.ts +28 -0
- package/dist/detectors/index.d.ts.map +1 -0
- package/dist/detectors/index.js +97 -0
- package/dist/detectors/index.js.map +1 -0
- package/dist/detectors/types.d.ts +32 -0
- package/dist/detectors/types.d.ts.map +1 -0
- package/dist/detectors/types.js +2 -0
- package/dist/detectors/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +133 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +363 -0
- package/dist/init.js.map +1 -0
- package/dist/middleware.d.ts +10 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +61 -0
- package/dist/middleware.js.map +1 -0
- package/dist/optimization.d.ts +43 -0
- package/dist/optimization.d.ts.map +1 -0
- package/dist/optimization.js +139 -0
- package/dist/optimization.js.map +1 -0
- package/dist/system-monitor.d.ts +124 -0
- package/dist/system-monitor.d.ts.map +1 -0
- package/dist/system-monitor.js +221 -0
- package/dist/system-monitor.js.map +1 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -0
- package/package.json +55 -0
- package/src/detectors/__tests__/cold-start-threshold.test.ts +183 -0
- package/src/detectors/__tests__/dynamic-route-candidate.test.ts +365 -0
- package/src/detectors/__tests__/fetch-no-cache.test.ts +239 -0
- package/src/detectors/base-detector.ts +69 -0
- package/src/detectors/cold-start-threshold.detector.ts +95 -0
- package/src/detectors/dynamic-route-candidate.detector.ts +107 -0
- package/src/detectors/fetch-no-cache.detector.ts +204 -0
- package/src/detectors/index.ts +127 -0
- package/src/detectors/types.ts +38 -0
- package/src/index.ts +60 -0
- package/src/init.ts +424 -0
- package/src/middleware.ts +75 -0
- package/src/optimization.ts +164 -0
- package/src/system-monitor.ts +295 -0
- package/src/types.ts +66 -0
- package/tsconfig.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
package/dist/init.js
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
2
|
+
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
|
|
3
|
+
import { OTLPTraceExporter } from '@opentelemetry/exporter-otlp-http';
|
|
4
|
+
import { trace } from '@opentelemetry/api';
|
|
5
|
+
import { LogLevel as LogLevelEnum, ExporterType as ExporterTypeEnum } from './types.js';
|
|
6
|
+
import { SystemMonitor } from './system-monitor.js';
|
|
7
|
+
import { detectionEngine } from './detectors/index.js';
|
|
8
|
+
class NextDoctorAgent {
|
|
9
|
+
sdk = null;
|
|
10
|
+
config;
|
|
11
|
+
systemMonitor;
|
|
12
|
+
health = {
|
|
13
|
+
initialized: false,
|
|
14
|
+
isHealthy: true,
|
|
15
|
+
exporterStatus: 'healthy',
|
|
16
|
+
bufferedSpans: 0,
|
|
17
|
+
errorCount: 0,
|
|
18
|
+
};
|
|
19
|
+
retryPolicy;
|
|
20
|
+
logLevel;
|
|
21
|
+
initialized = false;
|
|
22
|
+
detectedIssues = [];
|
|
23
|
+
spansBuffer = [];
|
|
24
|
+
lastAnalysisTime = Date.now();
|
|
25
|
+
analysisIntervalMs = 5000; // Analyze spans every 5 seconds
|
|
26
|
+
startTime = Date.now();
|
|
27
|
+
constructor(config) {
|
|
28
|
+
this.validateConfig(config);
|
|
29
|
+
this.config = {
|
|
30
|
+
enabled: true,
|
|
31
|
+
serviceName: 'nextdoctor-app',
|
|
32
|
+
version: '0.1.0',
|
|
33
|
+
environment: 'production',
|
|
34
|
+
logLevel: LogLevelEnum.INFO,
|
|
35
|
+
samplingRate: 1.0,
|
|
36
|
+
timeout: 30000,
|
|
37
|
+
...config,
|
|
38
|
+
};
|
|
39
|
+
this.logLevel = this.config.logLevel || LogLevelEnum.INFO;
|
|
40
|
+
this.retryPolicy = {
|
|
41
|
+
maxRetries: 5,
|
|
42
|
+
initialDelayMs: 100,
|
|
43
|
+
maxDelayMs: 30000,
|
|
44
|
+
backoffMultiplier: 2,
|
|
45
|
+
randomizationFactor: 0.1,
|
|
46
|
+
};
|
|
47
|
+
if (config.retryPolicy) {
|
|
48
|
+
this.retryPolicy = { ...this.retryPolicy, ...config.retryPolicy };
|
|
49
|
+
}
|
|
50
|
+
this.systemMonitor = new SystemMonitor((level, message, meta) => this.log(level, message, meta));
|
|
51
|
+
}
|
|
52
|
+
validateConfig(config) {
|
|
53
|
+
if (!config.projectToken) {
|
|
54
|
+
throw new Error('NextDoctor: projectToken is required');
|
|
55
|
+
}
|
|
56
|
+
if (!config.endpoint) {
|
|
57
|
+
throw new Error('NextDoctor: endpoint is required');
|
|
58
|
+
}
|
|
59
|
+
if (config.samplingRate !== undefined && (config.samplingRate < 0 || config.samplingRate > 1)) {
|
|
60
|
+
throw new Error('NextDoctor: samplingRate must be between 0 and 1');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
log(level, message, meta) {
|
|
64
|
+
if (level < this.logLevel)
|
|
65
|
+
return;
|
|
66
|
+
const timestamp = new Date().toISOString();
|
|
67
|
+
const prefix = `[NextDoctor ${timestamp}]`;
|
|
68
|
+
if (meta) {
|
|
69
|
+
console.log(`${prefix} ${message}`, meta);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
console.log(`${prefix} ${message}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
createTraceExporter() {
|
|
76
|
+
const exporterConfig = (this.config.exporter || {});
|
|
77
|
+
const isVercel = exporterConfig.type === ExporterTypeEnum.VERCEL || this.isVercelEnvironment();
|
|
78
|
+
if (isVercel || !exporterConfig.url) {
|
|
79
|
+
this.log(LogLevelEnum.INFO, 'Using Vercel OTEL exporter');
|
|
80
|
+
return new OTLPTraceExporter({
|
|
81
|
+
url: this.config.endpoint,
|
|
82
|
+
headers: {
|
|
83
|
+
authorization: `Bearer ${this.config.projectToken}`,
|
|
84
|
+
'content-type': 'application/json',
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return new OTLPTraceExporter({
|
|
89
|
+
url: exporterConfig.url || this.config.endpoint,
|
|
90
|
+
headers: {
|
|
91
|
+
...exporterConfig.headers,
|
|
92
|
+
authorization: `Bearer ${this.config.projectToken}`,
|
|
93
|
+
'content-type': 'application/json',
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
createResource() {
|
|
98
|
+
// Using any to avoid version mismatch issues with OpenTelemetry
|
|
99
|
+
const attributes = {
|
|
100
|
+
'service.name': this.config.serviceName || 'nextdoctor-app',
|
|
101
|
+
'service.version': this.config.version || '0.1.0',
|
|
102
|
+
'deployment.environment': this.config.environment || 'production',
|
|
103
|
+
'service.instance.id': this.generateInstanceId(),
|
|
104
|
+
};
|
|
105
|
+
return { attributes };
|
|
106
|
+
}
|
|
107
|
+
generateInstanceId() {
|
|
108
|
+
return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
109
|
+
}
|
|
110
|
+
isVercelEnvironment() {
|
|
111
|
+
return !!(typeof process !== 'undefined' &&
|
|
112
|
+
process.env.VERCEL === '1');
|
|
113
|
+
}
|
|
114
|
+
async initialize() {
|
|
115
|
+
if (this.initialized) {
|
|
116
|
+
this.log(LogLevelEnum.WARN, 'NextDoctor agent already initialized');
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (!this.config.enabled) {
|
|
120
|
+
this.log(LogLevelEnum.INFO, 'NextDoctor agent is disabled');
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
try {
|
|
125
|
+
this.log(LogLevelEnum.DEBUG, 'Initializing NextDoctor agent...');
|
|
126
|
+
const traceExporter = this.createTraceExporter();
|
|
127
|
+
const resource = this.createResource();
|
|
128
|
+
this.sdk = new NodeSDK({
|
|
129
|
+
resource: resource,
|
|
130
|
+
traceExporter,
|
|
131
|
+
instrumentations: [
|
|
132
|
+
getNodeAutoInstrumentations({
|
|
133
|
+
'@opentelemetry/instrumentation-http': {
|
|
134
|
+
enabled: true,
|
|
135
|
+
responseHook: (span, response) => {
|
|
136
|
+
if (response.statusCode) {
|
|
137
|
+
span.setAttribute('http.response.status', response.statusCode);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
'@opentelemetry/instrumentation-fs': {
|
|
142
|
+
enabled: true,
|
|
143
|
+
},
|
|
144
|
+
'@opentelemetry/instrumentation-express': {
|
|
145
|
+
enabled: true,
|
|
146
|
+
},
|
|
147
|
+
}),
|
|
148
|
+
],
|
|
149
|
+
});
|
|
150
|
+
await this.sdk.start();
|
|
151
|
+
this.health.initialized = true;
|
|
152
|
+
this.health.isHealthy = true;
|
|
153
|
+
this.log(LogLevelEnum.INFO, 'NextDoctor agent initialized successfully');
|
|
154
|
+
}
|
|
155
|
+
catch (retryError) {
|
|
156
|
+
this.health.errorCount++;
|
|
157
|
+
if (this.health.errorCount < this.retryPolicy.maxRetries) {
|
|
158
|
+
this.log(LogLevelEnum.WARN, `Initialization attempt failed, retrying... (${this.health.errorCount}/${this.retryPolicy.maxRetries})`, {
|
|
159
|
+
error: retryError?.message,
|
|
160
|
+
});
|
|
161
|
+
await new Promise(resolve => setTimeout(resolve, 100 * Math.pow(2, this.health.errorCount)));
|
|
162
|
+
throw retryError;
|
|
163
|
+
}
|
|
164
|
+
throw retryError;
|
|
165
|
+
}
|
|
166
|
+
this.initialized = true;
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
this.health.initialized = false;
|
|
170
|
+
this.health.isHealthy = false;
|
|
171
|
+
this.health.exporterStatus = 'unreachable';
|
|
172
|
+
this.health.errorCount++;
|
|
173
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
174
|
+
this.log(LogLevelEnum.ERROR, 'Failed to initialize NextDoctor agent', { error: message });
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
analyzeSpan(span) {
|
|
179
|
+
// Buffer span for batch analysis by detection engine
|
|
180
|
+
try {
|
|
181
|
+
if (!span)
|
|
182
|
+
return;
|
|
183
|
+
// Add span to buffer with timestamp
|
|
184
|
+
this.spansBuffer.push({
|
|
185
|
+
...span,
|
|
186
|
+
bufferedAt: Date.now(),
|
|
187
|
+
});
|
|
188
|
+
// Keep buffer size manageable (max 1000 spans)
|
|
189
|
+
if (this.spansBuffer.length > 1000) {
|
|
190
|
+
this.spansBuffer = this.spansBuffer.slice(-500);
|
|
191
|
+
}
|
|
192
|
+
// Run detection engine periodically
|
|
193
|
+
const now = Date.now();
|
|
194
|
+
if (now - this.lastAnalysisTime >= this.analysisIntervalMs) {
|
|
195
|
+
this.runDetectionEngine();
|
|
196
|
+
this.lastAnalysisTime = now;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
this.log(LogLevelEnum.DEBUG, 'Error buffering span', { error });
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
runDetectionEngine() {
|
|
204
|
+
// Run detection engine on buffered spans
|
|
205
|
+
try {
|
|
206
|
+
if (this.spansBuffer.length === 0)
|
|
207
|
+
return;
|
|
208
|
+
// Extract context from spans
|
|
209
|
+
const firstSpan = this.spansBuffer[0];
|
|
210
|
+
const route = firstSpan?.attributes?.['http.route'] ||
|
|
211
|
+
firstSpan?.attributes?.['http.url'] ||
|
|
212
|
+
'unknown';
|
|
213
|
+
const runtime = (process.env.NEXT_RUNTIME || 'nodejs');
|
|
214
|
+
// Calculate startup time if this is the first request
|
|
215
|
+
const startupTimeMs = Date.now() - this.startTime;
|
|
216
|
+
// Analyze spans with detection engine
|
|
217
|
+
const detectedIssues = detectionEngine.analyzeSpans(this.spansBuffer, {
|
|
218
|
+
route: String(route),
|
|
219
|
+
runtime,
|
|
220
|
+
startupTimeMs: startupTimeMs < 30000 ? startupTimeMs : undefined, // Only report first 30s
|
|
221
|
+
});
|
|
222
|
+
// Merge with existing detections (detection engine handles deduplication internally)
|
|
223
|
+
if (detectedIssues.length > 0) {
|
|
224
|
+
this.detectedIssues.push(...detectedIssues);
|
|
225
|
+
// Keep detected issues list manageable (max 500 most recent)
|
|
226
|
+
if (this.detectedIssues.length > 500) {
|
|
227
|
+
this.detectedIssues = this.detectedIssues.slice(-250);
|
|
228
|
+
}
|
|
229
|
+
this.log(LogLevelEnum.DEBUG, `Detection engine found ${detectedIssues.length} issues`, {
|
|
230
|
+
issues: detectedIssues.map(i => ({ id: i.id, severity: i.severity })),
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
// Clear buffer after analysis to avoid re-analyzing
|
|
234
|
+
this.spansBuffer = [];
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
this.log(LogLevelEnum.DEBUG, 'Error running detection engine', { error });
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
async shutdown() {
|
|
241
|
+
if (!this.sdk) {
|
|
242
|
+
this.log(LogLevelEnum.WARN, 'NextDoctor agent not initialized');
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
// Run detection engine one final time for any remaining buffered spans
|
|
247
|
+
if (this.spansBuffer.length > 0) {
|
|
248
|
+
this.runDetectionEngine();
|
|
249
|
+
}
|
|
250
|
+
this.log(LogLevelEnum.INFO, 'Shutting down NextDoctor agent...');
|
|
251
|
+
await this.sdk.shutdown();
|
|
252
|
+
this.initialized = false;
|
|
253
|
+
this.health.initialized = false;
|
|
254
|
+
this.log(LogLevelEnum.INFO, 'NextDoctor agent shut down successfully');
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
258
|
+
this.log(LogLevelEnum.ERROR, 'Error during shutdown', { error: message });
|
|
259
|
+
throw error;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
getHealth() {
|
|
263
|
+
return {
|
|
264
|
+
...this.health,
|
|
265
|
+
errorCount: this.health.errorCount,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
getDetectedIssues() {
|
|
269
|
+
return this.detectedIssues;
|
|
270
|
+
}
|
|
271
|
+
clearDetectedIssues() {
|
|
272
|
+
this.detectedIssues = [];
|
|
273
|
+
}
|
|
274
|
+
reportCustomMetric(name, value, attributes) {
|
|
275
|
+
if (!this.initialized) {
|
|
276
|
+
this.log(LogLevelEnum.WARN, 'Agent not initialized, metric not reported', { name });
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const tracer = trace.getTracer('nextdoctor');
|
|
280
|
+
const span = tracer.startSpan(`custom-metric: ${name}`);
|
|
281
|
+
span.setAttribute('metric.name', name);
|
|
282
|
+
span.setAttribute('metric.value', value);
|
|
283
|
+
if (attributes) {
|
|
284
|
+
Object.entries(attributes).forEach(([key, val]) => {
|
|
285
|
+
span.setAttribute(`metric.${key}`, val);
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
span.end();
|
|
289
|
+
}
|
|
290
|
+
getUptime() {
|
|
291
|
+
return Date.now() - this.startTime;
|
|
292
|
+
}
|
|
293
|
+
getSystemMetrics() {
|
|
294
|
+
return this.systemMonitor.getSystemMetrics();
|
|
295
|
+
}
|
|
296
|
+
getSystemHealth(cpuThreshold = 80, memThreshold = 85) {
|
|
297
|
+
return this.systemMonitor.getSystemHealth(cpuThreshold, memThreshold);
|
|
298
|
+
}
|
|
299
|
+
getSystemSummary() {
|
|
300
|
+
return this.systemMonitor.getSummary();
|
|
301
|
+
}
|
|
302
|
+
getStats() {
|
|
303
|
+
return {
|
|
304
|
+
uptime: this.getUptime(),
|
|
305
|
+
initialized: this.initialized,
|
|
306
|
+
health: this.getHealth(),
|
|
307
|
+
detectedIssues: this.getDetectedIssues(),
|
|
308
|
+
system: this.getSystemSummary(),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
// Global singleton instance
|
|
313
|
+
let agentInstance = null;
|
|
314
|
+
export async function initNextDoctor(config) {
|
|
315
|
+
if (agentInstance) {
|
|
316
|
+
console.warn('NextDoctor agent already initialized');
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
agentInstance = new NextDoctorAgent(config);
|
|
320
|
+
await agentInstance.initialize();
|
|
321
|
+
}
|
|
322
|
+
export async function shutdownNextDoctor() {
|
|
323
|
+
if (!agentInstance) {
|
|
324
|
+
console.warn('NextDoctor agent not initialized');
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
await agentInstance.shutdown();
|
|
328
|
+
agentInstance = null;
|
|
329
|
+
}
|
|
330
|
+
export function getNextDoctorAgent() {
|
|
331
|
+
return agentInstance;
|
|
332
|
+
}
|
|
333
|
+
export function reportMetric(name, value, attributes) {
|
|
334
|
+
if (!agentInstance) {
|
|
335
|
+
console.warn('NextDoctor agent not initialized, metric not reported');
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
agentInstance.reportCustomMetric(name, value, attributes);
|
|
339
|
+
}
|
|
340
|
+
export function getHealthStatus() {
|
|
341
|
+
return agentInstance?.getHealth() || null;
|
|
342
|
+
}
|
|
343
|
+
export function getDetectedIssues() {
|
|
344
|
+
return agentInstance?.getDetectedIssues() || [];
|
|
345
|
+
}
|
|
346
|
+
export function getSystemMetrics() {
|
|
347
|
+
return agentInstance?.getSystemMetrics() || null;
|
|
348
|
+
}
|
|
349
|
+
export function getSystemHealth(cpuThreshold = 80, memThreshold = 85) {
|
|
350
|
+
if (!agentInstance) {
|
|
351
|
+
console.warn('NextDoctor agent not initialized, system health unavailable');
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
return agentInstance.getSystemHealth(cpuThreshold, memThreshold);
|
|
355
|
+
}
|
|
356
|
+
export function getSystemSummary() {
|
|
357
|
+
if (!agentInstance) {
|
|
358
|
+
console.warn('NextDoctor agent not initialized, system summary unavailable');
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
return agentInstance.getSystemSummary();
|
|
362
|
+
}
|
|
363
|
+
//# sourceMappingURL=init.js.map
|
package/dist/init.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAS3C,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,aAAa,EAAsB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,eAAe;IACX,GAAG,GAAmB,IAAI,CAAC;IAC3B,MAAM,CAAmB;IACzB,aAAa,CAAgB;IAC7B,MAAM,GAAgB;QAC5B,WAAW,EAAE,KAAK;QAClB,SAAS,EAAE,IAAI;QACf,cAAc,EAAE,SAAS;QACzB,aAAa,EAAE,CAAC;QAChB,UAAU,EAAE,CAAC;KACd,CAAC;IACM,WAAW,CAAc;IACzB,QAAQ,CAAW;IACnB,WAAW,GAAG,KAAK,CAAC;IACpB,cAAc,GAAoB,EAAE,CAAC;IACrC,WAAW,GAAU,EAAE,CAAC;IACxB,gBAAgB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACrB,kBAAkB,GAAG,IAAI,CAAC,CAAC,gCAAgC;IACpE,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE/B,YAAY,MAAwB;QAClC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC5B,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,IAAI;YACb,WAAW,EAAE,gBAAgB;YAC7B,OAAO,EAAE,OAAO;YAChB,WAAW,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AED,OAAO,aAAa,CAAC,gBAAgB,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Middleware para Next.js API routes
|
|
3
|
+
* Captura automaticamente tempo de resposta e status
|
|
4
|
+
*/
|
|
5
|
+
export declare function withNextDoctorMonitoring(handler: (req: any, res: any) => Promise<void>): (req: any, res: any) => Promise<void>;
|
|
6
|
+
/**
|
|
7
|
+
* Monitora operações async com timing e error tracking
|
|
8
|
+
*/
|
|
9
|
+
export declare function withNextDoctorTiming<T>(name: string, fn: () => Promise<T>, meta?: Record<string, any>): Promise<T>;
|
|
10
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,IAEhC,KAAK,GAAG,EAAE,KAAK,GAAG,mBAgCjC;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,OAAO,CAAC,CAAC,CAAC,CAwBZ"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { getNextDoctorAgent, reportMetric } from './init.js';
|
|
2
|
+
/**
|
|
3
|
+
* Middleware para Next.js API routes
|
|
4
|
+
* Captura automaticamente tempo de resposta e status
|
|
5
|
+
*/
|
|
6
|
+
export function withNextDoctorMonitoring(handler) {
|
|
7
|
+
return async (req, res) => {
|
|
8
|
+
const startTime = Date.now();
|
|
9
|
+
const originalStatusCode = res.statusCode;
|
|
10
|
+
// Wrap response.end to capture status
|
|
11
|
+
const originalEnd = res.end;
|
|
12
|
+
res.end = function (...args) {
|
|
13
|
+
const duration = Date.now() - startTime;
|
|
14
|
+
const agent = getNextDoctorAgent();
|
|
15
|
+
if (agent) {
|
|
16
|
+
reportMetric('api.request.duration', duration, {
|
|
17
|
+
method: req.method,
|
|
18
|
+
path: req.url,
|
|
19
|
+
status: res.statusCode,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return originalEnd.apply(res, args);
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
await handler(req, res);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
reportMetric('api.request.error', 1, {
|
|
29
|
+
method: req.method,
|
|
30
|
+
path: req.url,
|
|
31
|
+
error: error instanceof Error ? error.message : String(error),
|
|
32
|
+
});
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Monitora operações async com timing e error tracking
|
|
39
|
+
*/
|
|
40
|
+
export async function withNextDoctorTiming(name, fn, meta) {
|
|
41
|
+
const startTime = Date.now();
|
|
42
|
+
try {
|
|
43
|
+
const result = await fn();
|
|
44
|
+
const duration = Date.now() - startTime;
|
|
45
|
+
reportMetric(`operation.${name}.duration`, duration, {
|
|
46
|
+
status: 'success',
|
|
47
|
+
...meta,
|
|
48
|
+
});
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const duration = Date.now() - startTime;
|
|
53
|
+
reportMetric(`operation.${name}.duration`, duration, {
|
|
54
|
+
status: 'error',
|
|
55
|
+
error: error instanceof Error ? error.message : String(error),
|
|
56
|
+
...meta,
|
|
57
|
+
});
|
|
58
|
+
throw error;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":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C;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,IAAY,EACZ,EAAoB,EACpB,IAA0B;IAE1B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QAExC,YAAY,CAAC,aAAa,IAAI,WAAW,EAAE,QAAQ,EAAE;YACnD,MAAM,EAAE,SAAS;YACjB,GAAG,IAAI;SACR,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QAExC,YAAY,CAAC,aAAa,IAAI,WAAW,EAAE,QAAQ,EAAE;YACnD,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YAC7D,GAAG,IAAI;SACR,CAAC,CAAC;QAEH,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intelligent sampler para controlar volume de traces
|
|
3
|
+
*/
|
|
4
|
+
export declare class IntelligentSampler {
|
|
5
|
+
private samplingRate;
|
|
6
|
+
private bucketsPerSecond;
|
|
7
|
+
private lastAdjustmentTime;
|
|
8
|
+
private spanCount;
|
|
9
|
+
private errorCount;
|
|
10
|
+
constructor(initialRate?: number);
|
|
11
|
+
shouldSample(spanName?: string): boolean;
|
|
12
|
+
recordSpan(isError?: boolean): void;
|
|
13
|
+
private adjustSamplingRate;
|
|
14
|
+
getSamplingRate(): number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Batch processor para otimização de memória
|
|
18
|
+
*/
|
|
19
|
+
export declare class BatchProcessor {
|
|
20
|
+
private batch;
|
|
21
|
+
private batchSize;
|
|
22
|
+
private batchTimeoutMs;
|
|
23
|
+
private timeoutId;
|
|
24
|
+
private onFlush;
|
|
25
|
+
constructor(batchSize: number | undefined, batchTimeoutMs: number | undefined, onFlush: (batch: any[]) => Promise<void>);
|
|
26
|
+
add(item: any): void;
|
|
27
|
+
flush(): Promise<void>;
|
|
28
|
+
destroy(): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Circuit breaker para proteção contra exporters degradados
|
|
32
|
+
*/
|
|
33
|
+
export declare class CircuitBreaker {
|
|
34
|
+
private failureCount;
|
|
35
|
+
private failureThreshold;
|
|
36
|
+
private resetTimeout;
|
|
37
|
+
private state;
|
|
38
|
+
private lastFailureTime;
|
|
39
|
+
execute<T>(fn: () => Promise<T>): Promise<T | null>;
|
|
40
|
+
private reset;
|
|
41
|
+
getState(): string;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=optimization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimization.d.ts","sourceRoot":"","sources":["../src/optimization.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,kBAAkB,CAAc;IACxC,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,UAAU,CAAK;gBAEX,WAAW,GAAE,MAAY;IAIrC,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO;IASxC,UAAU,CAAC,OAAO,GAAE,OAAe,GAAG,IAAI;IAgB1C,OAAO,CAAC,kBAAkB;IAa1B,eAAe,IAAI,MAAM;CAG1B;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,OAAO,CAAkC;gBAG/C,SAAS,EAAE,MAAM,YAAM,EACvB,cAAc,EAAE,MAAM,YAAO,EAC7B,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC;IAO1C,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAUd,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAsBtB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B;AAED;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,KAAK,CAA6C;IAC1D,OAAO,CAAC,eAAe,CAAK;IAEtB,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IA6BzD,OAAO,CAAC,KAAK;IAKb,QAAQ,IAAI,MAAM;CAGnB"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intelligent sampler para controlar volume de traces
|
|
3
|
+
*/
|
|
4
|
+
export class IntelligentSampler {
|
|
5
|
+
samplingRate;
|
|
6
|
+
bucketsPerSecond = 1000;
|
|
7
|
+
lastAdjustmentTime = Date.now();
|
|
8
|
+
spanCount = 0;
|
|
9
|
+
errorCount = 0;
|
|
10
|
+
constructor(initialRate = 1.0) {
|
|
11
|
+
this.samplingRate = Math.max(0, Math.min(1, initialRate));
|
|
12
|
+
}
|
|
13
|
+
shouldSample(spanName) {
|
|
14
|
+
// Always sample errors
|
|
15
|
+
if (spanName?.includes('error')) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return Math.random() < this.samplingRate;
|
|
19
|
+
}
|
|
20
|
+
recordSpan(isError = false) {
|
|
21
|
+
this.spanCount++;
|
|
22
|
+
if (isError) {
|
|
23
|
+
this.errorCount++;
|
|
24
|
+
}
|
|
25
|
+
// Adjust sampling rate every second
|
|
26
|
+
const now = Date.now();
|
|
27
|
+
if (now - this.lastAdjustmentTime > 1000) {
|
|
28
|
+
this.adjustSamplingRate();
|
|
29
|
+
this.lastAdjustmentTime = now;
|
|
30
|
+
this.spanCount = 0;
|
|
31
|
+
this.errorCount = 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
adjustSamplingRate() {
|
|
35
|
+
// If too many spans, reduce sampling
|
|
36
|
+
if (this.spanCount > this.bucketsPerSecond * 2) {
|
|
37
|
+
this.samplingRate *= 0.9;
|
|
38
|
+
}
|
|
39
|
+
// If too few spans, increase sampling
|
|
40
|
+
else if (this.spanCount < this.bucketsPerSecond * 0.5) {
|
|
41
|
+
this.samplingRate *= 1.1;
|
|
42
|
+
}
|
|
43
|
+
this.samplingRate = Math.max(0, Math.min(1, this.samplingRate));
|
|
44
|
+
}
|
|
45
|
+
getSamplingRate() {
|
|
46
|
+
return this.samplingRate;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Batch processor para otimização de memória
|
|
51
|
+
*/
|
|
52
|
+
export class BatchProcessor {
|
|
53
|
+
batch = [];
|
|
54
|
+
batchSize;
|
|
55
|
+
batchTimeoutMs;
|
|
56
|
+
timeoutId = null;
|
|
57
|
+
onFlush;
|
|
58
|
+
constructor(batchSize = 100, batchTimeoutMs = 5000, onFlush) {
|
|
59
|
+
this.batchSize = batchSize;
|
|
60
|
+
this.batchTimeoutMs = batchTimeoutMs;
|
|
61
|
+
this.onFlush = onFlush;
|
|
62
|
+
}
|
|
63
|
+
add(item) {
|
|
64
|
+
this.batch.push(item);
|
|
65
|
+
if (this.batch.length >= this.batchSize) {
|
|
66
|
+
this.flush();
|
|
67
|
+
}
|
|
68
|
+
else if (!this.timeoutId) {
|
|
69
|
+
this.timeoutId = setTimeout(() => this.flush(), this.batchTimeoutMs);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
async flush() {
|
|
73
|
+
if (this.timeoutId) {
|
|
74
|
+
clearTimeout(this.timeoutId);
|
|
75
|
+
this.timeoutId = null;
|
|
76
|
+
}
|
|
77
|
+
if (this.batch.length === 0) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const itemsToFlush = [...this.batch];
|
|
81
|
+
this.batch = [];
|
|
82
|
+
try {
|
|
83
|
+
await this.onFlush(itemsToFlush);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
console.error('Error flushing batch:', error);
|
|
87
|
+
// Re-add items if flush fails
|
|
88
|
+
this.batch = [...itemsToFlush, ...this.batch];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async destroy() {
|
|
92
|
+
await this.flush();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Circuit breaker para proteção contra exporters degradados
|
|
97
|
+
*/
|
|
98
|
+
export class CircuitBreaker {
|
|
99
|
+
failureCount = 0;
|
|
100
|
+
failureThreshold = 5;
|
|
101
|
+
resetTimeout = 60000; // 1 minute
|
|
102
|
+
state = 'CLOSED';
|
|
103
|
+
lastFailureTime = 0;
|
|
104
|
+
async execute(fn) {
|
|
105
|
+
if (this.state === 'OPEN') {
|
|
106
|
+
if (Date.now() - this.lastFailureTime > this.resetTimeout) {
|
|
107
|
+
this.state = 'HALF_OPEN';
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
console.warn('Circuit breaker is OPEN, request rejected');
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
const result = await fn();
|
|
116
|
+
if (this.state === 'HALF_OPEN') {
|
|
117
|
+
this.reset();
|
|
118
|
+
}
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
this.failureCount++;
|
|
123
|
+
this.lastFailureTime = Date.now();
|
|
124
|
+
if (this.failureCount >= this.failureThreshold) {
|
|
125
|
+
this.state = 'OPEN';
|
|
126
|
+
console.error('Circuit breaker opened due to excessive failures');
|
|
127
|
+
}
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
reset() {
|
|
132
|
+
this.failureCount = 0;
|
|
133
|
+
this.state = 'CLOSED';
|
|
134
|
+
}
|
|
135
|
+
getState() {
|
|
136
|
+
return this.state;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=optimization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimization.js","sourceRoot":"","sources":["../src/optimization.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACrB,YAAY,CAAS;IACrB,gBAAgB,GAAG,IAAI,CAAC;IACxB,kBAAkB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAChC,SAAS,GAAG,CAAC,CAAC;IACd,UAAU,GAAG,CAAC,CAAC;IAEvB,YAAY,cAAsB,GAAG;QACnC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,YAAY,CAAC,QAAiB;QAC5B,uBAAuB;QACvB,IAAI,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;IAC3C,CAAC;IAED,UAAU,CAAC,UAAmB,KAAK;QACjC,IAAI,CAAC,SAAS,EAAE,CAAC;QACjB,IAAI,OAAO,EAAE,CAAC;YACZ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