@a5c-ai/agent-runtime 5.0.1-staging.04ca6ab00d21 → 5.0.1-staging.40a93c240e7b
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 +6 -0
- package/dist/background/state.d.ts +8 -2
- package/dist/background/state.d.ts.map +1 -1
- package/dist/background/state.js +30 -3
- package/dist/backgroundProcessRegistry.d.ts.map +1 -1
- package/dist/backgroundProcessRegistry.js +3 -0
- package/dist/daemon/daemonLog.d.ts +18 -1
- package/dist/daemon/daemonLog.d.ts.map +1 -1
- package/dist/daemon/daemonLog.js +78 -2
- package/dist/daemon/index.d.ts +1 -1
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/observability/diagnostics.d.ts +25 -0
- package/dist/observability/diagnostics.d.ts.map +1 -0
- package/dist/observability/diagnostics.js +86 -0
- package/dist/observability/health.d.ts.map +1 -1
- package/dist/observability/health.js +17 -1
- package/dist/observability/index.d.ts +1 -0
- package/dist/observability/index.d.ts.map +1 -1
- package/dist/observability/index.js +6 -1
- package/dist/observability/types.d.ts +3 -0
- package/dist/observability/types.d.ts.map +1 -1
- package/dist/telemetry/exporters.d.ts +35 -0
- package/dist/telemetry/exporters.d.ts.map +1 -0
- package/dist/telemetry/exporters.js +141 -0
- package/dist/telemetry/index.d.ts +3 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +10 -1
- package/dist/telemetry/provider.d.ts +2 -1
- package/dist/telemetry/provider.d.ts.map +1 -1
- package/dist/telemetry/provider.js +18 -4
- package/dist/telemetry/traceContext.d.ts +10 -0
- package/dist/telemetry/traceContext.d.ts.map +1 -0
- package/dist/telemetry/traceContext.js +43 -0
- package/dist/telemetry/types.d.ts +24 -0
- package/dist/telemetry/types.d.ts.map +1 -1
- package/package.json +11 -3
package/README.md
CHANGED
|
@@ -4,6 +4,12 @@ Agent runtime layer (L5) for the Babysitter monorepo.
|
|
|
4
4
|
|
|
5
5
|
Provides daemon lifecycle, session management, resource management, and telemetry infrastructure.
|
|
6
6
|
|
|
7
|
+
The runtime observability surface includes compatible daemon JSONL logging policy
|
|
8
|
+
helpers, run-health latency percentiles, pure diagnostics renderers for health,
|
|
9
|
+
metrics, config, and queue state, and optional telemetry trace/export helpers.
|
|
10
|
+
Remote telemetry exporters are opt-in; local and no-op behavior remains the
|
|
11
|
+
default.
|
|
12
|
+
|
|
7
13
|
## Install
|
|
8
14
|
|
|
9
15
|
```bash
|
|
@@ -4,11 +4,17 @@ import { BackgroundProcessRegistry } from "../backgroundProcessRegistry";
|
|
|
4
4
|
* that state.ts actually consumes. Defined locally to avoid a circular
|
|
5
5
|
* dependency between agent-runtime and agent-core.
|
|
6
6
|
*/
|
|
7
|
-
interface BackgroundRegistryOwner {
|
|
7
|
+
export interface BackgroundRegistryOwner {
|
|
8
8
|
backgroundRegistry?: BackgroundProcessRegistry;
|
|
9
9
|
maxBackgroundProcesses?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Stable identifier for the owner. When provided, the registry is stored
|
|
12
|
+
* in a string-keyed Map in addition to the WeakMap. This prevents orphaning
|
|
13
|
+
* when the caller recreates the options object (new object identity) but
|
|
14
|
+
* logically refers to the same owner.
|
|
15
|
+
*/
|
|
16
|
+
registryId?: string;
|
|
10
17
|
}
|
|
11
18
|
export declare function getBackgroundRegistry(options: BackgroundRegistryOwner): BackgroundProcessRegistry;
|
|
12
19
|
export declare function disposeBackgroundRegistry(options: BackgroundRegistryOwner): void;
|
|
13
|
-
export {};
|
|
14
20
|
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/background/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEzE;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/background/state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEzE;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;IAC/C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAcD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,uBAAuB,GAAG,yBAAyB,CA8BjG;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAWhF"}
|
package/dist/background/state.js
CHANGED
|
@@ -3,15 +3,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getBackgroundRegistry = getBackgroundRegistry;
|
|
4
4
|
exports.disposeBackgroundRegistry = disposeBackgroundRegistry;
|
|
5
5
|
const backgroundProcessRegistry_1 = require("../backgroundProcessRegistry");
|
|
6
|
+
/**
|
|
7
|
+
* Primary store — keyed by object identity (auto-collected when owner is GC'd).
|
|
8
|
+
*/
|
|
6
9
|
const scopedRegistries = new WeakMap();
|
|
10
|
+
/**
|
|
11
|
+
* Secondary store — keyed by `registryId` string so that a new options object
|
|
12
|
+
* with the same registryId finds the existing registry instead of creating a
|
|
13
|
+
* new one (which would orphan any background processes tracked by the old one).
|
|
14
|
+
*/
|
|
15
|
+
const namedRegistries = new Map();
|
|
7
16
|
function getBackgroundRegistry(options) {
|
|
8
17
|
if (options.backgroundRegistry) {
|
|
9
18
|
return options.backgroundRegistry;
|
|
10
19
|
}
|
|
20
|
+
// Try the WeakMap first (cheapest path for stable object references).
|
|
11
21
|
let registry = scopedRegistries.get(options);
|
|
12
|
-
if (
|
|
13
|
-
registry
|
|
14
|
-
|
|
22
|
+
if (registry) {
|
|
23
|
+
return registry;
|
|
24
|
+
}
|
|
25
|
+
// Try the string-keyed secondary map when a registryId is provided.
|
|
26
|
+
if (options.registryId) {
|
|
27
|
+
registry = namedRegistries.get(options.registryId);
|
|
28
|
+
if (registry) {
|
|
29
|
+
// Re-attach to the WeakMap so subsequent lookups with this object are fast.
|
|
30
|
+
scopedRegistries.set(options, registry);
|
|
31
|
+
return registry;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// No existing registry found — create a new one.
|
|
35
|
+
registry = new backgroundProcessRegistry_1.BackgroundProcessRegistry({ maxConcurrent: options.maxBackgroundProcesses });
|
|
36
|
+
scopedRegistries.set(options, registry);
|
|
37
|
+
if (options.registryId) {
|
|
38
|
+
namedRegistries.set(options.registryId, registry);
|
|
15
39
|
}
|
|
16
40
|
return registry;
|
|
17
41
|
}
|
|
@@ -22,4 +46,7 @@ function disposeBackgroundRegistry(options) {
|
|
|
22
46
|
}
|
|
23
47
|
registry.dispose();
|
|
24
48
|
scopedRegistries.delete(options);
|
|
49
|
+
if (options.registryId) {
|
|
50
|
+
namedRegistries.delete(options.registryId);
|
|
51
|
+
}
|
|
25
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backgroundProcessRegistry.d.ts","sourceRoot":"","sources":["../src/backgroundProcessRegistry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AAOnD,gDAAgD;AAChD,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC;IACpE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,mDAAmD;AACnD,MA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YAAY,GAAG,oBAAoB;IA0F/C,+DAA+D;IAC/D,GAAG,CAAC,gBAAgB,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAM/D,+CAA+C;IAC/C,IAAI,IAAI,oBAAoB,EAAE;IAI9B,4EAA4E;IAC5E,MAAM,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO;IAczC,kCAAkC;IAClC,OAAO,IAAI,IAAI;IAcf,mDAAmD;IACnD,OAAO,IAAI,IAAI;IASf,OAAO,CAAC,QAAQ;CAcjB"}
|
|
@@ -66,6 +66,9 @@ class BackgroundProcessRegistry {
|
|
|
66
66
|
}
|
|
67
67
|
const backgroundTaskId = (0, babysitter_sdk_1.nextUlid)();
|
|
68
68
|
const startMs = Date.now();
|
|
69
|
+
// HERE BE DRAGONS: Shell invocation is duplicated in 5 files. All must use the same flags.
|
|
70
|
+
// See also: agent-core/session.ts, agent-core/tools/execution.ts,
|
|
71
|
+
// agent-platform/tools/execution.ts, agent-platform/backgroundProcessRegistry.ts
|
|
69
72
|
const shell = process.platform === "win32" ? "cmd.exe" : "/bin/bash";
|
|
70
73
|
const shellArgs = process.platform === "win32"
|
|
71
74
|
? ["/c", opts.command]
|
|
@@ -3,11 +3,28 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Appends structured JSON lines to a daemon activation log file.
|
|
5
5
|
*/
|
|
6
|
+
export type DaemonLogLevel = "debug" | "info" | "warn" | "error" | "fatal";
|
|
6
7
|
export interface DaemonLogEntry {
|
|
7
8
|
timestamp: string;
|
|
8
9
|
event: string;
|
|
10
|
+
level?: DaemonLogLevel;
|
|
11
|
+
schemaVersion?: string;
|
|
12
|
+
sampled?: boolean;
|
|
13
|
+
sequence?: number;
|
|
14
|
+
correlationId?: string;
|
|
15
|
+
traceId?: string;
|
|
16
|
+
spanId?: string;
|
|
9
17
|
data?: Record<string, unknown>;
|
|
10
18
|
}
|
|
11
|
-
export
|
|
19
|
+
export interface DaemonLogPolicy {
|
|
20
|
+
minLevel?: DaemonLogLevel;
|
|
21
|
+
eventAllowList?: readonly string[];
|
|
22
|
+
eventDenyList?: readonly string[];
|
|
23
|
+
sampleRate?: number;
|
|
24
|
+
maxBytes?: number;
|
|
25
|
+
maxFiles?: number;
|
|
26
|
+
schemaVersion?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function appendDaemonLog(logDir: string, entry: DaemonLogEntry, policy?: DaemonLogPolicy): Promise<void>;
|
|
12
29
|
export declare function readDaemonLog(logDir: string): Promise<DaemonLogEntry[]>;
|
|
13
30
|
//# sourceMappingURL=daemonLog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daemonLog.d.ts","sourceRoot":"","sources":["../../src/daemon/daemonLog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"daemonLog.d.ts","sourceRoot":"","sources":["../../src/daemon/daemonLog.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAE3E,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAsED,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,cAAc,EACrB,MAAM,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,EAAE,CAAC,CAY3B"}
|
package/dist/daemon/daemonLog.js
CHANGED
|
@@ -42,10 +42,86 @@ exports.appendDaemonLog = appendDaemonLog;
|
|
|
42
42
|
exports.readDaemonLog = readDaemonLog;
|
|
43
43
|
const node_fs_1 = require("node:fs");
|
|
44
44
|
const path = __importStar(require("node:path"));
|
|
45
|
-
|
|
45
|
+
const DEFAULT_SCHEMA_VERSION = "2026.05.daemon-log-v1";
|
|
46
|
+
const LEVEL_RANK = {
|
|
47
|
+
debug: 10,
|
|
48
|
+
info: 20,
|
|
49
|
+
warn: 30,
|
|
50
|
+
error: 40,
|
|
51
|
+
fatal: 50,
|
|
52
|
+
};
|
|
53
|
+
function shouldWriteEntry(entry, policy) {
|
|
54
|
+
if (!policy)
|
|
55
|
+
return true;
|
|
56
|
+
if (policy.eventAllowList && !policy.eventAllowList.includes(entry.event)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
if (policy.eventDenyList?.includes(entry.event)) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const minLevel = policy.minLevel;
|
|
63
|
+
if (minLevel) {
|
|
64
|
+
const entryLevel = entry.level ?? "info";
|
|
65
|
+
if (LEVEL_RANK[entryLevel] < LEVEL_RANK[minLevel]) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const sampleRate = policy.sampleRate;
|
|
70
|
+
if (sampleRate !== undefined) {
|
|
71
|
+
if (sampleRate <= 0)
|
|
72
|
+
return false;
|
|
73
|
+
if (sampleRate < 1 && deterministicSample(entry, sampleRate) === false) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
function deterministicSample(entry, sampleRate) {
|
|
80
|
+
const key = `${entry.timestamp}:${entry.event}:${entry.correlationId ?? ""}:${entry.traceId ?? ""}`;
|
|
81
|
+
let hash = 0;
|
|
82
|
+
for (let i = 0; i < key.length; i++) {
|
|
83
|
+
hash = (hash * 31 + key.charCodeAt(i)) >>> 0;
|
|
84
|
+
}
|
|
85
|
+
return hash / 0xffffffff < sampleRate;
|
|
86
|
+
}
|
|
87
|
+
async function rotateIfNeeded(logPath, nextLineBytes, policy) {
|
|
88
|
+
const maxBytes = policy?.maxBytes ?? 0;
|
|
89
|
+
if (maxBytes <= 0)
|
|
90
|
+
return;
|
|
91
|
+
let currentSize = 0;
|
|
92
|
+
try {
|
|
93
|
+
currentSize = (await node_fs_1.promises.stat(logPath)).size;
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (currentSize + nextLineBytes <= maxBytes)
|
|
99
|
+
return;
|
|
100
|
+
const maxFiles = Math.max(1, policy?.maxFiles ?? 1);
|
|
101
|
+
for (let index = maxFiles - 1; index >= 1; index--) {
|
|
102
|
+
const from = `${logPath}.${index}`;
|
|
103
|
+
const to = `${logPath}.${index + 1}`;
|
|
104
|
+
await node_fs_1.promises.rename(from, to).catch(() => { });
|
|
105
|
+
}
|
|
106
|
+
await node_fs_1.promises.rename(logPath, `${logPath}.1`).catch(() => { });
|
|
107
|
+
}
|
|
108
|
+
async function appendDaemonLog(logDir, entry, policy) {
|
|
109
|
+
if (!shouldWriteEntry(entry, policy))
|
|
110
|
+
return;
|
|
46
111
|
await node_fs_1.promises.mkdir(logDir, { recursive: true });
|
|
47
112
|
const logPath = path.join(logDir, "daemon.jsonl");
|
|
48
|
-
const
|
|
113
|
+
const serializedEntry = {
|
|
114
|
+
...entry,
|
|
115
|
+
...(policy?.schemaVersion && !entry.schemaVersion
|
|
116
|
+
? { schemaVersion: policy.schemaVersion }
|
|
117
|
+
: {}),
|
|
118
|
+
...(policy?.sampleRate !== undefined ? { sampled: true } : {}),
|
|
119
|
+
};
|
|
120
|
+
if (policy && !serializedEntry.schemaVersion) {
|
|
121
|
+
serializedEntry.schemaVersion = DEFAULT_SCHEMA_VERSION;
|
|
122
|
+
}
|
|
123
|
+
const line = JSON.stringify(serializedEntry) + "\n";
|
|
124
|
+
await rotateIfNeeded(logPath, Buffer.byteLength(line), policy);
|
|
49
125
|
await node_fs_1.promises.appendFile(logPath, line, "utf-8");
|
|
50
126
|
}
|
|
51
127
|
async function readDaemonLog(logDir) {
|
package/dist/daemon/index.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ export { appendDaemonLog, readDaemonLog } from "./daemonLog";
|
|
|
8
8
|
export type { DaemonConfig, DaemonStartOptions, DaemonStartOutput, DaemonStopOptions, DaemonStopOutput, DaemonStatusOptions, DaemonStatusOutput, DaemonMetadata, TriggerConfig, TriggerEvent, FileTriggerEvent, AutomationTriggerEvent, FileTriggerConfig, FileWatcherHandle, WebhookListenerOptions, WebhookListenerHandle, TriggerCallback, } from "./types";
|
|
9
9
|
export type { TimerSchedulerHandle } from "./timerScheduler";
|
|
10
10
|
export type { DaemonLoopOptions, DaemonLoopStatus } from "./loop";
|
|
11
|
-
export type { DaemonLogEntry } from "./daemonLog";
|
|
11
|
+
export type { DaemonLogEntry, DaemonLogLevel, DaemonLogPolicy } from "./daemonLog";
|
|
12
12
|
export type { ApiResult } from "../apiResult";
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/daemon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAClE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/daemon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC7D,YAAY,EACV,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAClE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnF,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DaemonConfig } from "../daemon/types";
|
|
2
|
+
import type { DaemonLoopStatus } from "../daemon/loop";
|
|
3
|
+
import type { RunHealthSnapshot } from "./types";
|
|
4
|
+
export type DiagnosticsRequestPath = "/health" | "/metrics" | "/config" | "/queue";
|
|
5
|
+
export interface DiagnosticsContext {
|
|
6
|
+
health: RunHealthSnapshot;
|
|
7
|
+
queue?: DaemonLoopStatus | null;
|
|
8
|
+
config?: DaemonConfig | Record<string, unknown> | null;
|
|
9
|
+
}
|
|
10
|
+
export interface DiagnosticsSnapshot {
|
|
11
|
+
health: RunHealthSnapshot;
|
|
12
|
+
metrics: string;
|
|
13
|
+
config: unknown;
|
|
14
|
+
queue: DaemonLoopStatus | null;
|
|
15
|
+
}
|
|
16
|
+
export interface DiagnosticsResponse {
|
|
17
|
+
status: number;
|
|
18
|
+
contentType: string;
|
|
19
|
+
body: unknown;
|
|
20
|
+
}
|
|
21
|
+
export declare function redactDiagnosticsConfig(value: unknown): unknown;
|
|
22
|
+
export declare function buildDiagnosticsSnapshot(context: DiagnosticsContext): DiagnosticsSnapshot;
|
|
23
|
+
export declare function renderPrometheusMetrics(context: Pick<DiagnosticsContext, "health" | "queue">): string;
|
|
24
|
+
export declare function handleDiagnosticsRequest(requestPath: DiagnosticsRequestPath, context: DiagnosticsContext): DiagnosticsResponse;
|
|
25
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/observability/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEnF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACxD;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf;AAID,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE/D;AAmBD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,GAAG,mBAAmB,CAQzF;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,MAAM,CA0BrG;AAED,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,sBAAsB,EACnC,OAAO,EAAE,kBAAkB,GAC1B,mBAAmB,CAuBrB"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.redactDiagnosticsConfig = redactDiagnosticsConfig;
|
|
4
|
+
exports.buildDiagnosticsSnapshot = buildDiagnosticsSnapshot;
|
|
5
|
+
exports.renderPrometheusMetrics = renderPrometheusMetrics;
|
|
6
|
+
exports.handleDiagnosticsRequest = handleDiagnosticsRequest;
|
|
7
|
+
const SECRET_KEY_PATTERN = /(secret|token|api[-_]?key|authorization|password|credential|private[-_]?key)/i;
|
|
8
|
+
function redactDiagnosticsConfig(value) {
|
|
9
|
+
return redactValue(value, "");
|
|
10
|
+
}
|
|
11
|
+
function redactValue(value, key) {
|
|
12
|
+
if (SECRET_KEY_PATTERN.test(key)) {
|
|
13
|
+
return "[REDACTED]";
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
return value.map((item) => redactValue(item, ""));
|
|
17
|
+
}
|
|
18
|
+
if (value && typeof value === "object") {
|
|
19
|
+
const result = {};
|
|
20
|
+
for (const [childKey, childValue] of Object.entries(value)) {
|
|
21
|
+
result[childKey] = redactValue(childValue, childKey);
|
|
22
|
+
}
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
function buildDiagnosticsSnapshot(context) {
|
|
28
|
+
const queue = context.queue ?? null;
|
|
29
|
+
return {
|
|
30
|
+
health: context.health,
|
|
31
|
+
queue,
|
|
32
|
+
config: redactDiagnosticsConfig(context.config ?? null),
|
|
33
|
+
metrics: renderPrometheusMetrics({ health: context.health, queue }),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function renderPrometheusMetrics(context) {
|
|
37
|
+
const metrics = context.health.metrics;
|
|
38
|
+
const lines = [
|
|
39
|
+
"# HELP babysitter_run_effect_latency_ms Run effect latency in milliseconds.",
|
|
40
|
+
"# TYPE babysitter_run_effect_latency_ms gauge",
|
|
41
|
+
`babysitter_run_effect_latency_ms{quantile="avg"} ${metrics.avgEffectLatencyMs}`,
|
|
42
|
+
`babysitter_run_effect_latency_ms{quantile="0.5"} ${metrics.p50EffectLatencyMs}`,
|
|
43
|
+
`babysitter_run_effect_latency_ms{quantile="0.95"} ${metrics.p95EffectLatencyMs}`,
|
|
44
|
+
`babysitter_run_effect_latency_ms{quantile="0.99"} ${metrics.p99EffectLatencyMs}`,
|
|
45
|
+
"# HELP babysitter_run_effects_total Run effects by state.",
|
|
46
|
+
"# TYPE babysitter_run_effects_total gauge",
|
|
47
|
+
`babysitter_run_effects_total{state="total"} ${metrics.totalEffects}`,
|
|
48
|
+
`babysitter_run_effects_total{state="resolved"} ${metrics.resolvedEffects}`,
|
|
49
|
+
`babysitter_run_effects_total{state="failed"} ${metrics.failedEffects}`,
|
|
50
|
+
`babysitter_run_effects_total{state="pending"} ${metrics.pendingCount}`,
|
|
51
|
+
"# HELP babysitter_run_error_rate Run effect error rate.",
|
|
52
|
+
"# TYPE babysitter_run_error_rate gauge",
|
|
53
|
+
`babysitter_run_error_rate ${metrics.errorRate}`,
|
|
54
|
+
"# HELP babysitter_daemon_queue_active_runs Active daemon runs.",
|
|
55
|
+
"# TYPE babysitter_daemon_queue_active_runs gauge",
|
|
56
|
+
`babysitter_daemon_queue_active_runs ${context.queue?.activeRuns ?? 0}`,
|
|
57
|
+
"# HELP babysitter_daemon_queue_pending_runs Pending daemon runs.",
|
|
58
|
+
"# TYPE babysitter_daemon_queue_pending_runs gauge",
|
|
59
|
+
`babysitter_daemon_queue_pending_runs ${context.queue?.pendingRuns ?? 0}`,
|
|
60
|
+
];
|
|
61
|
+
return `${lines.join("\n")}\n`;
|
|
62
|
+
}
|
|
63
|
+
function handleDiagnosticsRequest(requestPath, context) {
|
|
64
|
+
switch (requestPath) {
|
|
65
|
+
case "/health":
|
|
66
|
+
return { status: 200, contentType: "application/json", body: context.health };
|
|
67
|
+
case "/metrics":
|
|
68
|
+
return {
|
|
69
|
+
status: 200,
|
|
70
|
+
contentType: "text/plain; version=0.0.4",
|
|
71
|
+
body: renderPrometheusMetrics({ health: context.health, queue: context.queue }),
|
|
72
|
+
};
|
|
73
|
+
case "/config":
|
|
74
|
+
return {
|
|
75
|
+
status: 200,
|
|
76
|
+
contentType: "application/json",
|
|
77
|
+
body: redactDiagnosticsConfig(context.config ?? null),
|
|
78
|
+
};
|
|
79
|
+
case "/queue":
|
|
80
|
+
return {
|
|
81
|
+
status: 200,
|
|
82
|
+
contentType: "application/json",
|
|
83
|
+
body: context.queue ?? null,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/observability/health.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EACV,iBAAiB,EAGjB,YAAY,EACb,MAAM,SAAS,CAAC;AAiBjB,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,kCAAkC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,YAAY,EAAE,EACtB,OAAO,CAAC,EAAE,aAAa,GACtB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/observability/health.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EACV,iBAAiB,EAGjB,YAAY,EACb,MAAM,SAAS,CAAC;AAiBjB,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,kCAAkC;IAClC,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,YAAY,EAAE,EACtB,OAAO,CAAC,EAAE,aAAa,GACtB,iBAAiB,CA0InB"}
|
|
@@ -28,6 +28,7 @@ function computeRunHealthFromEvents(events, options) {
|
|
|
28
28
|
let failedEffects = 0;
|
|
29
29
|
let totalLatency = 0;
|
|
30
30
|
let latencyCount = 0;
|
|
31
|
+
const latencies = [];
|
|
31
32
|
let lastActivityAt = null;
|
|
32
33
|
let hasRunFailed = false;
|
|
33
34
|
const iterations = new Set();
|
|
@@ -53,8 +54,10 @@ function computeRunHealthFromEvents(events, options) {
|
|
|
53
54
|
resolvedEffects.add(effectId);
|
|
54
55
|
const reqTs = requestedAt.get(effectId);
|
|
55
56
|
if (reqTs != null) {
|
|
56
|
-
|
|
57
|
+
const latency = ts - reqTs;
|
|
58
|
+
totalLatency += latency;
|
|
57
59
|
latencyCount++;
|
|
60
|
+
latencies.push(latency);
|
|
58
61
|
}
|
|
59
62
|
const status = typeof event.data.status === "string" ? event.data.status : undefined;
|
|
60
63
|
if (status === "error") {
|
|
@@ -69,6 +72,9 @@ function computeRunHealthFromEvents(events, options) {
|
|
|
69
72
|
const pendingCount = totalEffects - resolvedCount;
|
|
70
73
|
const errorRate = resolvedCount > 0 ? failedEffects / resolvedCount : 0;
|
|
71
74
|
const avgEffectLatencyMs = latencyCount > 0 ? Math.round(totalLatency / latencyCount) : 0;
|
|
75
|
+
const p50EffectLatencyMs = percentile(latencies, 0.5);
|
|
76
|
+
const p95EffectLatencyMs = percentile(latencies, 0.95);
|
|
77
|
+
const p99EffectLatencyMs = percentile(latencies, 0.99);
|
|
72
78
|
// Oldest pending effect age
|
|
73
79
|
let oldestPendingAgeMs = 0;
|
|
74
80
|
for (const [effectId, reqTs] of requestedAt) {
|
|
@@ -82,6 +88,9 @@ function computeRunHealthFromEvents(events, options) {
|
|
|
82
88
|
const metrics = {
|
|
83
89
|
errorRate,
|
|
84
90
|
avgEffectLatencyMs,
|
|
91
|
+
p50EffectLatencyMs,
|
|
92
|
+
p95EffectLatencyMs,
|
|
93
|
+
p99EffectLatencyMs,
|
|
85
94
|
pendingCount,
|
|
86
95
|
oldestPendingAgeMs,
|
|
87
96
|
iterationCount: iterations.size,
|
|
@@ -127,3 +136,10 @@ function computeRunHealthFromEvents(events, options) {
|
|
|
127
136
|
computedAt: new Date(now).toISOString(),
|
|
128
137
|
};
|
|
129
138
|
}
|
|
139
|
+
function percentile(values, quantile) {
|
|
140
|
+
if (values.length === 0)
|
|
141
|
+
return 0;
|
|
142
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
143
|
+
const rank = Math.max(1, Math.ceil(quantile * sorted.length));
|
|
144
|
+
return Math.round(sorted[rank - 1]);
|
|
145
|
+
}
|
|
@@ -3,4 +3,5 @@ export { computeRunHealthFromEvents } from "./health";
|
|
|
3
3
|
export { getRunHealthSnapshot, getOrchestrationStatus, getPendingWorkItems, type OrchestrationStatus, type OrchestrationPhase, type PendingWorkItem, } from "./runStatus";
|
|
4
4
|
export type { PhaseTimeline, PhaseEntry, PhaseName, Milestone, IterationTimeline, RunHealthSnapshot, RunHealthStatus, RunHealthMetrics, HealthConfig, } from "./types";
|
|
5
5
|
export { registerWebhook, unregisterWebhook, listWebhooks, buildWebhookEvent, evaluateAlertLevel, filterRegistrations, type AlertLevel, type WebhookEventType, type WebhookRegistration, type WebhookEvent, type WebhookDeliveryResult, type WebhookRegistry, type WebhookRegistrationInput, WEBHOOK_SCHEMA_VERSION, } from "./webhooks";
|
|
6
|
+
export { buildDiagnosticsSnapshot, handleDiagnosticsRequest, redactDiagnosticsConfig, renderPrometheusMetrics, type DiagnosticsContext, type DiagnosticsRequestPath, type DiagnosticsResponse, type DiagnosticsSnapshot, } from "./diagnostics";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observability/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,aAAa,EACb,UAAU,EACV,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,sBAAsB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WEBHOOK_SCHEMA_VERSION = exports.filterRegistrations = exports.evaluateAlertLevel = exports.buildWebhookEvent = exports.listWebhooks = exports.unregisterWebhook = exports.registerWebhook = exports.getPendingWorkItems = exports.getOrchestrationStatus = exports.getRunHealthSnapshot = exports.computeRunHealthFromEvents = exports.buildPhaseTimelineFromEvents = exports.buildPhaseTimeline = void 0;
|
|
3
|
+
exports.renderPrometheusMetrics = exports.redactDiagnosticsConfig = exports.handleDiagnosticsRequest = exports.buildDiagnosticsSnapshot = exports.WEBHOOK_SCHEMA_VERSION = exports.filterRegistrations = exports.evaluateAlertLevel = exports.buildWebhookEvent = exports.listWebhooks = exports.unregisterWebhook = exports.registerWebhook = exports.getPendingWorkItems = exports.getOrchestrationStatus = exports.getRunHealthSnapshot = exports.computeRunHealthFromEvents = exports.buildPhaseTimelineFromEvents = exports.buildPhaseTimeline = void 0;
|
|
4
4
|
var timeline_1 = require("./timeline");
|
|
5
5
|
Object.defineProperty(exports, "buildPhaseTimeline", { enumerable: true, get: function () { return timeline_1.buildPhaseTimeline; } });
|
|
6
6
|
Object.defineProperty(exports, "buildPhaseTimelineFromEvents", { enumerable: true, get: function () { return timeline_1.buildPhaseTimelineFromEvents; } });
|
|
@@ -18,3 +18,8 @@ Object.defineProperty(exports, "buildWebhookEvent", { enumerable: true, get: fun
|
|
|
18
18
|
Object.defineProperty(exports, "evaluateAlertLevel", { enumerable: true, get: function () { return webhooks_1.evaluateAlertLevel; } });
|
|
19
19
|
Object.defineProperty(exports, "filterRegistrations", { enumerable: true, get: function () { return webhooks_1.filterRegistrations; } });
|
|
20
20
|
Object.defineProperty(exports, "WEBHOOK_SCHEMA_VERSION", { enumerable: true, get: function () { return webhooks_1.WEBHOOK_SCHEMA_VERSION; } });
|
|
21
|
+
var diagnostics_1 = require("./diagnostics");
|
|
22
|
+
Object.defineProperty(exports, "buildDiagnosticsSnapshot", { enumerable: true, get: function () { return diagnostics_1.buildDiagnosticsSnapshot; } });
|
|
23
|
+
Object.defineProperty(exports, "handleDiagnosticsRequest", { enumerable: true, get: function () { return diagnostics_1.handleDiagnosticsRequest; } });
|
|
24
|
+
Object.defineProperty(exports, "redactDiagnosticsConfig", { enumerable: true, get: function () { return diagnostics_1.redactDiagnosticsConfig; } });
|
|
25
|
+
Object.defineProperty(exports, "renderPrometheusMetrics", { enumerable: true, get: function () { return diagnostics_1.renderPrometheusMetrics; } });
|
|
@@ -8,6 +8,9 @@ export type RunHealthStatus = "healthy" | "degraded" | "stuck" | "failed";
|
|
|
8
8
|
export interface RunHealthMetrics {
|
|
9
9
|
errorRate: number;
|
|
10
10
|
avgEffectLatencyMs: number;
|
|
11
|
+
p50EffectLatencyMs: number;
|
|
12
|
+
p95EffectLatencyMs: number;
|
|
13
|
+
p99EffectLatencyMs: number;
|
|
11
14
|
pendingCount: number;
|
|
12
15
|
oldestPendingAgeMs: number;
|
|
13
16
|
iterationCount: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/observability/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,qEAAqE;IACrE,gBAAgB,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,6DAA6D;IAC7D,eAAe,EAAE,MAAM,CAAC;IACxB,uFAAuF;IACvF,aAAa,EAAE,MAAM,CAAC;CACvB;AAMD,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,c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E,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,YAAY,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IACjD,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { TelemetryExporter, TelemetryExportResult, TelemetrySpan } from "./types";
|
|
2
|
+
export declare class NoopTelemetryExporter implements TelemetryExporter {
|
|
3
|
+
export(spans: readonly TelemetrySpan[]): Promise<TelemetryExportResult>;
|
|
4
|
+
flush(): Promise<TelemetryExportResult>;
|
|
5
|
+
}
|
|
6
|
+
export declare class InMemoryTelemetryExporter implements TelemetryExporter {
|
|
7
|
+
private readonly spans;
|
|
8
|
+
export(spans: readonly TelemetrySpan[]): Promise<TelemetryExportResult>;
|
|
9
|
+
getSpans(): TelemetrySpan[];
|
|
10
|
+
clear(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class FileTelemetryExporter implements TelemetryExporter {
|
|
13
|
+
private readonly filePath;
|
|
14
|
+
constructor(filePath: string);
|
|
15
|
+
export(spans: readonly TelemetrySpan[]): Promise<TelemetryExportResult>;
|
|
16
|
+
}
|
|
17
|
+
export interface OtlpHttpTraceExporterOptions {
|
|
18
|
+
endpoint: string;
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
fetch?: (input: string, init: {
|
|
21
|
+
method: string;
|
|
22
|
+
headers: Record<string, string>;
|
|
23
|
+
body: string;
|
|
24
|
+
}) => Promise<{
|
|
25
|
+
ok: boolean;
|
|
26
|
+
status: number;
|
|
27
|
+
text?: () => Promise<string>;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export declare class OtlpHttpTraceExporter implements TelemetryExporter {
|
|
31
|
+
private readonly options;
|
|
32
|
+
constructor(options: OtlpHttpTraceExporterOptions);
|
|
33
|
+
export(spans: readonly TelemetrySpan[]): Promise<TelemetryExportResult>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=exporters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exporters.d.ts","sourceRoot":"","sources":["../../src/telemetry/exporters.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,qBAAqB,EACrB,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,qBAAa,qBAAsB,YAAW,iBAAiB;IACvD,MAAM,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIvE,KAAK,IAAI,OAAO,CAAC,qBAAqB,CAAC;CAG9C;AAED,qBAAa,yBAA0B,YAAW,iBAAiB;IACjE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuB;IAEvC,MAAM,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAK7E,QAAQ,IAAI,aAAa,EAAE;IAI3B,KAAK,IAAI,IAAI;CAGd;AAED,qBAAa,qBAAsB,YAAW,iBAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,MAAM;IAEvC,MAAM,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAQ9E;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;QAC5B,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC,CAAC;CAC9E;AAED,qBAAa,qBAAsB,YAAW,iBAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,4BAA4B;IAE5D,MAAM,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAgC9E"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.OtlpHttpTraceExporter = exports.FileTelemetryExporter = exports.InMemoryTelemetryExporter = exports.NoopTelemetryExporter = void 0;
|
|
37
|
+
const node_fs_1 = require("node:fs");
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
class NoopTelemetryExporter {
|
|
40
|
+
async export(spans) {
|
|
41
|
+
return { ok: true, exported: spans.length };
|
|
42
|
+
}
|
|
43
|
+
async flush() {
|
|
44
|
+
return { ok: true, exported: 0 };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.NoopTelemetryExporter = NoopTelemetryExporter;
|
|
48
|
+
class InMemoryTelemetryExporter {
|
|
49
|
+
spans = [];
|
|
50
|
+
async export(spans) {
|
|
51
|
+
this.spans.push(...spans.map(cloneSpan));
|
|
52
|
+
return { ok: true, exported: spans.length };
|
|
53
|
+
}
|
|
54
|
+
getSpans() {
|
|
55
|
+
return this.spans.map(cloneSpan);
|
|
56
|
+
}
|
|
57
|
+
clear() {
|
|
58
|
+
this.spans.length = 0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.InMemoryTelemetryExporter = InMemoryTelemetryExporter;
|
|
62
|
+
class FileTelemetryExporter {
|
|
63
|
+
filePath;
|
|
64
|
+
constructor(filePath) {
|
|
65
|
+
this.filePath = filePath;
|
|
66
|
+
}
|
|
67
|
+
async export(spans) {
|
|
68
|
+
await node_fs_1.promises.mkdir(path.dirname(this.filePath), { recursive: true });
|
|
69
|
+
const lines = spans.map((span) => JSON.stringify(span)).join("\n");
|
|
70
|
+
if (lines) {
|
|
71
|
+
await node_fs_1.promises.appendFile(this.filePath, `${lines}\n`, "utf-8");
|
|
72
|
+
}
|
|
73
|
+
return { ok: true, exported: spans.length };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.FileTelemetryExporter = FileTelemetryExporter;
|
|
77
|
+
class OtlpHttpTraceExporter {
|
|
78
|
+
options;
|
|
79
|
+
constructor(options) {
|
|
80
|
+
this.options = options;
|
|
81
|
+
}
|
|
82
|
+
async export(spans) {
|
|
83
|
+
const fetchImpl = this.options.fetch ?? globalThis.fetch;
|
|
84
|
+
if (!fetchImpl) {
|
|
85
|
+
return { ok: false, exported: 0, error: "fetch is not available" };
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
const response = await fetchImpl(this.options.endpoint, {
|
|
89
|
+
method: "POST",
|
|
90
|
+
headers: {
|
|
91
|
+
"content-type": "application/json",
|
|
92
|
+
...this.options.headers,
|
|
93
|
+
},
|
|
94
|
+
body: JSON.stringify({ resourceSpans: spans.map(toOtlpSpan) }),
|
|
95
|
+
});
|
|
96
|
+
if (!response.ok) {
|
|
97
|
+
const text = response.text ? await response.text() : "";
|
|
98
|
+
return {
|
|
99
|
+
ok: false,
|
|
100
|
+
exported: 0,
|
|
101
|
+
error: `OTLP HTTP export failed with status ${response.status}${text ? `: ${text}` : ""}`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return { ok: true, exported: spans.length };
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
return {
|
|
108
|
+
ok: false,
|
|
109
|
+
exported: 0,
|
|
110
|
+
error: error instanceof Error ? error.message : String(error),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.OtlpHttpTraceExporter = OtlpHttpTraceExporter;
|
|
116
|
+
function cloneSpan(span) {
|
|
117
|
+
return {
|
|
118
|
+
...span,
|
|
119
|
+
attributes: { ...span.attributes },
|
|
120
|
+
events: span.events.map((event) => ({
|
|
121
|
+
...event,
|
|
122
|
+
attributes: event.attributes ? { ...event.attributes } : undefined,
|
|
123
|
+
})),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function toOtlpSpan(span) {
|
|
127
|
+
return {
|
|
128
|
+
traceId: span.traceId,
|
|
129
|
+
spanId: span.spanId,
|
|
130
|
+
parentSpanId: span.parentSpanId,
|
|
131
|
+
name: span.name,
|
|
132
|
+
startTimeUnixNano: Date.parse(span.startTime) * 1_000_000,
|
|
133
|
+
endTimeUnixNano: span.endTime ? Date.parse(span.endTime) * 1_000_000 : undefined,
|
|
134
|
+
status: { code: span.status },
|
|
135
|
+
attributes: Object.entries(span.attributes).map(([key, value]) => ({
|
|
136
|
+
key,
|
|
137
|
+
value,
|
|
138
|
+
})),
|
|
139
|
+
events: span.events,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Telemetry module — OpenTelemetry-aligned structured telemetry interfaces
|
|
3
3
|
* and in-memory implementations.
|
|
4
4
|
*/
|
|
5
|
-
export { TelemetrySpanStatus, type TelemetryEvent, type TelemetrySpan, type TelemetryProvider, type TelemetryConfig, } from "./types";
|
|
5
|
+
export { TelemetrySpanStatus, type TelemetryEvent, type TelemetrySpan, type TelemetryProvider, type TelemetryConfig, type TraceContext, type TelemetrySpanStartOptions, type TelemetryExporter, type TelemetryExportResult, } from "./types";
|
|
6
6
|
export { InMemoryTelemetryProvider } from "./provider";
|
|
7
7
|
export { AuditLog, type AuditEntry, type AuditFilter, } from "./audit-log";
|
|
8
8
|
export { SpanTree, type SpanTreeNode, type SerializedSpanTreeNode, } from "./span-tree";
|
|
9
|
+
export { createTraceContext, parseTraceParent, serializeTraceParent, type CreateTraceContextOptions, } from "./traceContext";
|
|
10
|
+
export { FileTelemetryExporter, InMemoryTelemetryExporter, NoopTelemetryExporter, OtlpHttpTraceExporter, type OtlpHttpTraceExporterOptions, } from "./exporters";
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EACL,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,sBAAsB,GAC5B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,KAAK,4BAA4B,GAClC,MAAM,aAAa,CAAC"}
|
package/dist/telemetry/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SpanTree = exports.AuditLog = exports.InMemoryTelemetryProvider = exports.TelemetrySpanStatus = void 0;
|
|
3
|
+
exports.OtlpHttpTraceExporter = exports.NoopTelemetryExporter = exports.InMemoryTelemetryExporter = exports.FileTelemetryExporter = exports.serializeTraceParent = exports.parseTraceParent = exports.createTraceContext = exports.SpanTree = exports.AuditLog = exports.InMemoryTelemetryProvider = exports.TelemetrySpanStatus = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Telemetry module — OpenTelemetry-aligned structured telemetry interfaces
|
|
6
6
|
* and in-memory implementations.
|
|
@@ -13,3 +13,12 @@ var audit_log_1 = require("./audit-log");
|
|
|
13
13
|
Object.defineProperty(exports, "AuditLog", { enumerable: true, get: function () { return audit_log_1.AuditLog; } });
|
|
14
14
|
var span_tree_1 = require("./span-tree");
|
|
15
15
|
Object.defineProperty(exports, "SpanTree", { enumerable: true, get: function () { return span_tree_1.SpanTree; } });
|
|
16
|
+
var traceContext_1 = require("./traceContext");
|
|
17
|
+
Object.defineProperty(exports, "createTraceContext", { enumerable: true, get: function () { return traceContext_1.createTraceContext; } });
|
|
18
|
+
Object.defineProperty(exports, "parseTraceParent", { enumerable: true, get: function () { return traceContext_1.parseTraceParent; } });
|
|
19
|
+
Object.defineProperty(exports, "serializeTraceParent", { enumerable: true, get: function () { return traceContext_1.serializeTraceParent; } });
|
|
20
|
+
var exporters_1 = require("./exporters");
|
|
21
|
+
Object.defineProperty(exports, "FileTelemetryExporter", { enumerable: true, get: function () { return exporters_1.FileTelemetryExporter; } });
|
|
22
|
+
Object.defineProperty(exports, "InMemoryTelemetryExporter", { enumerable: true, get: function () { return exporters_1.InMemoryTelemetryExporter; } });
|
|
23
|
+
Object.defineProperty(exports, "NoopTelemetryExporter", { enumerable: true, get: function () { return exporters_1.NoopTelemetryExporter; } });
|
|
24
|
+
Object.defineProperty(exports, "OtlpHttpTraceExporter", { enumerable: true, get: function () { return exporters_1.OtlpHttpTraceExporter; } });
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Stores spans in memory and supports flush/drain for export pipelines.
|
|
6
6
|
*/
|
|
7
|
-
import type { TelemetryProvider, TelemetrySpan, TelemetryEvent } from "./types";
|
|
7
|
+
import type { TelemetryProvider, TelemetrySpan, TelemetryEvent, TelemetrySpanStartOptions } from "./types";
|
|
8
8
|
import { TelemetrySpanStatus } from "./types";
|
|
9
9
|
/**
|
|
10
10
|
* In-memory telemetry provider that satisfies the TelemetryProvider interface.
|
|
@@ -23,6 +23,7 @@ export declare class InMemoryTelemetryProvider implements TelemetryProvider {
|
|
|
23
23
|
/** Maps spanId -> traceId so child spans inherit the parent's trace. */
|
|
24
24
|
private readonly traceIndex;
|
|
25
25
|
startSpan(name: string, parentSpanId?: string): Promise<TelemetrySpan>;
|
|
26
|
+
startSpan(name: string, options?: TelemetrySpanStartOptions): Promise<TelemetrySpan>;
|
|
26
27
|
endSpan(spanId: string, status?: TelemetrySpanStatus): Promise<void>;
|
|
27
28
|
recordEvent(spanId: string, event: TelemetryEvent): Promise<void>;
|
|
28
29
|
flush(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/telemetry/provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,cAAc,
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/telemetry/provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,yBAAyB,EAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAwB9C;;;;;;;;GAQG;AACH,qBAAa,yBAA0B,YAAW,iBAAiB;IACjE,gDAAgD;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IACzD,sCAAsC;IACtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;IAC/C,wEAAwE;IACxE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA6B;IAIlD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IACtE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC;IA2CpF,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAapE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IASjE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;;;;OAKG;IACG,KAAK,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAMvC,gEAAgE;IAChE,cAAc,IAAI,aAAa,EAAE;CAGlC"}
|
|
@@ -28,11 +28,17 @@ class InMemoryTelemetryProvider {
|
|
|
28
28
|
completed = [];
|
|
29
29
|
/** Maps spanId -> traceId so child spans inherit the parent's trace. */
|
|
30
30
|
traceIndex = new Map();
|
|
31
|
-
|
|
32
|
-
async startSpan(name, parentSpanId) {
|
|
31
|
+
async startSpan(name, optionsOrParentSpanId) {
|
|
33
32
|
const spanId = (0, node_crypto_1.randomUUID)();
|
|
33
|
+
const options = typeof optionsOrParentSpanId === "string"
|
|
34
|
+
? { parentSpanId: optionsOrParentSpanId }
|
|
35
|
+
: optionsOrParentSpanId;
|
|
36
|
+
const parentSpanId = options?.traceContext?.spanId ?? options?.parentSpanId;
|
|
34
37
|
let traceId;
|
|
35
|
-
if (
|
|
38
|
+
if (options?.traceContext) {
|
|
39
|
+
traceId = options.traceContext.traceId;
|
|
40
|
+
}
|
|
41
|
+
else if (parentSpanId) {
|
|
36
42
|
// Inherit traceId from the parent span.
|
|
37
43
|
traceId = this.traceIndex.get(parentSpanId) ?? (0, node_crypto_1.randomUUID)();
|
|
38
44
|
}
|
|
@@ -46,7 +52,15 @@ class InMemoryTelemetryProvider {
|
|
|
46
52
|
parentSpanId,
|
|
47
53
|
startTime: new Date().toISOString(),
|
|
48
54
|
status: types_1.TelemetrySpanStatus.Unset,
|
|
49
|
-
attributes: {
|
|
55
|
+
attributes: {
|
|
56
|
+
...options?.attributes,
|
|
57
|
+
...(options?.correlationId
|
|
58
|
+
? { "babysitter.correlation_id": options.correlationId }
|
|
59
|
+
: {}),
|
|
60
|
+
...(options?.traceContext?.correlationId && !options?.correlationId
|
|
61
|
+
? { "babysitter.correlation_id": options.traceContext.correlationId }
|
|
62
|
+
: {}),
|
|
63
|
+
},
|
|
50
64
|
events: [],
|
|
51
65
|
};
|
|
52
66
|
this.active.set(spanId, span);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TraceContext } from "./types";
|
|
2
|
+
export declare function parseTraceParent(header: string): TraceContext | null;
|
|
3
|
+
export declare function serializeTraceParent(context: TraceContext): string;
|
|
4
|
+
export interface CreateTraceContextOptions {
|
|
5
|
+
parent?: TraceContext;
|
|
6
|
+
correlationId?: string;
|
|
7
|
+
sampled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function createTraceContext(options?: CreateTraceContextOptions): TraceContext;
|
|
10
|
+
//# sourceMappingURL=traceContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"traceContext.d.ts","sourceRoot":"","sources":["../../src/telemetry/traceContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQ5C,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAQpE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAElE;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,YAAY,CAYpF"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseTraceParent = parseTraceParent;
|
|
4
|
+
exports.serializeTraceParent = serializeTraceParent;
|
|
5
|
+
exports.createTraceContext = createTraceContext;
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const TRACEPARENT_PATTERN = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;
|
|
8
|
+
function allZero(value) {
|
|
9
|
+
return /^0+$/.test(value);
|
|
10
|
+
}
|
|
11
|
+
function parseTraceParent(header) {
|
|
12
|
+
const match = TRACEPARENT_PATTERN.exec(header.trim());
|
|
13
|
+
if (!match)
|
|
14
|
+
return null;
|
|
15
|
+
const [, version, traceId, spanId, traceFlags] = match;
|
|
16
|
+
if (version !== "00" || allZero(traceId) || allZero(spanId)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return { version, traceId, spanId, traceFlags };
|
|
20
|
+
}
|
|
21
|
+
function serializeTraceParent(context) {
|
|
22
|
+
return `${context.version}-${context.traceId}-${context.spanId}-${context.traceFlags}`;
|
|
23
|
+
}
|
|
24
|
+
function createTraceContext(options) {
|
|
25
|
+
const traceId = options?.parent?.traceId ?? randomHex(16);
|
|
26
|
+
const spanId = randomHex(8);
|
|
27
|
+
const traceFlags = options?.sampled === false ? "00" : options?.parent?.traceFlags ?? "01";
|
|
28
|
+
return {
|
|
29
|
+
version: "00",
|
|
30
|
+
traceId,
|
|
31
|
+
spanId,
|
|
32
|
+
traceFlags,
|
|
33
|
+
parentSpanId: options?.parent?.spanId,
|
|
34
|
+
correlationId: options?.correlationId ?? options?.parent?.correlationId,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function randomHex(bytes) {
|
|
38
|
+
let value = (0, node_crypto_1.randomBytes)(bytes).toString("hex");
|
|
39
|
+
while (allZero(value)) {
|
|
40
|
+
value = (0, node_crypto_1.randomBytes)(bytes).toString("hex");
|
|
41
|
+
}
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
@@ -42,6 +42,20 @@ export interface TelemetrySpan {
|
|
|
42
42
|
/** Discrete events recorded during the span's lifetime. */
|
|
43
43
|
readonly events: TelemetryEvent[];
|
|
44
44
|
}
|
|
45
|
+
export interface TraceContext {
|
|
46
|
+
readonly version: "00";
|
|
47
|
+
readonly traceId: string;
|
|
48
|
+
readonly spanId: string;
|
|
49
|
+
readonly traceFlags: string;
|
|
50
|
+
readonly parentSpanId?: string;
|
|
51
|
+
readonly correlationId?: string;
|
|
52
|
+
}
|
|
53
|
+
export interface TelemetrySpanStartOptions {
|
|
54
|
+
readonly parentSpanId?: string;
|
|
55
|
+
readonly traceContext?: TraceContext;
|
|
56
|
+
readonly correlationId?: string;
|
|
57
|
+
readonly attributes?: Record<string, string | number | boolean>;
|
|
58
|
+
}
|
|
45
59
|
/** Abstraction over a telemetry backend (e.g. OTLP exporter, console, no-op). */
|
|
46
60
|
export interface TelemetryProvider {
|
|
47
61
|
/**
|
|
@@ -52,6 +66,7 @@ export interface TelemetryProvider {
|
|
|
52
66
|
* @returns The newly created span.
|
|
53
67
|
*/
|
|
54
68
|
startSpan(name: string, parentSpanId?: string): Promise<TelemetrySpan>;
|
|
69
|
+
startSpan(name: string, options?: TelemetrySpanStartOptions): Promise<TelemetrySpan>;
|
|
55
70
|
/**
|
|
56
71
|
* End an in-flight span.
|
|
57
72
|
*
|
|
@@ -82,4 +97,13 @@ export interface TelemetryConfig {
|
|
|
82
97
|
/** Named exporters to send telemetry data to (e.g. "otlp", "console", "file"). */
|
|
83
98
|
readonly exporters?: string[];
|
|
84
99
|
}
|
|
100
|
+
export interface TelemetryExportResult {
|
|
101
|
+
readonly ok: boolean;
|
|
102
|
+
readonly exported: number;
|
|
103
|
+
readonly error?: string;
|
|
104
|
+
}
|
|
105
|
+
export interface TelemetryExporter {
|
|
106
|
+
export(spans: readonly TelemetrySpan[]): Promise<TelemetryExportResult>;
|
|
107
|
+
flush?(): Promise<TelemetryExportResult>;
|
|
108
|
+
}
|
|
85
109
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/telemetry/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,yEAAyE;AACzE,oBAAY,mBAAmB;IAC7B,wCAAwC;IACxC,EAAE,OAAO;IACT,oCAAoC;IACpC,KAAK,UAAU;IACf,oDAAoD;IACpD,KAAK,UAAU;CAChB;AAMD,+CAA+C;AAC/C,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;CACjE;AAMD,gFAAgF;AAChF,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2DAA2D;IAC3D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,gDAAgD;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;IACrC,iDAAiD;IACj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IAErE;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElE;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAMD,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,+EAA+E;IAC/E,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IACtC,yDAAyD;IACzD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,kFAAkF;IAClF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACxE,KAAK,CAAC,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;CAC1C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a5c-ai/agent-runtime",
|
|
3
|
-
"version": "5.0.1-staging.
|
|
3
|
+
"version": "5.0.1-staging.40a93c240e7b",
|
|
4
4
|
"description": "Agent runtime layer (L5) — daemon, session, resource management, telemetry",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -32,6 +32,11 @@
|
|
|
32
32
|
"require": "./dist/observability/index.js",
|
|
33
33
|
"default": "./dist/observability/index.js"
|
|
34
34
|
},
|
|
35
|
+
"./telemetry": {
|
|
36
|
+
"types": "./dist/telemetry/index.d.ts",
|
|
37
|
+
"require": "./dist/telemetry/index.js",
|
|
38
|
+
"default": "./dist/telemetry/index.js"
|
|
39
|
+
},
|
|
35
40
|
"./package.json": "./package.json"
|
|
36
41
|
},
|
|
37
42
|
"typesVersions": {
|
|
@@ -47,6 +52,9 @@
|
|
|
47
52
|
],
|
|
48
53
|
"observability": [
|
|
49
54
|
"dist/observability/index.d.ts"
|
|
55
|
+
],
|
|
56
|
+
"telemetry": [
|
|
57
|
+
"dist/telemetry/index.d.ts"
|
|
50
58
|
]
|
|
51
59
|
}
|
|
52
60
|
},
|
|
@@ -63,8 +71,8 @@
|
|
|
63
71
|
"test": "vitest run --config vitest.config.ts"
|
|
64
72
|
},
|
|
65
73
|
"dependencies": {
|
|
66
|
-
"@a5c-ai/agent-comm-mux": "5.0.1-staging.
|
|
67
|
-
"@a5c-ai/babysitter-sdk": "5.0.1-staging.
|
|
74
|
+
"@a5c-ai/agent-comm-mux": "5.0.1-staging.40a93c240e7b",
|
|
75
|
+
"@a5c-ai/babysitter-sdk": "5.0.1-staging.40a93c240e7b"
|
|
68
76
|
},
|
|
69
77
|
"devDependencies": {
|
|
70
78
|
"@types/node": "^20.11.30",
|