@obsunified/collector 2.2.3 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth.d.ts +2 -1
- package/dist/{chunk-ZSF5XP3B.js → chunk-RASSTGNB.js} +30 -22
- package/dist/chunk-RASSTGNB.js.map +1 -0
- package/dist/index.d.ts +264 -62
- package/dist/index.js +3390 -2350
- package/dist/index.js.map +1 -1
- package/dist/{ingest-auth-C5-8Mly5.d.ts → ingest-auth-BTowieER.d.ts} +96 -1
- package/dist/{openai-GSJZGFGL.js → openai-VDKVVZAV.js} +2 -2
- package/package.json +4 -2
- package/src/__tests__/autosre-closed-loop.test.ts +110 -0
- package/src/__tests__/db-parity.integration.test.ts +961 -0
- package/src/__tests__/internal-contracts-routes.test.ts +451 -0
- package/src/framework/env.ts +113 -0
- package/src/index.ts +27 -4
- package/src/lib/ai-store/evaluations.test.ts +3 -3
- package/src/lib/alert-email.ts +104 -0
- package/src/lib/alerts-store.test.ts +116 -2
- package/src/lib/alerts-store.ts +421 -57
- package/src/lib/analyses-store.test.ts +6 -6
- package/src/lib/db-parity.ts +883 -0
- package/src/lib/eval-cases-store.test.ts +1 -1
- package/src/lib/eval-cases-store.ts +16 -4
- package/src/lib/evidence-references.ts +30 -22
- package/src/lib/metric-alerts.test.ts +769 -0
- package/src/lib/metric-alerts.ts +640 -0
- package/src/lib/metrics-store.ts +9 -2
- package/src/lib/sql-db-postgres.integration.test.ts +247 -0
- package/src/lib/stage6.test.ts +1 -1
- package/src/lib/store/trace-queries.ts +1 -1
- package/src/migrations/054_alert_rules_pending_secs.sql +11 -0
- package/src/migrations/055_alert_state_pending_since.sql +12 -0
- package/src/migrations/056_metric_point_series_received.sql +9 -0
- package/src/migrations/057_alert_evaluations_outcome.sql +11 -0
- package/src/migrations/058_alert_state_pending_seen_at.sql +12 -0
- package/src/migrations/059_alert_evaluations_error.sql +11 -0
- package/src/migrations/parity.test.ts +105 -3
- package/src/migrations-postgres/054_alert_rules_pending_secs.sql +7 -0
- package/src/migrations-postgres/055_alert_state_pending_since.sql +6 -0
- package/src/migrations-postgres/056_metric_point_series_received.sql +7 -0
- package/src/migrations-postgres/057_alert_evaluations_outcome.sql +6 -0
- package/src/migrations-postgres/058_alert_state_pending_seen_at.sql +6 -0
- package/src/migrations-postgres/059_alert_evaluations_error.sql +6 -0
- package/src/migrations-postgres/README.md +13 -0
- package/src/plugins/ai-receiver.ts +6 -1
- package/src/plugins/alerts-evaluator-pending.test.ts +322 -0
- package/src/plugins/alerts-evaluator-retention.test.ts +2 -0
- package/src/plugins/alerts-evaluator.test.ts +10 -2
- package/src/plugins/alerts-evaluator.ts +239 -40
- package/src/plugins/alerts-routes.ts +17 -2
- package/src/plugins/autosre-routes.ts +251 -140
- package/src/plugins/connected-routes/manifest.test.ts +114 -32
- package/src/plugins/connected-routes/manifest.ts +59 -76
- package/src/plugins/connected-routes.test.ts +10 -8
- package/src/plugins/connected-routes.ts +42 -12
- package/src/plugins/eval-cases-routes.ts +33 -10
- package/src/plugins/evidence-retrieval-routes.ts +60 -25
- package/dist/chunk-ZSF5XP3B.js.map +0 -1
- /package/dist/{openai-GSJZGFGL.js.map → openai-VDKVVZAV.js.map} +0 -0
|
@@ -3,7 +3,10 @@ import type {
|
|
|
3
3
|
EvidenceReferenceContract as EvidenceReferenceContractType,
|
|
4
4
|
JsonValue,
|
|
5
5
|
} from "@obsunified/types";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
dashboardRouteToHref,
|
|
8
|
+
EVIDENCE_REFERENCE_CONTRACT,
|
|
9
|
+
} from "@obsunified/types";
|
|
7
10
|
import { sourceLinkEvidenceReferences } from "./evidence-references";
|
|
8
11
|
import { randomHex } from "./hash";
|
|
9
12
|
import { parseJsonArray, parseJsonValue } from "./json";
|
|
@@ -345,7 +348,10 @@ const evalCaseEvidenceReferences = (evalCase: EvalCase): EvidenceReference[] =>
|
|
|
345
348
|
sourceLabel: `Eval case "${evalCase.name}"`,
|
|
346
349
|
sourceId: evalCase.id,
|
|
347
350
|
sourceKind: "eval_case",
|
|
348
|
-
sourceRoute:
|
|
351
|
+
sourceRoute: dashboardRouteToHref({
|
|
352
|
+
tab: "evaluations",
|
|
353
|
+
evaluationId: evalCase.id,
|
|
354
|
+
}),
|
|
349
355
|
sourceName: evalCase.name,
|
|
350
356
|
},
|
|
351
357
|
evalCase,
|
|
@@ -384,7 +390,10 @@ const evalRunEvidenceReferences = (run: EvalRun): EvidenceReference[] => {
|
|
|
384
390
|
sourceLabel: `Eval run "${run.id}"`,
|
|
385
391
|
sourceId: run.id,
|
|
386
392
|
sourceKind: "eval_run",
|
|
387
|
-
sourceRoute:
|
|
393
|
+
sourceRoute: dashboardRouteToHref({
|
|
394
|
+
tab: "evaluations",
|
|
395
|
+
evaluationId: run.evalCaseId ?? run.id,
|
|
396
|
+
}),
|
|
388
397
|
sourceName: run.sourceEvalCase.name,
|
|
389
398
|
},
|
|
390
399
|
run.sourceEvalCase,
|
|
@@ -413,7 +422,10 @@ const rowToEvalRun = (row: EvalRunRow): EvalRun => {
|
|
|
413
422
|
sourceLabel: `Eval case "${sourceEvalCase.name}"`,
|
|
414
423
|
sourceId: sourceEvalCase.id,
|
|
415
424
|
sourceKind: "eval_case",
|
|
416
|
-
sourceRoute:
|
|
425
|
+
sourceRoute: dashboardRouteToHref({
|
|
426
|
+
tab: "evaluations",
|
|
427
|
+
evaluationId: sourceEvalCase.id,
|
|
428
|
+
}),
|
|
417
429
|
sourceName: sourceEvalCase.name,
|
|
418
430
|
},
|
|
419
431
|
sourceEvalCase,
|
|
@@ -10,9 +10,10 @@ import type {
|
|
|
10
10
|
EvidenceReference,
|
|
11
11
|
JsonValue,
|
|
12
12
|
} from "@obsunified/types";
|
|
13
|
+
import { dashboardRouteToHref, hrefForEntity } from "@obsunified/types";
|
|
13
14
|
|
|
14
15
|
const analysisRoute = (analysisId: string) =>
|
|
15
|
-
|
|
16
|
+
dashboardRouteToHref({ tab: "investigate", investigationId: analysisId });
|
|
16
17
|
|
|
17
18
|
export const analysisEvidenceReference = (
|
|
18
19
|
evidence: AskEvidence,
|
|
@@ -103,10 +104,10 @@ const valueFor = (
|
|
|
103
104
|
};
|
|
104
105
|
|
|
105
106
|
const traceRoute = (traceId: string) =>
|
|
106
|
-
|
|
107
|
+
dashboardRouteToHref({ tab: "traces", traceId });
|
|
107
108
|
|
|
108
109
|
const spanRoute = (traceId: string, spanId: string) =>
|
|
109
|
-
|
|
110
|
+
dashboardRouteToHref({ tab: "traces", traceId, spanId });
|
|
110
111
|
|
|
111
112
|
export const evidenceRouteFor = (
|
|
112
113
|
entityKind: EvidenceEntityKind,
|
|
@@ -117,41 +118,48 @@ export const evidenceRouteFor = (
|
|
|
117
118
|
case "analysis":
|
|
118
119
|
return analysisRoute(entityId);
|
|
119
120
|
case "action":
|
|
120
|
-
return
|
|
121
|
+
return dashboardRouteToHref({ tab: "actions", actionId: entityId });
|
|
121
122
|
case "alert":
|
|
122
|
-
return
|
|
123
|
+
return dashboardRouteToHref({ tab: "alerts", alertId: entityId });
|
|
123
124
|
case "agent_run":
|
|
124
|
-
return
|
|
125
|
+
return dashboardRouteToHref({ tab: "agent-runs", agentRunId: entityId });
|
|
125
126
|
case "ai_call":
|
|
126
|
-
return
|
|
127
|
+
return dashboardRouteToHref({ tab: "ai", aiCallId: entityId });
|
|
127
128
|
case "eval":
|
|
128
|
-
return
|
|
129
|
+
return dashboardRouteToHref({
|
|
130
|
+
tab: "evaluations",
|
|
131
|
+
evaluationId: entityId,
|
|
132
|
+
});
|
|
129
133
|
case "log":
|
|
130
|
-
return
|
|
134
|
+
return dashboardRouteToHref({ tab: "logs", logId: entityId });
|
|
131
135
|
case "profile":
|
|
132
|
-
return
|
|
133
|
-
|
|
134
|
-
:
|
|
136
|
+
return dashboardRouteToHref({
|
|
137
|
+
tab: "profiles",
|
|
138
|
+
profileId: entityId,
|
|
139
|
+
...(traceId ? { traceId } : {}),
|
|
140
|
+
});
|
|
135
141
|
case "replay":
|
|
136
|
-
return
|
|
142
|
+
return dashboardRouteToHref({ tab: "replay", sessionId: entityId });
|
|
137
143
|
case "service":
|
|
138
|
-
return
|
|
144
|
+
return dashboardRouteToHref({ tab: "service-map", service: entityId });
|
|
139
145
|
case "span": {
|
|
140
146
|
const [tracePart, spanPart] = entityId.split(":");
|
|
141
|
-
return spanPart
|
|
147
|
+
return spanPart
|
|
148
|
+
? spanRoute(tracePart, spanPart)
|
|
149
|
+
: hrefForEntity("span", entityId, traceId ? { traceId } : undefined);
|
|
142
150
|
}
|
|
143
151
|
case "tool_call":
|
|
144
|
-
return
|
|
152
|
+
return dashboardRouteToHref({ tab: "tool-calls", toolCallId: entityId });
|
|
145
153
|
case "trace":
|
|
146
154
|
return traceRoute(entityId);
|
|
147
155
|
case "docs":
|
|
148
|
-
return
|
|
156
|
+
return hrefForEntity("docs", entityId);
|
|
149
157
|
case "change":
|
|
150
|
-
return
|
|
158
|
+
return dashboardRouteToHref({ tab: "changes", changeId: entityId });
|
|
151
159
|
case "finding":
|
|
152
|
-
return
|
|
160
|
+
return dashboardRouteToHref({ tab: "findings", findingId: entityId });
|
|
153
161
|
case "incident":
|
|
154
|
-
return
|
|
162
|
+
return dashboardRouteToHref({ tab: "incidents", incidentId: entityId });
|
|
155
163
|
}
|
|
156
164
|
const exhaustive: never = entityKind;
|
|
157
165
|
return exhaustive;
|
|
@@ -232,7 +240,7 @@ const instrumentationGapEvidenceReferences = (
|
|
|
232
240
|
const thresholdText = thresholdVersion
|
|
233
241
|
? ` Thresholds: ${thresholdVersion}.`
|
|
234
242
|
: "";
|
|
235
|
-
const docsRoute = "
|
|
243
|
+
const docsRoute = hrefForEntity("docs", "howto/ebpf");
|
|
236
244
|
return {
|
|
237
245
|
evidenceId: `analysis:${result.analysisId}:instrumentation-gap:${index}:span:${entityId}`,
|
|
238
246
|
entityKind: "span",
|
|
@@ -262,7 +270,7 @@ const instrumentationGapEvidenceReferences = (
|
|
|
262
270
|
label: "Open trace gap data",
|
|
263
271
|
entityKind: "trace",
|
|
264
272
|
entityId: traceId,
|
|
265
|
-
route:
|
|
273
|
+
route: traceRoute(traceId),
|
|
266
274
|
reason:
|
|
267
275
|
"Review all structured instrumentation blindspots for this trace.",
|
|
268
276
|
},
|