@scoutflo/alert-correlation 0.2.0 → 0.3.0
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 +11 -3
- package/dist/src/contracts/alertEvidence.d.ts +161 -0
- package/dist/src/contracts/alertEvidence.js +44 -0
- package/dist/src/contracts/alertEvidence.js.map +1 -0
- package/dist/src/contracts/alertRef.d.ts +1 -7
- package/dist/src/contracts/alertRef.js +1 -3
- package/dist/src/contracts/alertRef.js.map +1 -1
- package/dist/src/contracts/context.d.ts +7 -11
- package/dist/src/contracts/decision.d.ts +4 -9
- package/dist/src/contracts/facts.d.ts +8 -8
- package/dist/src/contracts/index.d.ts +1 -0
- package/dist/src/contracts/index.js +1 -0
- package/dist/src/contracts/index.js.map +1 -1
- package/dist/src/contracts/topology.d.ts +3 -5
- package/dist/src/decision/reasonCodes.d.ts +6 -0
- package/dist/src/decision/reasonCodes.js +6 -0
- package/dist/src/decision/reasonCodes.js.map +1 -1
- package/dist/src/extractors/genericExtractor.js +30 -12
- package/dist/src/extractors/genericExtractor.js.map +1 -1
- package/dist/src/extractors/prometheusExtractor.js +14 -7
- package/dist/src/extractors/prometheusExtractor.js.map +1 -1
- package/dist/src/extractors/registry.js +1 -1
- package/dist/src/extractors/registry.js.map +1 -1
- package/dist/src/extractors/sentryExtractor.js +42 -34
- package/dist/src/extractors/sentryExtractor.js.map +1 -1
- package/dist/src/extractors/types.d.ts +3 -4
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +25 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/resolveAlertCorrelation.d.ts +3 -4
- package/dist/src/resolveAlertCorrelation.js +2 -3
- package/dist/src/resolveAlertCorrelation.js.map +1 -1
- package/dist/src/time/normalizeAlertTime.d.ts +2 -2
- package/dist/src/time/normalizeAlertTime.js +8 -7
- package/dist/src/time/normalizeAlertTime.js.map +1 -1
- package/dist/test/contracts.test.js +67 -8
- package/dist/test/contracts.test.js.map +1 -1
- package/dist/test/core-compatibility.test.d.ts +1 -0
- package/dist/test/core-compatibility.test.js +50 -0
- package/dist/test/core-compatibility.test.js.map +1 -0
- package/dist/test/fixtures.d.ts +48 -0
- package/dist/test/fixtures.js +51 -0
- package/dist/test/fixtures.js.map +1 -0
- package/dist/test/generic-extractor.test.js +28 -8
- package/dist/test/generic-extractor.test.js.map +1 -1
- package/dist/test/prometheus-extractor.test.js +34 -8
- package/dist/test/prometheus-extractor.test.js.map +1 -1
- package/dist/test/provider-hardening.test.js +99 -82
- package/dist/test/provider-hardening.test.js.map +1 -1
- package/dist/test/resolve-alert-correlation.test.js +9 -4
- package/dist/test/resolve-alert-correlation.test.js.map +1 -1
- package/dist/test/sentry-extractor.test.js +10 -10
- package/dist/test/sentry-extractor.test.js.map +1 -1
- package/dist/test/time.test.js +20 -14
- package/dist/test/time.test.js.map +1 -1
- package/dist/test/victoriametrics-extractor.test.js +8 -8
- package/dist/test/victoriametrics-extractor.test.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -4,14 +4,22 @@ Pure alert-to-topology correlation contracts and policies for Scoutflo alert inv
|
|
|
4
4
|
|
|
5
5
|
This package intentionally owns only shared contracts, extraction, matching, scoring, and decision logic. Provider detail fetching, tenant authorization, topology loading, topology slice construction, and API response shaping stay in Gateway. Investigation lifecycle and supervisor startup stay in Voyager.
|
|
6
6
|
|
|
7
|
+
## Relationship To Correlation Core
|
|
8
|
+
|
|
9
|
+
Reusable cross-mode contracts live in `@scoutflo/correlation-core`.
|
|
10
|
+
|
|
11
|
+
`@scoutflo/alert-correlation` remains alert-specific. It owns `AlertRef`, alert time windows, provider alert extractors, alert-to-topology matching, alert-specific scoring, and alert decision behavior.
|
|
12
|
+
|
|
13
|
+
This package consumes core entity, fact, and status primitives where safe. It also exports `correlationCore` as a namespace for compatibility during migration, without replacing existing alert-specific export names.
|
|
14
|
+
|
|
7
15
|
## Version
|
|
8
16
|
|
|
9
|
-
Current package version: `0.2.
|
|
17
|
+
Current package version: `0.2.1`.
|
|
10
18
|
|
|
11
19
|
Gateway and Voyager should consume the exact published version:
|
|
12
20
|
|
|
13
21
|
```json
|
|
14
|
-
"@scoutflo/alert-correlation": "0.2.
|
|
22
|
+
"@scoutflo/alert-correlation": "0.2.1"
|
|
15
23
|
```
|
|
16
24
|
|
|
17
25
|
During local development, consumers may temporarily use a `file:` dependency pointed at `../integration-sdk/packages/alert-correlation`, then replace it with the exact npm version before release.
|
|
@@ -88,7 +96,7 @@ If `npm view` returns `E404` immediately after a successful publish, wait and re
|
|
|
88
96
|
After the version is visible, update Gateway and Voyager from any local `file:` dependency to the exact published version, for example:
|
|
89
97
|
|
|
90
98
|
```json
|
|
91
|
-
"@scoutflo/alert-correlation": "0.2.
|
|
99
|
+
"@scoutflo/alert-correlation": "0.2.1"
|
|
92
100
|
```
|
|
93
101
|
|
|
94
102
|
Run install and the relevant tests in each consumer repo after updating its dependency lockfile.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const alertOccurrenceRefSchema: z.ZodObject<{
|
|
3
|
+
occurrenceId: z.ZodString;
|
|
4
|
+
alertRef: z.ZodObject<{
|
|
5
|
+
integrationId: z.ZodString;
|
|
6
|
+
provider: z.ZodString;
|
|
7
|
+
alertKey: z.ZodString;
|
|
8
|
+
}, "strict", z.ZodTypeAny, {
|
|
9
|
+
integrationId: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
alertKey: string;
|
|
12
|
+
}, {
|
|
13
|
+
integrationId: string;
|
|
14
|
+
provider: string;
|
|
15
|
+
alertKey: string;
|
|
16
|
+
}>;
|
|
17
|
+
evidenceRef: z.ZodString;
|
|
18
|
+
}, "strict", z.ZodTypeAny, {
|
|
19
|
+
occurrenceId: string;
|
|
20
|
+
alertRef: {
|
|
21
|
+
integrationId: string;
|
|
22
|
+
provider: string;
|
|
23
|
+
alertKey: string;
|
|
24
|
+
};
|
|
25
|
+
evidenceRef: string;
|
|
26
|
+
}, {
|
|
27
|
+
occurrenceId: string;
|
|
28
|
+
alertRef: {
|
|
29
|
+
integrationId: string;
|
|
30
|
+
provider: string;
|
|
31
|
+
alertKey: string;
|
|
32
|
+
};
|
|
33
|
+
evidenceRef: string;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const alertEvidenceSourceSchema: z.ZodEnum<["provider_list", "provider_detail", "provider_webhook", "slack_notification"]>;
|
|
36
|
+
export declare const alertEvidencePresentationSchema: z.ZodObject<{
|
|
37
|
+
title: z.ZodOptional<z.ZodString>;
|
|
38
|
+
severity: z.ZodOptional<z.ZodString>;
|
|
39
|
+
status: z.ZodOptional<z.ZodString>;
|
|
40
|
+
description: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
status?: string | undefined;
|
|
43
|
+
title?: string | undefined;
|
|
44
|
+
severity?: string | undefined;
|
|
45
|
+
description?: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
status?: string | undefined;
|
|
48
|
+
title?: string | undefined;
|
|
49
|
+
severity?: string | undefined;
|
|
50
|
+
description?: string | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
export declare const alertEvidenceSnapshotSchema: z.ZodObject<{
|
|
53
|
+
evidenceRef: z.ZodString;
|
|
54
|
+
occurrenceId: z.ZodString;
|
|
55
|
+
alertRef: z.ZodObject<{
|
|
56
|
+
integrationId: z.ZodString;
|
|
57
|
+
provider: z.ZodString;
|
|
58
|
+
alertKey: z.ZodString;
|
|
59
|
+
}, "strict", z.ZodTypeAny, {
|
|
60
|
+
integrationId: string;
|
|
61
|
+
provider: string;
|
|
62
|
+
alertKey: string;
|
|
63
|
+
}, {
|
|
64
|
+
integrationId: string;
|
|
65
|
+
provider: string;
|
|
66
|
+
alertKey: string;
|
|
67
|
+
}>;
|
|
68
|
+
evidenceSource: z.ZodEnum<["provider_list", "provider_detail", "provider_webhook", "slack_notification"]>;
|
|
69
|
+
capturedAt: z.ZodString;
|
|
70
|
+
observedAt: z.ZodOptional<z.ZodString>;
|
|
71
|
+
startsAt: z.ZodOptional<z.ZodString>;
|
|
72
|
+
endsAt: z.ZodOptional<z.ZodString>;
|
|
73
|
+
state: z.ZodOptional<z.ZodString>;
|
|
74
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
75
|
+
annotations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
76
|
+
tags: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
77
|
+
providerIds: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
78
|
+
sourceUrls: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
79
|
+
presentation: z.ZodObject<{
|
|
80
|
+
title: z.ZodOptional<z.ZodString>;
|
|
81
|
+
severity: z.ZodOptional<z.ZodString>;
|
|
82
|
+
status: z.ZodOptional<z.ZodString>;
|
|
83
|
+
description: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, "strict", z.ZodTypeAny, {
|
|
85
|
+
status?: string | undefined;
|
|
86
|
+
title?: string | undefined;
|
|
87
|
+
severity?: string | undefined;
|
|
88
|
+
description?: string | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
status?: string | undefined;
|
|
91
|
+
title?: string | undefined;
|
|
92
|
+
severity?: string | undefined;
|
|
93
|
+
description?: string | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
rawPreview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
96
|
+
rawHash: z.ZodOptional<z.ZodString>;
|
|
97
|
+
schemaVersion: z.ZodString;
|
|
98
|
+
redactionVersion: z.ZodString;
|
|
99
|
+
}, "strict", z.ZodTypeAny, {
|
|
100
|
+
occurrenceId: string;
|
|
101
|
+
alertRef: {
|
|
102
|
+
integrationId: string;
|
|
103
|
+
provider: string;
|
|
104
|
+
alertKey: string;
|
|
105
|
+
};
|
|
106
|
+
evidenceRef: string;
|
|
107
|
+
evidenceSource: "provider_list" | "provider_detail" | "provider_webhook" | "slack_notification";
|
|
108
|
+
capturedAt: string;
|
|
109
|
+
presentation: {
|
|
110
|
+
status?: string | undefined;
|
|
111
|
+
title?: string | undefined;
|
|
112
|
+
severity?: string | undefined;
|
|
113
|
+
description?: string | undefined;
|
|
114
|
+
};
|
|
115
|
+
schemaVersion: string;
|
|
116
|
+
redactionVersion: string;
|
|
117
|
+
observedAt?: string | undefined;
|
|
118
|
+
startsAt?: string | undefined;
|
|
119
|
+
endsAt?: string | undefined;
|
|
120
|
+
state?: string | undefined;
|
|
121
|
+
labels?: Record<string, string> | undefined;
|
|
122
|
+
annotations?: Record<string, string> | undefined;
|
|
123
|
+
tags?: Record<string, string> | undefined;
|
|
124
|
+
providerIds?: Record<string, string> | undefined;
|
|
125
|
+
sourceUrls?: Record<string, string> | undefined;
|
|
126
|
+
rawPreview?: Record<string, unknown> | undefined;
|
|
127
|
+
rawHash?: string | undefined;
|
|
128
|
+
}, {
|
|
129
|
+
occurrenceId: string;
|
|
130
|
+
alertRef: {
|
|
131
|
+
integrationId: string;
|
|
132
|
+
provider: string;
|
|
133
|
+
alertKey: string;
|
|
134
|
+
};
|
|
135
|
+
evidenceRef: string;
|
|
136
|
+
evidenceSource: "provider_list" | "provider_detail" | "provider_webhook" | "slack_notification";
|
|
137
|
+
capturedAt: string;
|
|
138
|
+
presentation: {
|
|
139
|
+
status?: string | undefined;
|
|
140
|
+
title?: string | undefined;
|
|
141
|
+
severity?: string | undefined;
|
|
142
|
+
description?: string | undefined;
|
|
143
|
+
};
|
|
144
|
+
schemaVersion: string;
|
|
145
|
+
redactionVersion: string;
|
|
146
|
+
observedAt?: string | undefined;
|
|
147
|
+
startsAt?: string | undefined;
|
|
148
|
+
endsAt?: string | undefined;
|
|
149
|
+
state?: string | undefined;
|
|
150
|
+
labels?: Record<string, string> | undefined;
|
|
151
|
+
annotations?: Record<string, string> | undefined;
|
|
152
|
+
tags?: Record<string, string> | undefined;
|
|
153
|
+
providerIds?: Record<string, string> | undefined;
|
|
154
|
+
sourceUrls?: Record<string, string> | undefined;
|
|
155
|
+
rawPreview?: Record<string, unknown> | undefined;
|
|
156
|
+
rawHash?: string | undefined;
|
|
157
|
+
}>;
|
|
158
|
+
export type AlertOccurrenceRef = z.infer<typeof alertOccurrenceRefSchema>;
|
|
159
|
+
export type AlertEvidenceSource = z.infer<typeof alertEvidenceSourceSchema>;
|
|
160
|
+
export type AlertEvidencePresentation = z.infer<typeof alertEvidencePresentationSchema>;
|
|
161
|
+
export type AlertEvidenceSnapshot = z.infer<typeof alertEvidenceSnapshotSchema>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alertEvidenceSnapshotSchema = exports.alertEvidencePresentationSchema = exports.alertEvidenceSourceSchema = exports.alertOccurrenceRefSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const alertRef_1 = require("./alertRef");
|
|
6
|
+
exports.alertOccurrenceRefSchema = zod_1.z.object({
|
|
7
|
+
occurrenceId: zod_1.z.string().min(1),
|
|
8
|
+
alertRef: alertRef_1.alertRefSchema,
|
|
9
|
+
evidenceRef: zod_1.z.string().min(1),
|
|
10
|
+
}).strict();
|
|
11
|
+
exports.alertEvidenceSourceSchema = zod_1.z.enum([
|
|
12
|
+
'provider_list',
|
|
13
|
+
'provider_detail',
|
|
14
|
+
'provider_webhook',
|
|
15
|
+
'slack_notification',
|
|
16
|
+
]);
|
|
17
|
+
exports.alertEvidencePresentationSchema = zod_1.z.object({
|
|
18
|
+
title: zod_1.z.string().optional(),
|
|
19
|
+
severity: zod_1.z.string().optional(),
|
|
20
|
+
status: zod_1.z.string().optional(),
|
|
21
|
+
description: zod_1.z.string().optional(),
|
|
22
|
+
}).strict();
|
|
23
|
+
exports.alertEvidenceSnapshotSchema = zod_1.z.object({
|
|
24
|
+
evidenceRef: zod_1.z.string().min(1),
|
|
25
|
+
occurrenceId: zod_1.z.string().min(1),
|
|
26
|
+
alertRef: alertRef_1.alertRefSchema,
|
|
27
|
+
evidenceSource: exports.alertEvidenceSourceSchema,
|
|
28
|
+
capturedAt: zod_1.z.string().datetime(),
|
|
29
|
+
observedAt: zod_1.z.string().datetime().optional(),
|
|
30
|
+
startsAt: zod_1.z.string().datetime().optional(),
|
|
31
|
+
endsAt: zod_1.z.string().datetime().optional(),
|
|
32
|
+
state: zod_1.z.string().optional(),
|
|
33
|
+
labels: zod_1.z.record(zod_1.z.string()).optional(),
|
|
34
|
+
annotations: zod_1.z.record(zod_1.z.string()).optional(),
|
|
35
|
+
tags: zod_1.z.record(zod_1.z.string()).optional(),
|
|
36
|
+
providerIds: zod_1.z.record(zod_1.z.string()).optional(),
|
|
37
|
+
sourceUrls: zod_1.z.record(zod_1.z.string()).optional(),
|
|
38
|
+
presentation: exports.alertEvidencePresentationSchema,
|
|
39
|
+
rawPreview: zod_1.z.record(zod_1.z.unknown()).optional(),
|
|
40
|
+
rawHash: zod_1.z.string().optional(),
|
|
41
|
+
schemaVersion: zod_1.z.string().min(1),
|
|
42
|
+
redactionVersion: zod_1.z.string().min(1),
|
|
43
|
+
}).strict();
|
|
44
|
+
//# sourceMappingURL=alertEvidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alertEvidence.js","sourceRoot":"","sources":["../../../src/contracts/alertEvidence.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,yCAA4C;AAE/B,QAAA,wBAAwB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC/C,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,QAAQ,EAAE,yBAAc;IACxB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC/B,CAAC,CAAC,MAAM,EAAE,CAAC;AAEC,QAAA,yBAAyB,GAAG,OAAC,CAAC,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IAAI,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACrC,WAAW,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5C,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC3C,YAAY,EAAE,uCAA+B;IAC7C,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5C,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACpC,CAAC,CAAC,MAAM,EAAE,CAAC"}
|
|
@@ -3,19 +3,13 @@ export declare const alertRefSchema: z.ZodObject<{
|
|
|
3
3
|
integrationId: z.ZodString;
|
|
4
4
|
provider: z.ZodString;
|
|
5
5
|
alertKey: z.ZodString;
|
|
6
|
-
|
|
7
|
-
selectedAt: z.ZodString;
|
|
8
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
9
7
|
integrationId: string;
|
|
10
8
|
provider: string;
|
|
11
9
|
alertKey: string;
|
|
12
|
-
timestamp: string;
|
|
13
|
-
selectedAt: string;
|
|
14
10
|
}, {
|
|
15
11
|
integrationId: string;
|
|
16
12
|
provider: string;
|
|
17
13
|
alertKey: string;
|
|
18
|
-
timestamp: string;
|
|
19
|
-
selectedAt: string;
|
|
20
14
|
}>;
|
|
21
15
|
export type AlertRef = z.infer<typeof alertRefSchema>;
|
|
@@ -6,7 +6,5 @@ exports.alertRefSchema = zod_1.z.object({
|
|
|
6
6
|
integrationId: zod_1.z.string().min(1),
|
|
7
7
|
provider: zod_1.z.string().min(1),
|
|
8
8
|
alertKey: zod_1.z.string().min(1),
|
|
9
|
-
|
|
10
|
-
selectedAt: zod_1.z.string().datetime(),
|
|
11
|
-
});
|
|
9
|
+
}).strict();
|
|
12
10
|
//# sourceMappingURL=alertRef.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alertRef.js","sourceRoot":"","sources":["../../../src/contracts/alertRef.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"alertRef.js","sourceRoot":"","sources":["../../../src/contracts/alertRef.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAC5B,CAAC,CAAC,MAAM,EAAE,CAAC"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AlertEvidencePresentation, AlertEvidenceSnapshot, AlertOccurrenceRef } from './alertEvidence';
|
|
2
2
|
import type { AlertCorrelationDecision } from './decision';
|
|
3
3
|
import type { AlertCorrelationFacts, AlertTimeWindow } from './facts';
|
|
4
|
-
export interface AlertSummarySnapshot {
|
|
5
|
-
title?: string;
|
|
6
|
-
severity?: string;
|
|
7
|
-
status?: string;
|
|
8
|
-
description?: string;
|
|
9
|
-
project?: string;
|
|
10
|
-
resource?: string;
|
|
11
|
-
}
|
|
12
4
|
export interface AlertCorrelationDiagnostics {
|
|
13
5
|
providerDetailFetched: boolean;
|
|
6
|
+
evidenceSource: AlertEvidenceSnapshot['evidenceSource'];
|
|
7
|
+
evidenceRef: string;
|
|
8
|
+
occurrenceId: string;
|
|
14
9
|
rawTruncated: boolean;
|
|
15
10
|
extractorName: string;
|
|
16
11
|
extractorVersion: string;
|
|
@@ -25,9 +20,10 @@ export interface AlertCorrelationDiagnostics {
|
|
|
25
20
|
};
|
|
26
21
|
}
|
|
27
22
|
export interface AlertInvestigationContext {
|
|
28
|
-
request:
|
|
23
|
+
request: AlertOccurrenceRef;
|
|
24
|
+
evidence: AlertEvidenceSnapshot;
|
|
29
25
|
time: AlertTimeWindow;
|
|
30
|
-
|
|
26
|
+
presentation: AlertEvidencePresentation;
|
|
31
27
|
facts: AlertCorrelationFacts;
|
|
32
28
|
resolution: AlertCorrelationDecision;
|
|
33
29
|
topologySlice: unknown | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { CorrelationEntityRef, CorrelationStatus as CoreCorrelationStatus } from '@scoutflo/correlation-core';
|
|
2
|
+
export type CorrelationStatus = Extract<CoreCorrelationStatus, 'resolved' | 'ambiguous' | 'degraded' | 'unresolved'> | 'evidence_available_topology_missing' | 'insufficient_evidence';
|
|
2
3
|
export interface CorrelationEvidence {
|
|
3
4
|
kind: 'relationship_attribute' | 'raw_alert_field' | 'resource_inference' | 'fallback';
|
|
4
5
|
factKey?: string;
|
|
@@ -7,10 +8,7 @@ export interface CorrelationEvidence {
|
|
|
7
8
|
reason: string;
|
|
8
9
|
}
|
|
9
10
|
export interface CorrelationCandidate {
|
|
10
|
-
target:
|
|
11
|
-
type: 'service' | 'resource';
|
|
12
|
-
id: string;
|
|
13
|
-
};
|
|
11
|
+
target: CorrelationEntityRef;
|
|
14
12
|
name?: string;
|
|
15
13
|
confidence: number;
|
|
16
14
|
evidence: CorrelationEvidence[];
|
|
@@ -18,10 +16,7 @@ export interface CorrelationCandidate {
|
|
|
18
16
|
}
|
|
19
17
|
export interface AlertCorrelationDecision {
|
|
20
18
|
status: CorrelationStatus;
|
|
21
|
-
target:
|
|
22
|
-
type: 'service' | 'resource';
|
|
23
|
-
id: string;
|
|
24
|
-
} | null;
|
|
19
|
+
target: CorrelationEntityRef | null;
|
|
25
20
|
candidates: CorrelationCandidate[];
|
|
26
21
|
evidence: CorrelationEvidence[];
|
|
27
22
|
confidence: number;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
value: string;
|
|
5
|
-
sourcePath: string;
|
|
6
|
-
confidence: number;
|
|
1
|
+
import type { CorrelationFact, FactKind as CoreFactKind } from '@scoutflo/correlation-core';
|
|
2
|
+
export type FactKind = Extract<CoreFactKind, 'label' | 'tag' | 'annotation' | 'provider_identity' | 'resource_hint' | 'text_derived' | 'time'>;
|
|
3
|
+
export interface Fact extends Omit<CorrelationFact, 'kind'> {
|
|
7
4
|
kind: FactKind;
|
|
8
5
|
}
|
|
9
6
|
export interface AlertTimeWindow {
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
capturedAt: string;
|
|
8
|
+
observedAt?: string;
|
|
12
9
|
startsAt: string;
|
|
13
10
|
endsAt?: string;
|
|
14
11
|
lastSeen?: string;
|
|
@@ -18,6 +15,9 @@ export interface AlertCorrelationFacts {
|
|
|
18
15
|
provider: string;
|
|
19
16
|
integrationId: string;
|
|
20
17
|
alertKey: string;
|
|
18
|
+
occurrenceId: string;
|
|
19
|
+
evidenceRef: string;
|
|
20
|
+
evidenceSource: string;
|
|
21
21
|
extractor: {
|
|
22
22
|
name: string;
|
|
23
23
|
version: string;
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./alertRef"), exports);
|
|
18
|
+
__exportStar(require("./alertEvidence"), exports);
|
|
18
19
|
__exportStar(require("./facts"), exports);
|
|
19
20
|
__exportStar(require("./topology"), exports);
|
|
20
21
|
__exportStar(require("./decision"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contracts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0CAAwB;AACxB,6CAA2B;AAC3B,6CAA2B;AAC3B,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contracts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,kDAAgC;AAChC,0CAAwB;AACxB,6CAA2B;AAC3B,6CAA2B;AAC3B,4CAA0B"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
id: string;
|
|
5
|
-
}
|
|
1
|
+
import type { CorrelationEntityRef, CorrelationEntityType } from '@scoutflo/correlation-core';
|
|
2
|
+
export type { CorrelationEntityType };
|
|
3
|
+
export type CorrelationTopologyEntityRef = CorrelationEntityRef;
|
|
6
4
|
export interface CorrelationService {
|
|
7
5
|
id: string;
|
|
8
6
|
name: string;
|
|
@@ -6,5 +6,11 @@ export declare const REASON_CODES: {
|
|
|
6
6
|
readonly MULTIPLE_CANDIDATES: "multiple_candidates";
|
|
7
7
|
readonly WEAK_CANDIDATE: "weak_candidate";
|
|
8
8
|
readonly RESOLVED_DETERMINISTIC: "resolved_deterministic";
|
|
9
|
+
readonly EVIDENCE_MISSING: "evidence_missing";
|
|
10
|
+
readonly EVIDENCE_INSUFFICIENT: "evidence_insufficient";
|
|
11
|
+
readonly PROVIDER_DETAIL_UNAVAILABLE_USING_STORED_EVIDENCE: "provider_detail_unavailable_using_stored_evidence";
|
|
12
|
+
readonly SOURCE_RESOURCE_MISSING: "source_resource_missing";
|
|
13
|
+
readonly TOPOLOGY_RELATIONSHIPS_MISSING: "topology_relationships_missing";
|
|
14
|
+
readonly TOPOLOGY_AMBIGUOUS: "topology_ambiguous";
|
|
9
15
|
};
|
|
10
16
|
export type ReasonCode = (typeof REASON_CODES)[keyof typeof REASON_CODES];
|
|
@@ -9,5 +9,11 @@ exports.REASON_CODES = {
|
|
|
9
9
|
MULTIPLE_CANDIDATES: 'multiple_candidates',
|
|
10
10
|
WEAK_CANDIDATE: 'weak_candidate',
|
|
11
11
|
RESOLVED_DETERMINISTIC: 'resolved_deterministic',
|
|
12
|
+
EVIDENCE_MISSING: 'evidence_missing',
|
|
13
|
+
EVIDENCE_INSUFFICIENT: 'evidence_insufficient',
|
|
14
|
+
PROVIDER_DETAIL_UNAVAILABLE_USING_STORED_EVIDENCE: 'provider_detail_unavailable_using_stored_evidence',
|
|
15
|
+
SOURCE_RESOURCE_MISSING: 'source_resource_missing',
|
|
16
|
+
TOPOLOGY_RELATIONSHIPS_MISSING: 'topology_relationships_missing',
|
|
17
|
+
TOPOLOGY_AMBIGUOUS: 'topology_ambiguous',
|
|
12
18
|
};
|
|
13
19
|
//# sourceMappingURL=reasonCodes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reasonCodes.js","sourceRoot":"","sources":["../../../src/decision/reasonCodes.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,aAAa,EAAE,eAAe;IAC9B,4BAA4B,EAAE,8BAA8B;IAC5D,0BAA0B,EAAE,4BAA4B;IACxD,mBAAmB,EAAE,qBAAqB;IAC1C,mBAAmB,EAAE,qBAAqB;IAC1C,cAAc,EAAE,gBAAgB;IAChC,sBAAsB,EAAE,wBAAwB;
|
|
1
|
+
{"version":3,"file":"reasonCodes.js","sourceRoot":"","sources":["../../../src/decision/reasonCodes.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,aAAa,EAAE,eAAe;IAC9B,4BAA4B,EAAE,8BAA8B;IAC5D,0BAA0B,EAAE,4BAA4B;IACxD,mBAAmB,EAAE,qBAAqB;IAC1C,mBAAmB,EAAE,qBAAqB;IAC1C,cAAc,EAAE,gBAAgB;IAChC,sBAAsB,EAAE,wBAAwB;IAChD,gBAAgB,EAAE,kBAAkB;IACpC,qBAAqB,EAAE,uBAAuB;IAC9C,iDAAiD,EAAE,mDAAmD;IACtG,uBAAuB,EAAE,yBAAyB;IAClD,8BAA8B,EAAE,gCAAgC;IAChE,kBAAkB,EAAE,oBAAoB;CAChC,CAAC"}
|
|
@@ -96,55 +96,73 @@ function extractProviderTimeHints(raw) {
|
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
function extractGenericFacts(input, extractorName = exports.GENERIC_EXTRACTOR_NAME) {
|
|
99
|
-
const raw = input.
|
|
99
|
+
const raw = input.evidence.rawPreview ?? {};
|
|
100
|
+
const alertRef = input.alertOccurrenceRef.alertRef;
|
|
101
|
+
const rawTitle = firstPrimitive(raw, [['title'], ['name']]);
|
|
102
|
+
const rawSeverity = firstPrimitive(raw, [['severity'], ['level']]);
|
|
103
|
+
const rawResource = firstPrimitive(raw, [['resource']]);
|
|
104
|
+
const evidenceStatus = input.evidence.state ?? input.evidence.presentation.status;
|
|
100
105
|
const labels = [
|
|
106
|
+
...factsFromRecord(input.evidence.labels, 'evidence.labels', 'label', 0.86),
|
|
107
|
+
...factsFromRecord(input.evidence.tags, 'evidence.tags', 'tag', 0.8),
|
|
101
108
|
...factsFromRecord(getPath(raw, ['labels']), 'raw.labels', 'label', 0.75),
|
|
102
109
|
...factsFromRecord(getPath(raw, ['commonLabels']), 'raw.commonLabels', 'label', 0.75),
|
|
103
110
|
...factsFromTagCollection(getPath(raw, ['tags']), 'raw.tags'),
|
|
104
|
-
|
|
111
|
+
makeFact({
|
|
112
|
+
key: 'status',
|
|
113
|
+
value: evidenceStatus,
|
|
114
|
+
sourcePath: input.evidence.state ? 'evidence.state' : 'evidence.presentation.status',
|
|
115
|
+
kind: 'label',
|
|
116
|
+
confidence: 0.72,
|
|
117
|
+
}),
|
|
118
|
+
].filter((fact) => Boolean(fact));
|
|
105
119
|
const textHints = [
|
|
120
|
+
...factsFromRecord(input.evidence.annotations, 'evidence.annotations', 'annotation', 0.78),
|
|
106
121
|
...factsFromRecord(getPath(raw, ['annotations']), 'raw.annotations', 'annotation', 0.6),
|
|
107
122
|
];
|
|
108
123
|
const title = makeFact({
|
|
109
124
|
key: 'title',
|
|
110
|
-
value:
|
|
125
|
+
value: rawTitle ?? input.evidence.presentation.title,
|
|
111
126
|
sourcePath: firstPrimitive(raw, [['title']])
|
|
112
127
|
? 'raw.title'
|
|
113
128
|
: firstPrimitive(raw, [['name']])
|
|
114
129
|
? 'raw.name'
|
|
115
|
-
: '
|
|
130
|
+
: 'evidence.presentation.title',
|
|
116
131
|
kind: 'text_derived',
|
|
117
132
|
confidence: 0.8,
|
|
118
133
|
}) ?? undefined;
|
|
119
134
|
const severity = makeFact({
|
|
120
135
|
key: 'severity',
|
|
121
|
-
value:
|
|
136
|
+
value: rawSeverity ?? input.evidence.presentation.severity,
|
|
122
137
|
sourcePath: firstPrimitive(raw, [['severity']])
|
|
123
138
|
? 'raw.severity'
|
|
124
139
|
: firstPrimitive(raw, [['level']])
|
|
125
140
|
? 'raw.level'
|
|
126
|
-
: '
|
|
141
|
+
: 'evidence.presentation.severity',
|
|
127
142
|
kind: 'label',
|
|
128
143
|
confidence: 0.7,
|
|
129
144
|
}) ?? undefined;
|
|
130
145
|
const resourceHints = [
|
|
131
146
|
makeFact({
|
|
132
147
|
key: 'resource',
|
|
133
|
-
value:
|
|
134
|
-
sourcePath:
|
|
148
|
+
value: rawResource,
|
|
149
|
+
sourcePath: 'raw.resource',
|
|
135
150
|
kind: 'resource_hint',
|
|
136
151
|
confidence: 0.65,
|
|
137
152
|
}),
|
|
138
153
|
].filter((fact) => Boolean(fact));
|
|
139
154
|
return {
|
|
140
|
-
provider:
|
|
141
|
-
integrationId:
|
|
142
|
-
alertKey:
|
|
155
|
+
provider: alertRef.provider,
|
|
156
|
+
integrationId: alertRef.integrationId,
|
|
157
|
+
alertKey: alertRef.alertKey,
|
|
158
|
+
occurrenceId: input.alertOccurrenceRef.occurrenceId,
|
|
159
|
+
evidenceRef: input.alertOccurrenceRef.evidenceRef,
|
|
160
|
+
evidenceSource: input.evidence.evidenceSource,
|
|
143
161
|
extractor: {
|
|
144
162
|
name: extractorName,
|
|
145
163
|
version: exports.EXTRACTOR_VERSION,
|
|
146
164
|
},
|
|
147
|
-
time: (0, normalizeAlertTime_1.normalizeAlertTime)(input.
|
|
165
|
+
time: (0, normalizeAlertTime_1.normalizeAlertTime)(input.evidence, extractProviderTimeHints(raw)),
|
|
148
166
|
labels,
|
|
149
167
|
identifiers: [],
|
|
150
168
|
resourceHints,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"genericExtractor.js","sourceRoot":"","sources":["../../../src/extractors/genericExtractor.ts"],"names":[],"mappings":";;;AASA,4BAEC;AAED,8CAIC;AAED,4BAiBC;AAED,0CAmBC;AAED,wDAmBC;AAED,0BAOC;AAED,wCAMC;AAED,4DAQC;AAED,
|
|
1
|
+
{"version":3,"file":"genericExtractor.js","sourceRoot":"","sources":["../../../src/extractors/genericExtractor.ts"],"names":[],"mappings":";;;AASA,4BAEC;AAED,8CAIC;AAED,4BAiBC;AAED,0CAmBC;AAED,wDAmBC;AAED,0BAOC;AAED,wCAMC;AAED,4DAQC;AAED,kDAoFC;AA9LD,mEAAwF;AAK3E,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAC7C,QAAA,iBAAiB,GAAG,OAAO,CAAC;AAEzC,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,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,EAAE,QAAQ,CAAC,QAAQ;QAC3B,YAAY,EAAE,KAAK,CAAC,kBAAkB,CAAC,YAAY;QACnD,WAAW,EAAE,KAAK,CAAC,kBAAkB,CAAC,WAAW;QACjD,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,cAAc;QAC7C,SAAS,EAAE;YACT,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,yBAAiB;SAC3B;QACD,IAAI,EAAE,IAAA,uCAAkB,EAAC,KAAK,CAAC,QAAQ,EAAE,wBAAwB,CAAC,GAAG,CAAC,CAAC;QACvE,MAAM;QACN,WAAW,EAAE,EAAE;QACf,aAAa;QACb,SAAS;QACT,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5B,CAAC;AACJ,CAAC;AAEY,QAAA,gBAAgB,GAAsB;IACjD,QAAQ,EAAE,GAAG;IACb,IAAI,EAAE,8BAAsB;IAC5B,OAAO,EAAE,yBAAiB;IAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC;CAC/C,CAAC"}
|
|
@@ -86,9 +86,12 @@ function explicitProviderFacts(raw) {
|
|
|
86
86
|
]);
|
|
87
87
|
}
|
|
88
88
|
function extractPrometheusCompatibleFacts(input, extractorName) {
|
|
89
|
-
const raw = input.
|
|
89
|
+
const raw = input.evidence.rawPreview ?? {};
|
|
90
|
+
const alertRef = input.alertOccurrenceRef.alertRef;
|
|
90
91
|
const alert = firstAlert(raw);
|
|
91
92
|
const labels = [
|
|
93
|
+
...(0, genericExtractor_1.factsFromRecord)(input.evidence.labels, 'evidence.labels', 'label', 0.86),
|
|
94
|
+
...(0, genericExtractor_1.factsFromRecord)(input.evidence.tags, 'evidence.tags', 'tag', 0.8),
|
|
92
95
|
...(0, genericExtractor_1.factsFromRecord)((0, genericExtractor_1.getPath)(raw, ['commonLabels']), 'raw.commonLabels', 'label', 0.82),
|
|
93
96
|
...(0, genericExtractor_1.factsFromRecord)((0, genericExtractor_1.getPath)(raw, ['labels']), 'raw.labels', 'label', 0.8),
|
|
94
97
|
...(0, genericExtractor_1.factsFromRecord)((0, genericExtractor_1.getPath)(raw, ['metric']), 'raw.metric', 'label', 0.78),
|
|
@@ -97,6 +100,7 @@ function extractPrometheusCompatibleFacts(input, extractorName) {
|
|
|
97
100
|
...factsFromAlerts(raw, 'labels'),
|
|
98
101
|
];
|
|
99
102
|
const textHints = [
|
|
103
|
+
...(0, genericExtractor_1.factsFromRecord)(input.evidence.annotations, 'evidence.annotations', 'annotation', 0.78),
|
|
100
104
|
...(0, genericExtractor_1.factsFromRecord)((0, genericExtractor_1.getPath)(raw, ['annotations']), 'raw.annotations', 'annotation', 0.65),
|
|
101
105
|
...(0, genericExtractor_1.factsFromRecord)((0, genericExtractor_1.getPath)(raw, ['commonAnnotations']), 'raw.commonAnnotations', 'annotation', 0.65),
|
|
102
106
|
...factsFromAlerts(raw, 'annotations'),
|
|
@@ -107,14 +111,17 @@ function extractPrometheusCompatibleFacts(input, extractorName) {
|
|
|
107
111
|
const rawTimeHints = (0, genericExtractor_1.extractProviderTimeHints)(raw);
|
|
108
112
|
const alertTimeHints = (0, genericExtractor_1.extractProviderTimeHints)(alert);
|
|
109
113
|
return {
|
|
110
|
-
provider:
|
|
111
|
-
integrationId:
|
|
112
|
-
alertKey:
|
|
114
|
+
provider: alertRef.provider,
|
|
115
|
+
integrationId: alertRef.integrationId,
|
|
116
|
+
alertKey: alertRef.alertKey,
|
|
117
|
+
occurrenceId: input.alertOccurrenceRef.occurrenceId,
|
|
118
|
+
evidenceRef: input.alertOccurrenceRef.evidenceRef,
|
|
119
|
+
evidenceSource: input.evidence.evidenceSource,
|
|
113
120
|
extractor: {
|
|
114
121
|
name: extractorName,
|
|
115
122
|
version: genericExtractor_1.EXTRACTOR_VERSION,
|
|
116
123
|
},
|
|
117
|
-
time: (0, normalizeAlertTime_1.normalizeAlertTime)(input.
|
|
124
|
+
time: (0, normalizeAlertTime_1.normalizeAlertTime)(input.evidence, {
|
|
118
125
|
startsAt: rawTimeHints.startsAt ?? alertTimeHints.startsAt,
|
|
119
126
|
firstSeen: rawTimeHints.firstSeen ?? alertTimeHints.firstSeen,
|
|
120
127
|
eventTimestamp: rawTimeHints.eventTimestamp ?? alertTimeHints.eventTimestamp,
|
|
@@ -171,8 +178,8 @@ function extractPrometheusCompatibleFacts(input, extractorName) {
|
|
|
171
178
|
? {
|
|
172
179
|
title: (0, genericExtractor_1.makeFact)({
|
|
173
180
|
key: 'title',
|
|
174
|
-
value: (0, genericExtractor_1.primitiveToString)(raw.title) ?? input.
|
|
175
|
-
sourcePath: (0, genericExtractor_1.primitiveToString)(raw.title) ? 'raw.title' : '
|
|
181
|
+
value: (0, genericExtractor_1.primitiveToString)(raw.title) ?? input.evidence.presentation.title,
|
|
182
|
+
sourcePath: (0, genericExtractor_1.primitiveToString)(raw.title) ? 'raw.title' : 'evidence.presentation.title',
|
|
176
183
|
kind: 'text_derived',
|
|
177
184
|
confidence: 0.75,
|
|
178
185
|
}),
|