@scoutflo/alert-correlation 0.7.2-datadog.0 → 0.7.2-datadog.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/README.md +29 -0
- package/dist/src/contracts/context.d.ts +744 -0
- package/dist/src/contracts/context.js +6 -1
- package/dist/src/contracts/context.js.map +1 -1
- package/dist/src/contracts/datadogMonitorQuery.d.ts +322 -0
- package/dist/src/contracts/datadogMonitorQuery.js +79 -0
- package/dist/src/contracts/datadogMonitorQuery.js.map +1 -0
- package/dist/src/contracts/facts.d.ts +389 -0
- package/dist/src/contracts/facts.js +20 -3
- package/dist/src/contracts/facts.js.map +1 -1
- 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/extractors/datadogExtractor.js +15 -0
- package/dist/src/extractors/datadogExtractor.js.map +1 -1
- package/dist/src/extractors/registry.d.ts +31 -0
- package/dist/src/extractors/registry.js +4 -0
- package/dist/src/extractors/registry.js.map +1 -1
- package/dist/src/extractors/types.d.ts +2 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/matchers/datadogMonitorQueryMatcher.d.ts +4 -0
- package/dist/src/matchers/datadogMonitorQueryMatcher.js +55 -0
- package/dist/src/matchers/datadogMonitorQueryMatcher.js.map +1 -0
- package/dist/src/resolveAlertCorrelation.d.ts +3 -1
- package/dist/src/resolveAlertCorrelation.js +9 -4
- package/dist/src/resolveAlertCorrelation.js.map +1 -1
- package/dist/src/time/normalizeDatadogMonitorQueryTime.d.ts +6 -0
- package/dist/src/time/normalizeDatadogMonitorQueryTime.js +69 -0
- package/dist/src/time/normalizeDatadogMonitorQueryTime.js.map +1 -0
- package/dist/test/datadog-monitor-query.test.d.ts +1 -0
- package/dist/test/datadog-monitor-query.test.js +332 -0
- package/dist/test/datadog-monitor-query.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ const decision_1 = require("./decision");
|
|
|
9
9
|
const facts_1 = require("./facts");
|
|
10
10
|
const victoropsTime_1 = require("./victoropsTime");
|
|
11
11
|
const datadogGroup_1 = require("./datadogGroup");
|
|
12
|
+
const datadogMonitorQuery_1 = require("./datadogMonitorQuery");
|
|
12
13
|
const recordSchema = zod_1.z.record(zod_1.z.unknown());
|
|
13
14
|
const nonEmptyStringSchema = zod_1.z.string().min(1);
|
|
14
15
|
exports.alertCorrelationDiagnosticsSchema = zod_1.z.object({
|
|
@@ -35,6 +36,8 @@ exports.alertInvestigationContextSchema = zod_1.z.object({
|
|
|
35
36
|
time: facts_1.alertTimeWindowSchema,
|
|
36
37
|
presentation: alertEvidence_1.alertEvidencePresentationSchema,
|
|
37
38
|
facts: facts_1.alertCorrelationFactsSchema,
|
|
39
|
+
currentDatadogMonitorQuery: datadogMonitorQuery_1.datadogCurrentMonitorQueryScopeSchema.optional(),
|
|
40
|
+
datadogMonitorQueryTarget: datadogMonitorQuery_1.datadogMonitorQueryTargetSchema.optional(),
|
|
38
41
|
resolution: decision_1.alertCorrelationDecisionSchema,
|
|
39
42
|
topologyContext: topology_contracts_1.gatewayTopologyContextSchema,
|
|
40
43
|
bindingHints: zod_1.z.array(zod_1.z.unknown()),
|
|
@@ -52,13 +55,15 @@ exports.gatewayAlertInvestigationContextResponseSchema = zod_1.z.object({
|
|
|
52
55
|
provider: nonEmptyStringSchema.optional(),
|
|
53
56
|
}).passthrough().optional(),
|
|
54
57
|
alert: recordSchema.optional(),
|
|
55
|
-
time: zod_1.z.union([datadogGroup_1.datadogGroupTimeWindowSchema, victoropsTime_1.victorOpsTimeWindowSchema, facts_1.legacyAlertTimeWindowSchema.partial().extend({
|
|
58
|
+
time: zod_1.z.union([datadogGroup_1.datadogGroupTimeWindowSchema, datadogMonitorQuery_1.datadogMonitorQueryTimeWindowSchema, victoropsTime_1.victorOpsTimeWindowSchema, facts_1.legacyAlertTimeWindowSchema.partial().extend({
|
|
56
59
|
alertTimestamp: zod_1.z.string().datetime().optional(),
|
|
57
60
|
timestamp: zod_1.z.string().datetime().optional(),
|
|
58
61
|
}).passthrough()]).optional(),
|
|
59
62
|
presentation: alertEvidence_1.alertEvidencePresentationSchema.optional(),
|
|
60
63
|
summary: alertEvidence_1.alertEvidencePresentationSchema.optional(),
|
|
61
64
|
facts: zod_1.z.unknown().optional(),
|
|
65
|
+
currentDatadogMonitorQuery: datadogMonitorQuery_1.datadogCurrentMonitorQueryScopeSchema.optional(),
|
|
66
|
+
datadogMonitorQueryTarget: datadogMonitorQuery_1.datadogMonitorQueryTargetSchema.optional(),
|
|
62
67
|
resolution: decision_1.alertCorrelationDecisionSchema.partial().extend({
|
|
63
68
|
target: zod_1.z.unknown().optional(),
|
|
64
69
|
candidates: zod_1.z.array(zod_1.z.unknown()).optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/contracts/context.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,qEAKsC;AAMtC,mDAIyB;AACzB,yCAA4C;AAG5C,yCAA4D;AAE5D,mCAA0G;AAC1G,mDAA4D;AAC5D,iDAA8D;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/contracts/context.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,qEAKsC;AAMtC,mDAIyB;AACzB,yCAA4C;AAG5C,yCAA4D;AAE5D,mCAA0G;AAC1G,mDAA4D;AAC5D,iDAA8D;AAC9D,+DAM+B;AAE/B,MAAM,YAAY,GAAG,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAC3C,MAAM,oBAAoB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAElC,QAAA,iCAAiC,GAAG,OAAC,CAAC,MAAM,CAAC;IACxD,qBAAqB,EAAE,OAAC,CAAC,OAAO,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+
import { z } from 'zod';
|
|
2
|
+
export declare const DATADOG_MONITOR_QUERY_SCHEMA_VERSION: "scoutflo.datadog.current-monitor-query.v1";
|
|
3
|
+
export declare const DATADOG_MONITOR_QUERY_PROFILE: "metric_query_kubernetes_deployment_v1";
|
|
4
|
+
export declare const DATADOG_MONITOR_QUERY_MAX_AGE_MS = 300000;
|
|
5
|
+
export declare const datadogMonitorQueryScopeSchema: z.ZodEffects<z.ZodObject<{
|
|
6
|
+
clusterName: z.ZodString;
|
|
7
|
+
namespace: z.ZodString;
|
|
8
|
+
deployment: z.ZodString;
|
|
9
|
+
}, "strict", z.ZodTypeAny, {
|
|
10
|
+
clusterName: string;
|
|
11
|
+
namespace: string;
|
|
12
|
+
deployment: string;
|
|
13
|
+
}, {
|
|
14
|
+
clusterName: string;
|
|
15
|
+
namespace: string;
|
|
16
|
+
deployment: string;
|
|
17
|
+
}>, {
|
|
18
|
+
clusterName: string;
|
|
19
|
+
namespace: string;
|
|
20
|
+
deployment: string;
|
|
21
|
+
}, {
|
|
22
|
+
clusterName: string;
|
|
23
|
+
namespace: string;
|
|
24
|
+
deployment: string;
|
|
25
|
+
}>;
|
|
26
|
+
export type DatadogMonitorQueryScope = z.infer<typeof datadogMonitorQueryScopeSchema>;
|
|
27
|
+
/** Internal enrichment from an authorized, source-bound native monitor read.
|
|
28
|
+
* Parsing this shape does not authenticate it. Never accept it from caller JSON
|
|
29
|
+
* or use it to rewrite the original observation, state, or occurrence reference.
|
|
30
|
+
*/
|
|
31
|
+
export declare const datadogCurrentMonitorQueryScopeSchema: z.ZodEffects<z.ZodObject<{
|
|
32
|
+
checkedAt: z.ZodString;
|
|
33
|
+
integrationId: z.ZodString;
|
|
34
|
+
monitorId: z.ZodString;
|
|
35
|
+
occurrenceId: z.ZodString;
|
|
36
|
+
evidenceRef: z.ZodString;
|
|
37
|
+
classificationFingerprint: z.ZodString;
|
|
38
|
+
queryFingerprint: z.ZodString;
|
|
39
|
+
scope: z.ZodEffects<z.ZodObject<{
|
|
40
|
+
clusterName: z.ZodString;
|
|
41
|
+
namespace: z.ZodString;
|
|
42
|
+
deployment: z.ZodString;
|
|
43
|
+
}, "strict", z.ZodTypeAny, {
|
|
44
|
+
clusterName: string;
|
|
45
|
+
namespace: string;
|
|
46
|
+
deployment: string;
|
|
47
|
+
}, {
|
|
48
|
+
clusterName: string;
|
|
49
|
+
namespace: string;
|
|
50
|
+
deployment: string;
|
|
51
|
+
}>, {
|
|
52
|
+
clusterName: string;
|
|
53
|
+
namespace: string;
|
|
54
|
+
deployment: string;
|
|
55
|
+
}, {
|
|
56
|
+
clusterName: string;
|
|
57
|
+
namespace: string;
|
|
58
|
+
deployment: string;
|
|
59
|
+
}>;
|
|
60
|
+
observedAt: z.ZodString;
|
|
61
|
+
schemaVersion: z.ZodLiteral<"scoutflo.datadog.current-monitor-query.v1">;
|
|
62
|
+
profile: z.ZodLiteral<"metric_query_kubernetes_deployment_v1">;
|
|
63
|
+
}, "strict", z.ZodTypeAny, {
|
|
64
|
+
integrationId: string;
|
|
65
|
+
observedAt: string;
|
|
66
|
+
monitorId: string;
|
|
67
|
+
scope: {
|
|
68
|
+
clusterName: string;
|
|
69
|
+
namespace: string;
|
|
70
|
+
deployment: string;
|
|
71
|
+
};
|
|
72
|
+
schemaVersion: "scoutflo.datadog.current-monitor-query.v1";
|
|
73
|
+
occurrenceId: string;
|
|
74
|
+
evidenceRef: string;
|
|
75
|
+
checkedAt: string;
|
|
76
|
+
profile: "metric_query_kubernetes_deployment_v1";
|
|
77
|
+
classificationFingerprint: string;
|
|
78
|
+
queryFingerprint: string;
|
|
79
|
+
}, {
|
|
80
|
+
integrationId: string;
|
|
81
|
+
observedAt: string;
|
|
82
|
+
monitorId: string;
|
|
83
|
+
scope: {
|
|
84
|
+
clusterName: string;
|
|
85
|
+
namespace: string;
|
|
86
|
+
deployment: string;
|
|
87
|
+
};
|
|
88
|
+
schemaVersion: "scoutflo.datadog.current-monitor-query.v1";
|
|
89
|
+
occurrenceId: string;
|
|
90
|
+
evidenceRef: string;
|
|
91
|
+
checkedAt: string;
|
|
92
|
+
profile: "metric_query_kubernetes_deployment_v1";
|
|
93
|
+
classificationFingerprint: string;
|
|
94
|
+
queryFingerprint: string;
|
|
95
|
+
}>, {
|
|
96
|
+
integrationId: string;
|
|
97
|
+
observedAt: string;
|
|
98
|
+
monitorId: string;
|
|
99
|
+
scope: {
|
|
100
|
+
clusterName: string;
|
|
101
|
+
namespace: string;
|
|
102
|
+
deployment: string;
|
|
103
|
+
};
|
|
104
|
+
schemaVersion: "scoutflo.datadog.current-monitor-query.v1";
|
|
105
|
+
occurrenceId: string;
|
|
106
|
+
evidenceRef: string;
|
|
107
|
+
checkedAt: string;
|
|
108
|
+
profile: "metric_query_kubernetes_deployment_v1";
|
|
109
|
+
classificationFingerprint: string;
|
|
110
|
+
queryFingerprint: string;
|
|
111
|
+
}, {
|
|
112
|
+
integrationId: string;
|
|
113
|
+
observedAt: string;
|
|
114
|
+
monitorId: string;
|
|
115
|
+
scope: {
|
|
116
|
+
clusterName: string;
|
|
117
|
+
namespace: string;
|
|
118
|
+
deployment: string;
|
|
119
|
+
};
|
|
120
|
+
schemaVersion: "scoutflo.datadog.current-monitor-query.v1";
|
|
121
|
+
occurrenceId: string;
|
|
122
|
+
evidenceRef: string;
|
|
123
|
+
checkedAt: string;
|
|
124
|
+
profile: "metric_query_kubernetes_deployment_v1";
|
|
125
|
+
classificationFingerprint: string;
|
|
126
|
+
queryFingerprint: string;
|
|
127
|
+
}>;
|
|
128
|
+
export type DatadogCurrentMonitorQueryScope = z.infer<typeof datadogCurrentMonitorQueryScopeSchema>;
|
|
129
|
+
/** Current registered Deployment UID/DEPLOYED_AS proof, never historical ownership. */
|
|
130
|
+
export declare const datadogMonitorQueryTargetSchema: z.ZodObject<{
|
|
131
|
+
topologyVersionId: z.ZodString;
|
|
132
|
+
serviceId: z.ZodString;
|
|
133
|
+
serviceName: z.ZodString;
|
|
134
|
+
resourceId: z.ZodString;
|
|
135
|
+
deployedAsRelationshipId: z.ZodString;
|
|
136
|
+
clusterId: z.ZodString;
|
|
137
|
+
deploymentUid: z.ZodString;
|
|
138
|
+
checkedAt: z.ZodString;
|
|
139
|
+
integrationId: z.ZodString;
|
|
140
|
+
monitorId: z.ZodString;
|
|
141
|
+
occurrenceId: z.ZodString;
|
|
142
|
+
evidenceRef: z.ZodString;
|
|
143
|
+
classificationFingerprint: z.ZodString;
|
|
144
|
+
queryFingerprint: z.ZodString;
|
|
145
|
+
scope: z.ZodEffects<z.ZodObject<{
|
|
146
|
+
clusterName: z.ZodString;
|
|
147
|
+
namespace: z.ZodString;
|
|
148
|
+
deployment: z.ZodString;
|
|
149
|
+
}, "strict", z.ZodTypeAny, {
|
|
150
|
+
clusterName: string;
|
|
151
|
+
namespace: string;
|
|
152
|
+
deployment: string;
|
|
153
|
+
}, {
|
|
154
|
+
clusterName: string;
|
|
155
|
+
namespace: string;
|
|
156
|
+
deployment: string;
|
|
157
|
+
}>, {
|
|
158
|
+
clusterName: string;
|
|
159
|
+
namespace: string;
|
|
160
|
+
deployment: string;
|
|
161
|
+
}, {
|
|
162
|
+
clusterName: string;
|
|
163
|
+
namespace: string;
|
|
164
|
+
deployment: string;
|
|
165
|
+
}>;
|
|
166
|
+
observedAt: z.ZodString;
|
|
167
|
+
kind: z.ZodLiteral<"datadog_kubernetes_monitor_query">;
|
|
168
|
+
}, "strict", z.ZodTypeAny, {
|
|
169
|
+
integrationId: string;
|
|
170
|
+
kind: "datadog_kubernetes_monitor_query";
|
|
171
|
+
observedAt: string;
|
|
172
|
+
monitorId: string;
|
|
173
|
+
scope: {
|
|
174
|
+
clusterName: string;
|
|
175
|
+
namespace: string;
|
|
176
|
+
deployment: string;
|
|
177
|
+
};
|
|
178
|
+
occurrenceId: string;
|
|
179
|
+
evidenceRef: string;
|
|
180
|
+
topologyVersionId: string;
|
|
181
|
+
serviceId: string;
|
|
182
|
+
serviceName: string;
|
|
183
|
+
resourceId: string;
|
|
184
|
+
deployedAsRelationshipId: string;
|
|
185
|
+
clusterId: string;
|
|
186
|
+
deploymentUid: string;
|
|
187
|
+
checkedAt: string;
|
|
188
|
+
classificationFingerprint: string;
|
|
189
|
+
queryFingerprint: string;
|
|
190
|
+
}, {
|
|
191
|
+
integrationId: string;
|
|
192
|
+
kind: "datadog_kubernetes_monitor_query";
|
|
193
|
+
observedAt: string;
|
|
194
|
+
monitorId: string;
|
|
195
|
+
scope: {
|
|
196
|
+
clusterName: string;
|
|
197
|
+
namespace: string;
|
|
198
|
+
deployment: string;
|
|
199
|
+
};
|
|
200
|
+
occurrenceId: string;
|
|
201
|
+
evidenceRef: string;
|
|
202
|
+
topologyVersionId: string;
|
|
203
|
+
serviceId: string;
|
|
204
|
+
serviceName: string;
|
|
205
|
+
resourceId: string;
|
|
206
|
+
deployedAsRelationshipId: string;
|
|
207
|
+
clusterId: string;
|
|
208
|
+
deploymentUid: string;
|
|
209
|
+
checkedAt: string;
|
|
210
|
+
classificationFingerprint: string;
|
|
211
|
+
queryFingerprint: string;
|
|
212
|
+
}>;
|
|
213
|
+
export type DatadogMonitorQueryTarget = z.infer<typeof datadogMonitorQueryTargetSchema>;
|
|
214
|
+
export declare const datadogMonitorQueryTimeProvenanceSchema: z.ZodObject<{
|
|
215
|
+
kind: z.ZodLiteral<"datadog_current_monitor_query_scope">;
|
|
216
|
+
observedAt: z.ZodString;
|
|
217
|
+
checkedAt: z.ZodString;
|
|
218
|
+
scopeBasis: z.ZodLiteral<"current_monitor_configuration">;
|
|
219
|
+
originalIncidentStart: z.ZodLiteral<"unknown">;
|
|
220
|
+
originalIncidentEnd: z.ZodLiteral<"unknown">;
|
|
221
|
+
}, "strict", z.ZodTypeAny, {
|
|
222
|
+
kind: "datadog_current_monitor_query_scope";
|
|
223
|
+
observedAt: string;
|
|
224
|
+
originalIncidentStart: "unknown";
|
|
225
|
+
originalIncidentEnd: "unknown";
|
|
226
|
+
checkedAt: string;
|
|
227
|
+
scopeBasis: "current_monitor_configuration";
|
|
228
|
+
}, {
|
|
229
|
+
kind: "datadog_current_monitor_query_scope";
|
|
230
|
+
observedAt: string;
|
|
231
|
+
originalIncidentStart: "unknown";
|
|
232
|
+
originalIncidentEnd: "unknown";
|
|
233
|
+
checkedAt: string;
|
|
234
|
+
scopeBasis: "current_monitor_configuration";
|
|
235
|
+
}>;
|
|
236
|
+
export type DatadogMonitorQueryTimeProvenance = z.infer<typeof datadogMonitorQueryTimeProvenanceSchema>;
|
|
237
|
+
export declare const datadogMonitorQueryTimeWindowSchema: z.ZodEffects<z.ZodObject<{
|
|
238
|
+
capturedAt: z.ZodString;
|
|
239
|
+
observedAt: z.ZodString;
|
|
240
|
+
startsAt: z.ZodNull;
|
|
241
|
+
endsAt: z.ZodNull;
|
|
242
|
+
isOpenEnded: z.ZodBoolean;
|
|
243
|
+
provenance: z.ZodObject<{
|
|
244
|
+
kind: z.ZodLiteral<"datadog_current_monitor_query_scope">;
|
|
245
|
+
observedAt: z.ZodString;
|
|
246
|
+
checkedAt: z.ZodString;
|
|
247
|
+
scopeBasis: z.ZodLiteral<"current_monitor_configuration">;
|
|
248
|
+
originalIncidentStart: z.ZodLiteral<"unknown">;
|
|
249
|
+
originalIncidentEnd: z.ZodLiteral<"unknown">;
|
|
250
|
+
}, "strict", z.ZodTypeAny, {
|
|
251
|
+
kind: "datadog_current_monitor_query_scope";
|
|
252
|
+
observedAt: string;
|
|
253
|
+
originalIncidentStart: "unknown";
|
|
254
|
+
originalIncidentEnd: "unknown";
|
|
255
|
+
checkedAt: string;
|
|
256
|
+
scopeBasis: "current_monitor_configuration";
|
|
257
|
+
}, {
|
|
258
|
+
kind: "datadog_current_monitor_query_scope";
|
|
259
|
+
observedAt: string;
|
|
260
|
+
originalIncidentStart: "unknown";
|
|
261
|
+
originalIncidentEnd: "unknown";
|
|
262
|
+
checkedAt: string;
|
|
263
|
+
scopeBasis: "current_monitor_configuration";
|
|
264
|
+
}>;
|
|
265
|
+
}, "strict", z.ZodTypeAny, {
|
|
266
|
+
observedAt: string;
|
|
267
|
+
capturedAt: string;
|
|
268
|
+
startsAt: null;
|
|
269
|
+
endsAt: null;
|
|
270
|
+
isOpenEnded: boolean;
|
|
271
|
+
provenance: {
|
|
272
|
+
kind: "datadog_current_monitor_query_scope";
|
|
273
|
+
observedAt: string;
|
|
274
|
+
originalIncidentStart: "unknown";
|
|
275
|
+
originalIncidentEnd: "unknown";
|
|
276
|
+
checkedAt: string;
|
|
277
|
+
scopeBasis: "current_monitor_configuration";
|
|
278
|
+
};
|
|
279
|
+
}, {
|
|
280
|
+
observedAt: string;
|
|
281
|
+
capturedAt: string;
|
|
282
|
+
startsAt: null;
|
|
283
|
+
endsAt: null;
|
|
284
|
+
isOpenEnded: boolean;
|
|
285
|
+
provenance: {
|
|
286
|
+
kind: "datadog_current_monitor_query_scope";
|
|
287
|
+
observedAt: string;
|
|
288
|
+
originalIncidentStart: "unknown";
|
|
289
|
+
originalIncidentEnd: "unknown";
|
|
290
|
+
checkedAt: string;
|
|
291
|
+
scopeBasis: "current_monitor_configuration";
|
|
292
|
+
};
|
|
293
|
+
}>, {
|
|
294
|
+
observedAt: string;
|
|
295
|
+
capturedAt: string;
|
|
296
|
+
startsAt: null;
|
|
297
|
+
endsAt: null;
|
|
298
|
+
isOpenEnded: boolean;
|
|
299
|
+
provenance: {
|
|
300
|
+
kind: "datadog_current_monitor_query_scope";
|
|
301
|
+
observedAt: string;
|
|
302
|
+
originalIncidentStart: "unknown";
|
|
303
|
+
originalIncidentEnd: "unknown";
|
|
304
|
+
checkedAt: string;
|
|
305
|
+
scopeBasis: "current_monitor_configuration";
|
|
306
|
+
};
|
|
307
|
+
}, {
|
|
308
|
+
observedAt: string;
|
|
309
|
+
capturedAt: string;
|
|
310
|
+
startsAt: null;
|
|
311
|
+
endsAt: null;
|
|
312
|
+
isOpenEnded: boolean;
|
|
313
|
+
provenance: {
|
|
314
|
+
kind: "datadog_current_monitor_query_scope";
|
|
315
|
+
observedAt: string;
|
|
316
|
+
originalIncidentStart: "unknown";
|
|
317
|
+
originalIncidentEnd: "unknown";
|
|
318
|
+
checkedAt: string;
|
|
319
|
+
scopeBasis: "current_monitor_configuration";
|
|
320
|
+
};
|
|
321
|
+
}>;
|
|
322
|
+
export type DatadogMonitorQueryTimeWindow = z.infer<typeof datadogMonitorQueryTimeWindowSchema>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.datadogMonitorQueryTimeWindowSchema = exports.datadogMonitorQueryTimeProvenanceSchema = exports.datadogMonitorQueryTargetSchema = exports.datadogCurrentMonitorQueryScopeSchema = exports.datadogMonitorQueryScopeSchema = exports.DATADOG_MONITOR_QUERY_MAX_AGE_MS = exports.DATADOG_MONITOR_QUERY_PROFILE = exports.DATADOG_MONITOR_QUERY_SCHEMA_VERSION = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const datadogGroup_1 = require("./datadogGroup");
|
|
6
|
+
exports.DATADOG_MONITOR_QUERY_SCHEMA_VERSION = 'scoutflo.datadog.current-monitor-query.v1';
|
|
7
|
+
exports.DATADOG_MONITOR_QUERY_PROFILE = 'metric_query_kubernetes_deployment_v1';
|
|
8
|
+
exports.DATADOG_MONITOR_QUERY_MAX_AGE_MS = 300000;
|
|
9
|
+
const id = zod_1.z.string().min(1).max(256);
|
|
10
|
+
const timestamp = zod_1.z.string().datetime();
|
|
11
|
+
const fingerprint = zod_1.z.string().length(64).regex(/^[a-f0-9]{64}$/);
|
|
12
|
+
// These are the same literal Kubernetes dimensions, not a native Datadog group.
|
|
13
|
+
exports.datadogMonitorQueryScopeSchema = datadogGroup_1.datadogKubernetesGroupScopeSchema.superRefine((value, ctx) => {
|
|
14
|
+
for (const key of ['clusterName', 'namespace', 'deployment']) {
|
|
15
|
+
if (/[\r\n]/.test(value[key])) {
|
|
16
|
+
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: [key], message: 'Expected exact Kubernetes name' });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const queryIdentity = {
|
|
21
|
+
integrationId: id,
|
|
22
|
+
monitorId: zod_1.z.string().regex(/^[1-9][0-9]{0,19}(?![\s\S])/),
|
|
23
|
+
occurrenceId: id,
|
|
24
|
+
evidenceRef: id,
|
|
25
|
+
classificationFingerprint: fingerprint,
|
|
26
|
+
queryFingerprint: fingerprint,
|
|
27
|
+
scope: exports.datadogMonitorQueryScopeSchema,
|
|
28
|
+
observedAt: timestamp,
|
|
29
|
+
};
|
|
30
|
+
/** Internal enrichment from an authorized, source-bound native monitor read.
|
|
31
|
+
* Parsing this shape does not authenticate it. Never accept it from caller JSON
|
|
32
|
+
* or use it to rewrite the original observation, state, or occurrence reference.
|
|
33
|
+
*/
|
|
34
|
+
exports.datadogCurrentMonitorQueryScopeSchema = zod_1.z.object({
|
|
35
|
+
schemaVersion: zod_1.z.literal(exports.DATADOG_MONITOR_QUERY_SCHEMA_VERSION),
|
|
36
|
+
profile: zod_1.z.literal(exports.DATADOG_MONITOR_QUERY_PROFILE),
|
|
37
|
+
...queryIdentity,
|
|
38
|
+
checkedAt: timestamp,
|
|
39
|
+
}).strict().superRefine((value, ctx) => {
|
|
40
|
+
if (Date.parse(value.checkedAt) < Date.parse(value.observedAt)) {
|
|
41
|
+
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ['checkedAt'], message: 'Query check precedes observation' });
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
/** Current registered Deployment UID/DEPLOYED_AS proof, never historical ownership. */
|
|
45
|
+
exports.datadogMonitorQueryTargetSchema = zod_1.z.object({
|
|
46
|
+
kind: zod_1.z.literal('datadog_kubernetes_monitor_query'),
|
|
47
|
+
...queryIdentity,
|
|
48
|
+
topologyVersionId: id,
|
|
49
|
+
serviceId: id,
|
|
50
|
+
serviceName: zod_1.z.string().min(1).max(253),
|
|
51
|
+
resourceId: id,
|
|
52
|
+
deployedAsRelationshipId: id,
|
|
53
|
+
clusterId: id,
|
|
54
|
+
deploymentUid: id,
|
|
55
|
+
checkedAt: timestamp,
|
|
56
|
+
}).strict();
|
|
57
|
+
exports.datadogMonitorQueryTimeProvenanceSchema = zod_1.z.object({
|
|
58
|
+
kind: zod_1.z.literal('datadog_current_monitor_query_scope'),
|
|
59
|
+
observedAt: timestamp,
|
|
60
|
+
checkedAt: timestamp,
|
|
61
|
+
scopeBasis: zod_1.z.literal('current_monitor_configuration'),
|
|
62
|
+
originalIncidentStart: zod_1.z.literal('unknown'),
|
|
63
|
+
originalIncidentEnd: zod_1.z.literal('unknown'),
|
|
64
|
+
}).strict();
|
|
65
|
+
exports.datadogMonitorQueryTimeWindowSchema = zod_1.z.object({
|
|
66
|
+
capturedAt: timestamp,
|
|
67
|
+
observedAt: timestamp,
|
|
68
|
+
startsAt: zod_1.z.null(),
|
|
69
|
+
endsAt: zod_1.z.null(),
|
|
70
|
+
isOpenEnded: zod_1.z.boolean(),
|
|
71
|
+
provenance: exports.datadogMonitorQueryTimeProvenanceSchema,
|
|
72
|
+
}).strict().superRefine((value, ctx) => {
|
|
73
|
+
if (value.observedAt !== value.provenance.observedAt ||
|
|
74
|
+
Date.parse(value.capturedAt) < Date.parse(value.observedAt) ||
|
|
75
|
+
Date.parse(value.provenance.checkedAt) < Date.parse(value.capturedAt)) {
|
|
76
|
+
ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, path: ['provenance'], message: 'Monitor query time provenance mismatch' });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=datadogMonitorQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datadogMonitorQuery.js","sourceRoot":"","sources":["../../../src/contracts/datadogMonitorQuery.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,iDAAmE;AAEtD,QAAA,oCAAoC,GAAG,2CAAoD,CAAC;AAC5F,QAAA,6BAA6B,GAAG,uCAAgD,C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