flow-debugger 1.9.7 → 1.9.9
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/ENHANCED_OBSERVABILITY.md +835 -0
- package/IMPLEMENTATION_SUMMARY.md +466 -0
- package/README.md +147 -8
- package/bin/cli.js +1 -1
- package/dist/cjs/core/Alerting.js +310 -0
- package/dist/cjs/core/Alerting.js.map +1 -0
- package/dist/cjs/core/AnomalyDetection.js +223 -0
- package/dist/cjs/core/AnomalyDetection.js.map +1 -0
- package/dist/cjs/core/DependencyGraph.js +251 -0
- package/dist/cjs/core/DependencyGraph.js.map +1 -0
- package/dist/cjs/core/DistributedTracing.js +245 -0
- package/dist/cjs/core/DistributedTracing.js.map +1 -0
- package/dist/cjs/core/ErrorClustering.js +257 -0
- package/dist/cjs/core/ErrorClustering.js.map +1 -0
- package/dist/cjs/core/LogCorrelation.js +242 -0
- package/dist/cjs/core/LogCorrelation.js.map +1 -0
- package/dist/cjs/core/Metrics.js +301 -0
- package/dist/cjs/core/Metrics.js.map +1 -0
- package/dist/cjs/core/RootCause.js +107 -9
- package/dist/cjs/core/RootCause.js.map +1 -1
- package/dist/cjs/core/TrendAnalysis.js +254 -0
- package/dist/cjs/core/TrendAnalysis.js.map +1 -0
- package/dist/cjs/core/types.js +14 -0
- package/dist/cjs/core/types.js.map +1 -1
- package/dist/cjs/index.js +27 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/middleware/express.js +105 -4
- package/dist/cjs/middleware/express.js.map +1 -1
- package/dist/esm/core/Alerting.js +305 -0
- package/dist/esm/core/Alerting.js.map +1 -0
- package/dist/esm/core/AnomalyDetection.js +218 -0
- package/dist/esm/core/AnomalyDetection.js.map +1 -0
- package/dist/esm/core/DependencyGraph.js +246 -0
- package/dist/esm/core/DependencyGraph.js.map +1 -0
- package/dist/esm/core/DistributedTracing.js +240 -0
- package/dist/esm/core/DistributedTracing.js.map +1 -0
- package/dist/esm/core/ErrorClustering.js +252 -0
- package/dist/esm/core/ErrorClustering.js.map +1 -0
- package/dist/esm/core/LogCorrelation.js +236 -0
- package/dist/esm/core/LogCorrelation.js.map +1 -0
- package/dist/esm/core/Metrics.js +297 -0
- package/dist/esm/core/Metrics.js.map +1 -0
- package/dist/esm/core/RootCause.js +107 -9
- package/dist/esm/core/RootCause.js.map +1 -1
- package/dist/esm/core/TrendAnalysis.js +250 -0
- package/dist/esm/core/TrendAnalysis.js.map +1 -0
- package/dist/esm/core/types.js +14 -0
- package/dist/esm/core/types.js.map +1 -1
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/middleware/express.js +105 -4
- package/dist/esm/middleware/express.js.map +1 -1
- package/dist/types/core/Alerting.d.ts +82 -0
- package/dist/types/core/Alerting.d.ts.map +1 -0
- package/dist/types/core/AnomalyDetection.d.ts +93 -0
- package/dist/types/core/AnomalyDetection.d.ts.map +1 -0
- package/dist/types/core/DependencyGraph.d.ts +65 -0
- package/dist/types/core/DependencyGraph.d.ts.map +1 -0
- package/dist/types/core/DistributedTracing.d.ts +92 -0
- package/dist/types/core/DistributedTracing.d.ts.map +1 -0
- package/dist/types/core/ErrorClustering.d.ts +70 -0
- package/dist/types/core/ErrorClustering.d.ts.map +1 -0
- package/dist/types/core/LogCorrelation.d.ts +73 -0
- package/dist/types/core/LogCorrelation.d.ts.map +1 -0
- package/dist/types/core/Metrics.d.ts +73 -0
- package/dist/types/core/Metrics.d.ts.map +1 -0
- package/dist/types/core/RootCause.d.ts +9 -5
- package/dist/types/core/RootCause.d.ts.map +1 -1
- package/dist/types/core/TrendAnalysis.d.ts +63 -0
- package/dist/types/core/TrendAnalysis.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +200 -0
- package/dist/types/core/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +9 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/middleware/express.d.ts +12 -0
- package/dist/types/middleware/express.d.ts.map +1 -1
- package/package.json +3 -3
- package/test-results.json +1 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { AnomalyResult, TimeSeriesPoint, Trace } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Anomaly Detector - Uses statistical methods to detect anomalies
|
|
4
|
+
*/
|
|
5
|
+
export declare class AnomalyDetector {
|
|
6
|
+
private baseline;
|
|
7
|
+
private readonly sensitivity;
|
|
8
|
+
private readonly minSamples;
|
|
9
|
+
private readonly decayFactor;
|
|
10
|
+
constructor(sensitivity?: number);
|
|
11
|
+
/**
|
|
12
|
+
* Record a data point for a metric
|
|
13
|
+
*/
|
|
14
|
+
record(metric: string, value: number, timestamp?: Date): void;
|
|
15
|
+
/**
|
|
16
|
+
* Check if a value is anomalous
|
|
17
|
+
*/
|
|
18
|
+
detect(metric: string, value: number, timestamp?: Date): AnomalyResult | null;
|
|
19
|
+
/**
|
|
20
|
+
* Analyze a trace for anomalies
|
|
21
|
+
*/
|
|
22
|
+
analyzeTrace(trace: Trace): AnomalyResult[];
|
|
23
|
+
/**
|
|
24
|
+
* Get baseline statistics for a metric
|
|
25
|
+
*/
|
|
26
|
+
getBaseline(metric: string): BaselineStats | null;
|
|
27
|
+
/**
|
|
28
|
+
* Get all baselines
|
|
29
|
+
*/
|
|
30
|
+
getAllBaselines(): Map<string, BaselineStats>;
|
|
31
|
+
/**
|
|
32
|
+
* Reset baseline for a metric
|
|
33
|
+
*/
|
|
34
|
+
reset(metric: string): void;
|
|
35
|
+
/**
|
|
36
|
+
* Clear all baselines
|
|
37
|
+
*/
|
|
38
|
+
clear(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Get percentiles for a metric
|
|
41
|
+
*/
|
|
42
|
+
getPercentiles(metric: string): {
|
|
43
|
+
p50: number;
|
|
44
|
+
p90: number;
|
|
45
|
+
p95: number;
|
|
46
|
+
p99: number;
|
|
47
|
+
} | null;
|
|
48
|
+
/**
|
|
49
|
+
* Detect seasonal patterns (simplified)
|
|
50
|
+
*/
|
|
51
|
+
detectSeasonality(metric: string, points: TimeSeriesPoint[], periodMs: number): boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Baseline statistics for a metric
|
|
55
|
+
*/
|
|
56
|
+
interface BaselineStats {
|
|
57
|
+
count: number;
|
|
58
|
+
mean: number;
|
|
59
|
+
m2: number;
|
|
60
|
+
min: number;
|
|
61
|
+
max: number;
|
|
62
|
+
ema?: number;
|
|
63
|
+
lastUpdated: Date;
|
|
64
|
+
values: number[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* CUSUM algorithm for change point detection
|
|
68
|
+
*/
|
|
69
|
+
export declare class CUSUMDetector {
|
|
70
|
+
private sum;
|
|
71
|
+
private target;
|
|
72
|
+
private threshold;
|
|
73
|
+
private drift;
|
|
74
|
+
private changePoints;
|
|
75
|
+
constructor(threshold?: number, drift?: number);
|
|
76
|
+
/**
|
|
77
|
+
* Process a new value and detect change points
|
|
78
|
+
*/
|
|
79
|
+
update(value: number, timestamp?: Date): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Get detected change points
|
|
82
|
+
*/
|
|
83
|
+
getChangePoints(): {
|
|
84
|
+
timestamp: Date;
|
|
85
|
+
value: number;
|
|
86
|
+
}[];
|
|
87
|
+
/**
|
|
88
|
+
* Reset detector
|
|
89
|
+
*/
|
|
90
|
+
reset(): void;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
93
|
+
//# sourceMappingURL=AnomalyDetection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnomalyDetection.d.ts","sourceRoot":"","sources":["../../../src/core/AnomalyDetection.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhE;;GAEG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,QAAQ,CAAyC;IACzD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ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B;AAED;;GAEG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,YAAY,CAA4C;gBAEpD,SAAS,GAAE,MAAU,EAAE,KAAK,GAAE,MAAY;IAKtD;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,GAAE,IAAiB,GAAG,OAAO;IAqB5D;;OAEG;IACH,eAAe,IAAI;QAAE,SAAS,EAAE,IAAI,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE;IAIvD;;OAEG;IACH,KAAK,IAAI,IAAI;CAKhB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DependencyGraph, DependencyNode, DependencyEdge, Trace } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Dependency Graph Manager - Tracks service dependencies and relationships
|
|
4
|
+
*/
|
|
5
|
+
export declare class DependencyGraphManager {
|
|
6
|
+
private nodes;
|
|
7
|
+
private edges;
|
|
8
|
+
private lastUpdated;
|
|
9
|
+
/**
|
|
10
|
+
* Process a trace and update dependency graph
|
|
11
|
+
*/
|
|
12
|
+
processTrace(trace: Trace): void;
|
|
13
|
+
/**
|
|
14
|
+
* Get the complete dependency graph
|
|
15
|
+
*/
|
|
16
|
+
getGraph(): DependencyGraph;
|
|
17
|
+
/**
|
|
18
|
+
* Get node by ID
|
|
19
|
+
*/
|
|
20
|
+
getNode(id: string): DependencyNode | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Get all nodes
|
|
23
|
+
*/
|
|
24
|
+
getNodes(): DependencyNode[];
|
|
25
|
+
/**
|
|
26
|
+
* Get edges for a node
|
|
27
|
+
*/
|
|
28
|
+
getEdges(nodeId: string): DependencyEdge[];
|
|
29
|
+
/**
|
|
30
|
+
* Get all edges
|
|
31
|
+
*/
|
|
32
|
+
getAllEdges(): DependencyEdge[];
|
|
33
|
+
/**
|
|
34
|
+
* Get critical path (highest latency chain)
|
|
35
|
+
*/
|
|
36
|
+
getCriticalPath(): {
|
|
37
|
+
path: string[];
|
|
38
|
+
totalLatency: number;
|
|
39
|
+
} | null;
|
|
40
|
+
/**
|
|
41
|
+
* Get unhealthy dependencies
|
|
42
|
+
*/
|
|
43
|
+
getUnhealthyDependencies(): DependencyNode[];
|
|
44
|
+
/**
|
|
45
|
+
* Get top slow dependencies
|
|
46
|
+
*/
|
|
47
|
+
getTopSlowDependencies(limit?: number): DependencyNode[];
|
|
48
|
+
/**
|
|
49
|
+
* Get top error-prone dependencies
|
|
50
|
+
*/
|
|
51
|
+
getTopErrorProneDependencies(limit?: number): DependencyNode[];
|
|
52
|
+
/**
|
|
53
|
+
* Clear graph
|
|
54
|
+
*/
|
|
55
|
+
clear(): void;
|
|
56
|
+
private updateNode;
|
|
57
|
+
private updateEdge;
|
|
58
|
+
private calculateStatus;
|
|
59
|
+
private getServiceName;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Visualize dependency graph as ASCII (for console)
|
|
63
|
+
*/
|
|
64
|
+
export declare function visualizeDependencyGraph(graph: DependencyGraph): string;
|
|
65
|
+
//# sourceMappingURL=DependencyGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DependencyGraph.d.ts","sourceRoot":"","sources":["../../../src/core/DependencyGraph.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAA2B,KAAK,EAAE,MAAM,SAAS,CAAC;AAE1G;;GAEG;AACH,qBAAa,sBAAsB;IAC/B,OAAO,CAAC,KAAK,CAA0C;IACvD,OAAO,CAAC,KAAK,CAAuD;IACpE,OAAO,CAAC,WAAW,CAAoB;IAEvC;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IA+BhC;;OAEG;IACH,QAAQ,IAAI,eAAe;IAQ3B;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAI/C;;OAEG;IACH,QAAQ,IAAI,cAAc,EAAE;IAI5B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,EAAE;IAM1C;;OAEG;IACH,WAAW,IAAI,cAAc,EAAE;IAU/B;;OAEG;IACH,eAAe,IAAI;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAsClE;;OAEG;IACH,wBAAwB,IAAI,cAAc,EAAE;IAI5C;;OAEG;IACH,sBAAsB,CAAC,KAAK,GAAE,MAAW,GAAG,cAAc,EAAE;IAM5D;;OAEG;IACH,4BAA4B,CAAC,KAAK,GAAE,MAAW,GAAG,cAAc,EAAE;IAOlE;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb,OAAO,CAAC,UAAU;IAgClB,OAAO,CAAC,UAAU;IA6BlB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,cAAc;CAkBzB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAsBvE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { TraceContext, Span } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* W3C Trace Context implementation
|
|
4
|
+
* Format: traceparent: 00-{traceId}-{spanId}-{traceFlags}
|
|
5
|
+
* https://www.w3.org/TR/trace-context/
|
|
6
|
+
*/
|
|
7
|
+
export declare class DistributedTracer {
|
|
8
|
+
private static TRACEPARENT_VERSION;
|
|
9
|
+
private static TRACE_FLAG_SAMPLED;
|
|
10
|
+
private static TRACE_FLAG_NOT_SAMPLED;
|
|
11
|
+
/**
|
|
12
|
+
* Generate a 128-bit trace ID (32 hex chars)
|
|
13
|
+
*/
|
|
14
|
+
static generateTraceId(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Generate a 64-bit span ID (16 hex chars)
|
|
17
|
+
*/
|
|
18
|
+
static generateSpanId(): string;
|
|
19
|
+
private static randomHex;
|
|
20
|
+
/**
|
|
21
|
+
* Create traceparent header from context
|
|
22
|
+
*/
|
|
23
|
+
static createTraceparent(context: TraceContext): string;
|
|
24
|
+
/**
|
|
25
|
+
* Parse traceparent header into context
|
|
26
|
+
*/
|
|
27
|
+
static parseTraceparent(traceparent: string): TraceContext | null;
|
|
28
|
+
/**
|
|
29
|
+
* Create tracestate header for vendor-specific data
|
|
30
|
+
*/
|
|
31
|
+
static createTracestate(vendorData: Record<string, string>): string;
|
|
32
|
+
/**
|
|
33
|
+
* Parse tracestate header
|
|
34
|
+
*/
|
|
35
|
+
static parseTracestate(tracestate: string): Record<string, string>;
|
|
36
|
+
/**
|
|
37
|
+
* Extract context from incoming headers
|
|
38
|
+
*/
|
|
39
|
+
static extractContext(headers: Record<string, string | undefined>): TraceContext | null;
|
|
40
|
+
/**
|
|
41
|
+
* Inject context into outgoing headers
|
|
42
|
+
*/
|
|
43
|
+
static injectContext(context: TraceContext, headers: Record<string, string>): void;
|
|
44
|
+
/**
|
|
45
|
+
* Create a new span context for child operations
|
|
46
|
+
*/
|
|
47
|
+
static createChildContext(parent: TraceContext): TraceContext;
|
|
48
|
+
/**
|
|
49
|
+
* Create a root context for new traces
|
|
50
|
+
*/
|
|
51
|
+
static createRootContext(sampled?: boolean): TraceContext;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Span manager for nested span tracking
|
|
55
|
+
*/
|
|
56
|
+
export declare class SpanManager {
|
|
57
|
+
private spans;
|
|
58
|
+
private rootSpanId?;
|
|
59
|
+
/**
|
|
60
|
+
* Start a new span
|
|
61
|
+
*/
|
|
62
|
+
startSpan(name: string, context: TraceContext, parentSpanId?: string): Span;
|
|
63
|
+
/**
|
|
64
|
+
* End a span
|
|
65
|
+
*/
|
|
66
|
+
endSpan(spanId: string, status?: 'success' | 'error' | 'timeout'): Span | null;
|
|
67
|
+
/**
|
|
68
|
+
* Add attribute to a span
|
|
69
|
+
*/
|
|
70
|
+
setAttribute(spanId: string, key: string, value: unknown): void;
|
|
71
|
+
/**
|
|
72
|
+
* Add event to a span
|
|
73
|
+
*/
|
|
74
|
+
addEvent(spanId: string, name: string, attributes?: Record<string, unknown>): void;
|
|
75
|
+
/**
|
|
76
|
+
* Get span by ID
|
|
77
|
+
*/
|
|
78
|
+
getSpan(spanId: string): Span | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Get all spans in this trace
|
|
81
|
+
*/
|
|
82
|
+
getAllSpans(): Span[];
|
|
83
|
+
/**
|
|
84
|
+
* Get span hierarchy (tree structure)
|
|
85
|
+
*/
|
|
86
|
+
getSpanTree(): Span[];
|
|
87
|
+
/**
|
|
88
|
+
* Clear all spans
|
|
89
|
+
*/
|
|
90
|
+
clear(): void;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=DistributedTracing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DistributedTracing.d.ts","sourceRoot":"","sources":["../../../src/core/DistributedTracing.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;GAIG;AACH,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAQ;IAC1C,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAQ;IACzC,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAQ;IAE7C;;OAEG;IACH,MAAM,CAAC,eAAe,IAAI,MAAM;IAMhC;;OAEG;IACH,MAAM,CAAC,cAAc,IAAI,MAAM;IAI/B,OAAO,CAAC,MAAM,CAAC,SAAS;IAQxB;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM;IAKvD;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,I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H,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAIzC;;OAEG;IACH,WAAW,IAAI,IAAI,EAAE;IAIrB;;OAEG;IACH,WAAW,IAAI,IAAI,EAAE;IAiBrB;;OAEG;IACH,KAAK,IAAI,IAAI;CAIhB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ErrorCluster, Trace, ServiceTag } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Error Cluster Manager - Groups similar errors for easier debugging
|
|
4
|
+
*/
|
|
5
|
+
export declare class ErrorClusterManager {
|
|
6
|
+
private clusters;
|
|
7
|
+
private maxClusters;
|
|
8
|
+
constructor(maxClusters?: number);
|
|
9
|
+
/**
|
|
10
|
+
* Process a trace and cluster any errors
|
|
11
|
+
*/
|
|
12
|
+
processTrace(trace: Trace): ErrorCluster | null;
|
|
13
|
+
/**
|
|
14
|
+
* Get all clusters
|
|
15
|
+
*/
|
|
16
|
+
getClusters(): ErrorCluster[];
|
|
17
|
+
/**
|
|
18
|
+
* Get cluster by fingerprint
|
|
19
|
+
*/
|
|
20
|
+
getCluster(fingerprint: string): ErrorCluster | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Get cluster by ID
|
|
23
|
+
*/
|
|
24
|
+
getClusterById(id: string): ErrorCluster | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Get top N clusters
|
|
27
|
+
*/
|
|
28
|
+
getTopClusters(limit?: number): ErrorCluster[];
|
|
29
|
+
/**
|
|
30
|
+
* Get new clusters (first seen in last hour)
|
|
31
|
+
*/
|
|
32
|
+
getNewClusters(): ErrorCluster[];
|
|
33
|
+
/**
|
|
34
|
+
* Get recurring clusters (more than 10 occurrences)
|
|
35
|
+
*/
|
|
36
|
+
getRecurringClusters(): ErrorCluster[];
|
|
37
|
+
/**
|
|
38
|
+
* Clear a cluster
|
|
39
|
+
*/
|
|
40
|
+
clearCluster(fingerprint: string): void;
|
|
41
|
+
/**
|
|
42
|
+
* Clear all clusters
|
|
43
|
+
*/
|
|
44
|
+
clear(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Get cluster statistics
|
|
47
|
+
*/
|
|
48
|
+
getStats(): {
|
|
49
|
+
totalClusters: number;
|
|
50
|
+
totalErrors: number;
|
|
51
|
+
avgClusterSize: number;
|
|
52
|
+
topServices: {
|
|
53
|
+
service: ServiceTag;
|
|
54
|
+
count: number;
|
|
55
|
+
}[];
|
|
56
|
+
};
|
|
57
|
+
private createFingerprint;
|
|
58
|
+
private getErrorMessage;
|
|
59
|
+
private normalizeError;
|
|
60
|
+
private normalizeStackTrace;
|
|
61
|
+
private normalizeEndpoint;
|
|
62
|
+
private getWorstSeverity;
|
|
63
|
+
private trimOldestCluster;
|
|
64
|
+
private generateClusterId;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get similarity score between two error messages
|
|
68
|
+
*/
|
|
69
|
+
export declare function getErrorSimilarity(error1: string, error2: string): number;
|
|
70
|
+
//# sourceMappingURL=ErrorClustering.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorClustering.d.ts","sourceRoot":"","sources":["../../../src/core/ErrorClustering.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAuB,UAAU,EAAE,MAAM,SAAS,CAAC;AAE/E;;GAEG;AACH,qBAAa,mBAAmB;IAC5B,OAAO,CAAC,QAAQ,CAAwC;IACxD,OAAO,CAAC,WAAW,CAAc;gBAErB,WAAW,GAAE,MAAW;IAIpC;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,GAAG,IAAI;IA+D/C;;OAEG;IACH,WAAW,IAAI,YAAY,EAAE;IAO7B;;OAEG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIzD;;OAEG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAIpD;;OAEG;IACH,cAAc,CAAC,KAAK,GAAE,MAAW,GAAG,YAAY,EAAE;IAIlD;;OAEG;IACH,cAAc,IAAI,YAAY,EAAE;IAKhC;;OAEG;IACH,oBAAoB,IAAI,YAAY,EAAE;IAItC;;OAEG;IACH,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIvC;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,QAAQ,IAAI;QACR,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE;YAAE,OAAO,EAAE,UAAU,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KACzD;IAyBD,OAAO,CAAC,iBAAiB;IA6BzB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,iBAAiB;CAG5B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAWzE"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { TraceContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Log Correlation - Links logs to traces via traceId injection
|
|
4
|
+
*/
|
|
5
|
+
export declare class LogCorrelator {
|
|
6
|
+
private enabled;
|
|
7
|
+
private currentContext;
|
|
8
|
+
private originalConsole;
|
|
9
|
+
private includeTimestamp;
|
|
10
|
+
private includeLevel;
|
|
11
|
+
private customFields;
|
|
12
|
+
constructor(enabled?: boolean);
|
|
13
|
+
/**
|
|
14
|
+
* Enable log correlation
|
|
15
|
+
*/
|
|
16
|
+
enable(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Disable log correlation
|
|
19
|
+
*/
|
|
20
|
+
disable(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Set current trace context for logging
|
|
23
|
+
*/
|
|
24
|
+
setContext(context: TraceContext): void;
|
|
25
|
+
/**
|
|
26
|
+
* Clear current trace context
|
|
27
|
+
*/
|
|
28
|
+
clearContext(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Add custom fields to all log messages
|
|
31
|
+
*/
|
|
32
|
+
addCustomFields(fields: Record<string, unknown>): void;
|
|
33
|
+
/**
|
|
34
|
+
* Clear custom fields
|
|
35
|
+
*/
|
|
36
|
+
clearCustomFields(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Create a logger with automatic trace context
|
|
39
|
+
*/
|
|
40
|
+
createLogger(name: string): CorrelatedLogger;
|
|
41
|
+
/**
|
|
42
|
+
* Format log message with correlation data
|
|
43
|
+
*/
|
|
44
|
+
formatMessage(message: string, level?: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Format log as JSON for structured logging
|
|
47
|
+
*/
|
|
48
|
+
formatJSON(message: string, metadata?: Record<string, unknown>): string;
|
|
49
|
+
private patchConsole;
|
|
50
|
+
private restoreConsole;
|
|
51
|
+
private intercept;
|
|
52
|
+
private getCurrentContext;
|
|
53
|
+
private getRequestId;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Correlated Logger - Logger instance with automatic trace context
|
|
57
|
+
*/
|
|
58
|
+
export declare class CorrelatedLogger {
|
|
59
|
+
private name;
|
|
60
|
+
private correlator;
|
|
61
|
+
constructor(name: string, correlator: LogCorrelator);
|
|
62
|
+
info(message: string, metadata?: Record<string, unknown>): void;
|
|
63
|
+
warn(message: string, metadata?: Record<string, unknown>): void;
|
|
64
|
+
error(message: string, metadata?: Record<string, unknown>): void;
|
|
65
|
+
debug(message: string, metadata?: Record<string, unknown>): void;
|
|
66
|
+
child(fields: Record<string, unknown>): CorrelatedLogger;
|
|
67
|
+
private log;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Express middleware to set trace context for logging
|
|
71
|
+
*/
|
|
72
|
+
export declare function logCorrelationMiddleware(correlator: LogCorrelator): (req: any, res: any, next: () => void) => void;
|
|
73
|
+
//# sourceMappingURL=LogCorrelation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LogCorrelation.d.ts","sourceRoot":"","sources":["../../../src/core/LogCorrelation.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;GAEG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,cAAc,CAAwC;IAC9D,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,gBAAgB,CAAiB;IACzC,OAAO,CAAC,YAAY,CAAiB;IACrC,OAAO,CAAC,YAAY,CAA+B;gBAEvC,OAAO,GAAE,OAAe;IAOpC;;OAEG;IACH,MAAM,IAAI,IAAI;IAOd;;OAEG;IACH,OAAO,IAAI,IAAI;IAOf;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI;IAOvC;;OAEG;IACH,YAAY,IAAI,IAAI;IAOpB;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAItD;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAIzB;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;IAI5C;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAe,GAAG,MAAM;IA+B9D;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;IAwBvE,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,SAAS;IAYjB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,YAAY;CAevB;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAErB,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,UAAU;gBADV,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,aAAa;IAGrC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI/D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI/D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhE,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB;IAKxD,OAAO,CAAC,GAAG;CAWd;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,aAAa,IACtD,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,IAAI,UAU/C"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Metric, CounterMetric, GaugeMetric, HistogramMetric, SummaryMetric, TimeSeriesPoint } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Metrics Registry - Central storage for all metrics
|
|
4
|
+
*/
|
|
5
|
+
export declare class MetricsRegistry {
|
|
6
|
+
private metrics;
|
|
7
|
+
private timeSeries;
|
|
8
|
+
private maxTimeSeriesPoints;
|
|
9
|
+
/**
|
|
10
|
+
* Create or get a counter metric
|
|
11
|
+
*/
|
|
12
|
+
counter(name: string, description?: string, labels?: Record<string, string>): CounterMetric;
|
|
13
|
+
/**
|
|
14
|
+
* Create or get a gauge metric
|
|
15
|
+
*/
|
|
16
|
+
gauge(name: string, description?: string, labels?: Record<string, string>): GaugeMetric;
|
|
17
|
+
/**
|
|
18
|
+
* Create or get a histogram metric
|
|
19
|
+
*/
|
|
20
|
+
histogram(name: string, buckets?: number[], description?: string, labels?: Record<string, string>): HistogramMetric;
|
|
21
|
+
/**
|
|
22
|
+
* Create or get a summary metric
|
|
23
|
+
*/
|
|
24
|
+
summary(name: string, quantiles?: number[], description?: string, labels?: Record<string, string>): SummaryMetric;
|
|
25
|
+
/**
|
|
26
|
+
* Increment a counter
|
|
27
|
+
*/
|
|
28
|
+
inc(name: string, value?: number, labels?: Record<string, string>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Set a gauge value
|
|
31
|
+
*/
|
|
32
|
+
set(name: string, value: number, labels?: Record<string, string>): void;
|
|
33
|
+
/**
|
|
34
|
+
* Observe a value for histogram/summary
|
|
35
|
+
*/
|
|
36
|
+
observe(name: string, value: number, labels?: Record<string, string>): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get metric by name
|
|
39
|
+
*/
|
|
40
|
+
get(name: string, labels?: Record<string, string>): Metric | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Get all metrics
|
|
43
|
+
*/
|
|
44
|
+
getAll(): Metric[];
|
|
45
|
+
/**
|
|
46
|
+
* Get metrics by type
|
|
47
|
+
*/
|
|
48
|
+
getByType(type: Metric['type']): Metric[];
|
|
49
|
+
/**
|
|
50
|
+
* Reset a metric
|
|
51
|
+
*/
|
|
52
|
+
reset(name: string, labels?: Record<string, string>): void;
|
|
53
|
+
/**
|
|
54
|
+
* Clear all metrics
|
|
55
|
+
*/
|
|
56
|
+
clear(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Get time series data for a metric
|
|
59
|
+
*/
|
|
60
|
+
getTimeSeries(name: string, labels?: Record<string, string>): TimeSeriesPoint[];
|
|
61
|
+
/**
|
|
62
|
+
* Export metrics in Prometheus format
|
|
63
|
+
*/
|
|
64
|
+
exportPrometheus(): string;
|
|
65
|
+
private makeKey;
|
|
66
|
+
private recordTimeSeries;
|
|
67
|
+
private updateQuantiles;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Global metrics registry instance
|
|
71
|
+
*/
|
|
72
|
+
export declare const globalMetrics: MetricsRegistry;
|
|
73
|
+
//# sourceMappingURL=Metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Metrics.d.ts","sourceRoot":"","sources":["../../../src/core/Metrics.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,MAAM,EACN,aAAa,EACb,WAAW,EACX,eAAe,EACf,aAAa,EACb,eAAe,EAClB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,OAAO,CAAkC;IACjD,OAAO,CAAC,UAAU,CAA6C;IAC/D,OAAO,CAAC,mBAAmB,CAAgB;IAE3C;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,aAAa;IAkB3F;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,WAAW;IAkBvF;;OAEG;IACH,SAAS,CACL,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAM,EAA8D,EAC7E,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,eAAe;IAoBlB;;OAEG;IACH,OAAO,CACH,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,MAAM,EAA2B,EAC5C,WAAW,CAAC,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,C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Result {
|
|
|
16
16
|
/**
|
|
17
17
|
* Enhanced root cause detection with suggestions and detailed analysis.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
* 1.
|
|
21
|
-
* 2.
|
|
22
|
-
* 3.
|
|
23
|
-
* 4.
|
|
19
|
+
* DETECTS:
|
|
20
|
+
* 1. Error patterns (timeout, connection, validation, etc.)
|
|
21
|
+
* 2. Slow queries and bottlenecks
|
|
22
|
+
* 3. Memory/performance issues
|
|
23
|
+
* 4. SILENT FAILURES (no console error but status codes indicate problems)
|
|
24
|
+
* 5. Empty/null database results without errors
|
|
25
|
+
* 6. Performance degradation trends
|
|
26
|
+
*
|
|
27
|
+
* Provides actionable suggestions for each issue type.
|
|
24
28
|
*/
|
|
25
29
|
export declare function detectRootCause(steps: TraceStep[], statusCode: number | undefined, config: Pick<DebuggerConfig, 'slowThreshold' | 'slowQueryThreshold'>): EnhancedRootCauseResult | null;
|
|
26
30
|
//# sourceMappingURL=RootCause.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RootCause.d.ts","sourceRoot":"","sources":["../../../src/core/RootCause.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RootCause.d.ts","sourceRoot":"","sources":["../../../src/core/RootCause.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,SAAS,EACT,eAAe,EACf,cAAc,EACd,UAAU,EAEb,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC5D,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,mBAAmB,EAAE,KAAK,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,UAAU,CAAC;KACvB,CAAC,CAAC;IACH,YAAY,CAAC,EAAE;QACX,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACL;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC3B,KAAK,EAAE,SAAS,EAAE,EAClB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE,eAAe,GAAG,oBAAoB,CAAC,GACrE,uBAAuB,GAAG,IAAI,CA0UhC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TrendResult, Trace } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Trend Analyzer - Detects patterns and trends in metrics
|
|
4
|
+
*/
|
|
5
|
+
export declare class TrendAnalyzer {
|
|
6
|
+
private timeSeries;
|
|
7
|
+
private resolutionMs;
|
|
8
|
+
private maxPoints;
|
|
9
|
+
constructor(resolutionMinutes?: number);
|
|
10
|
+
/**
|
|
11
|
+
* Record a data point
|
|
12
|
+
*/
|
|
13
|
+
record(metric: string, value: number, timestamp?: Date): void;
|
|
14
|
+
/**
|
|
15
|
+
* Record from trace
|
|
16
|
+
*/
|
|
17
|
+
recordTrace(trace: Trace): void;
|
|
18
|
+
/**
|
|
19
|
+
* Analyze trend for a metric
|
|
20
|
+
*/
|
|
21
|
+
analyzeTrend(metric: string, windowMs?: number): TrendResult | null;
|
|
22
|
+
/**
|
|
23
|
+
* Get all trends
|
|
24
|
+
*/
|
|
25
|
+
getAllTrends(windowMs?: number): TrendResult[];
|
|
26
|
+
/**
|
|
27
|
+
* Get increasing trends (potential issues)
|
|
28
|
+
*/
|
|
29
|
+
getIncreasingTrends(windowMs?: number): TrendResult[];
|
|
30
|
+
/**
|
|
31
|
+
* Detect capacity issues
|
|
32
|
+
*/
|
|
33
|
+
detectCapacityIssues(): {
|
|
34
|
+
metric: string;
|
|
35
|
+
current: number;
|
|
36
|
+
projected: number;
|
|
37
|
+
timeToThreshold: string;
|
|
38
|
+
}[];
|
|
39
|
+
/**
|
|
40
|
+
* Get hourly pattern (average by hour of day)
|
|
41
|
+
*/
|
|
42
|
+
getHourlyPattern(metric: string): {
|
|
43
|
+
hour: number;
|
|
44
|
+
avgValue: number;
|
|
45
|
+
}[];
|
|
46
|
+
/**
|
|
47
|
+
* Get daily pattern (average by day of week)
|
|
48
|
+
*/
|
|
49
|
+
getDailyPattern(metric: string): {
|
|
50
|
+
day: number;
|
|
51
|
+
avgValue: number;
|
|
52
|
+
}[];
|
|
53
|
+
/**
|
|
54
|
+
* Clear time series
|
|
55
|
+
*/
|
|
56
|
+
clear(metric?: string): void;
|
|
57
|
+
private linearRegression;
|
|
58
|
+
private getTrendDirection;
|
|
59
|
+
private calculateChangePercent;
|
|
60
|
+
private calculateConfidence;
|
|
61
|
+
private projectTimeToThreshold;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=TrendAnalysis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrendAnalysis.d.ts","sourceRoot":"","sources":["../../../src/core/TrendAnalysis.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAmC,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9E;;GAEG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,UAAU,CAA6C;IAC/D,OAAO,CAAC,YAAY,CAA0B;IAC9C,OAAO,CAAC,SAAS,CAAgB;gBAErB,iBAAiB,GAAE,MAAW;IAI1C;;OAEG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,GAAE,IAAiB,GAAG,IAAI;IAgCzE;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAa/B;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA4B,GAAG,WAAW,GAAG,IAAI;IAgCxF;;OAEG;IACH,YAAY,CAAC,QAAQ,GAAE,MAA4B,GAAG,WAAW,EAAE;IAanE;;OAEG;IACH,mBAAmB,CAAC,QAAQ,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