@osfactory/otel-hook 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -4
- package/dist/{adapter-B9RwW6TO.d.ts → adapter-DQiPu8xF.d.ts} +2 -2
- package/dist/cli.js +1495 -135
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +11 -4
- package/dist/config.js +116 -21
- package/dist/config.js.map +1 -1
- package/dist/{destinations-DWOkVxV1.d.ts → destinations-DvqsPulb.d.ts} +12 -2
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.js.map +1 -1
- package/dist/{events-CSD_YiJ2.d.ts → events-fcomX6d5.d.ts} +22 -0
- package/dist/{export-destinations-lORbe25J.d.ts → export-destinations-CI7z4n3i.d.ts} +136 -6
- package/dist/{filesystem-store-DX3dGIgu.d.ts → filesystem-store-CmnUlj1O.d.ts} +1 -1
- package/dist/{hook-BAxXoKsp.d.ts → hook-vM_cgqS2.d.ts} +11 -5
- package/dist/index.d.ts +16 -16
- package/dist/index.js +1496 -183
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +4 -4
- package/dist/install.js +9 -1
- package/dist/install.js.map +1 -1
- package/dist/integration.d.ts +36 -12
- package/dist/integration.js +1464 -231
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.d.ts +55 -4
- package/dist/lifecycle.js +279 -5
- package/dist/lifecycle.js.map +1 -1
- package/dist/{memory-aJilVG4R.d.ts → memory-DdU1U91y.d.ts} +2 -2
- package/dist/{semconv-Dw7gcQcg.d.ts → metric-model-C9lLqqpI.d.ts} +157 -2
- package/dist/model.d.ts +1 -1
- package/dist/model.js +9 -1
- package/dist/model.js.map +1 -1
- package/dist/{payload-D7gc0-WQ.d.ts → payload-BT19hiVZ.d.ts} +1 -1
- package/dist/{ports-plO5MKrY.d.ts → ports-C3k_5eOQ.d.ts} +57 -2
- package/dist/providers.d.ts +10 -10
- package/dist/providers.js +10 -1
- package/dist/providers.js.map +1 -1
- package/dist/{registry-C7XO4DzD.d.ts → registry-gyJqaWmp.d.ts} +2 -2
- package/dist/runtime.d.ts +97 -9
- package/dist/runtime.js +312 -33
- package/dist/runtime.js.map +1 -1
- package/dist/{schema-CHb3GU1r.d.ts → schema-SpFM6YQY.d.ts} +87 -1
- package/dist/state.d.ts +4 -4
- package/dist/state.js +32 -1
- package/dist/state.js.map +1 -1
- package/dist/telemetry.d.ts +6 -6
- package/dist/telemetry.js +929 -31
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.d.ts +11 -9
- package/dist/testing.js +164 -33
- package/dist/testing.js.map +1 -1
- package/package.json +3 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { E as ExporterPolicy } from './schema-
|
|
2
|
+
import { E as ExporterPolicy } from './schema-SpFM6YQY.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Export destinations: one batch, several OTLP endpoints.
|
|
@@ -35,6 +35,7 @@ declare const HEADER_ENV_REFERENCE_PREFIX = "env:";
|
|
|
35
35
|
declare const exportSignalSchema: z.ZodEnum<{
|
|
36
36
|
traces: "traces";
|
|
37
37
|
logs: "logs";
|
|
38
|
+
metrics: "metrics";
|
|
38
39
|
}>;
|
|
39
40
|
type ExportSignal = z.infer<typeof exportSignalSchema>;
|
|
40
41
|
declare const exportDestinationSchema: z.ZodObject<{
|
|
@@ -43,6 +44,7 @@ declare const exportDestinationSchema: z.ZodObject<{
|
|
|
43
44
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
44
45
|
tracesEndpoint: z.ZodOptional<z.ZodString>;
|
|
45
46
|
logsEndpoint: z.ZodOptional<z.ZodString>;
|
|
47
|
+
metricsEndpoint: z.ZodOptional<z.ZodString>;
|
|
46
48
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
47
49
|
none: "none";
|
|
48
50
|
"http/protobuf": "http/protobuf";
|
|
@@ -52,15 +54,19 @@ declare const exportDestinationSchema: z.ZodObject<{
|
|
|
52
54
|
signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
53
55
|
traces: "traces";
|
|
54
56
|
logs: "logs";
|
|
57
|
+
metrics: "metrics";
|
|
55
58
|
}>>>>;
|
|
56
59
|
}, z.core.$strict>;
|
|
57
60
|
type ExportDestinationConfig = z.infer<typeof exportDestinationSchema>;
|
|
61
|
+
/** Signals a destination receives when it does not list any: never metrics. */
|
|
62
|
+
declare const DEFAULT_DESTINATION_SIGNALS: readonly ExportSignal[];
|
|
58
63
|
declare const exportDestinationsSchema: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
59
64
|
name: z.ZodString;
|
|
60
65
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
61
66
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
62
67
|
tracesEndpoint: z.ZodOptional<z.ZodString>;
|
|
63
68
|
logsEndpoint: z.ZodOptional<z.ZodString>;
|
|
69
|
+
metricsEndpoint: z.ZodOptional<z.ZodString>;
|
|
64
70
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
65
71
|
none: "none";
|
|
66
72
|
"http/protobuf": "http/protobuf";
|
|
@@ -70,6 +76,7 @@ declare const exportDestinationsSchema: z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
|
70
76
|
signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
71
77
|
traces: "traces";
|
|
72
78
|
logs: "logs";
|
|
79
|
+
metrics: "metrics";
|
|
73
80
|
}>>>>;
|
|
74
81
|
}, z.core.$strict>>>;
|
|
75
82
|
/**
|
|
@@ -107,9 +114,11 @@ type ExportDestination = {
|
|
|
107
114
|
readonly endpoint?: string;
|
|
108
115
|
readonly tracesEndpoint?: string;
|
|
109
116
|
readonly logsEndpoint?: string;
|
|
117
|
+
readonly metricsEndpoint?: string;
|
|
110
118
|
readonly signals: {
|
|
111
119
|
readonly traces: boolean;
|
|
112
120
|
readonly logs: boolean;
|
|
121
|
+
readonly metrics: boolean;
|
|
113
122
|
};
|
|
114
123
|
readonly headers: Readonly<Record<string, string>>;
|
|
115
124
|
};
|
|
@@ -158,6 +167,7 @@ type DestinationDescription = {
|
|
|
158
167
|
readonly signals: readonly ExportSignal[];
|
|
159
168
|
readonly tracesEndpointOrigin?: string;
|
|
160
169
|
readonly logsEndpointOrigin?: string;
|
|
170
|
+
readonly metricsEndpointOrigin?: string;
|
|
161
171
|
readonly headerNames: readonly string[];
|
|
162
172
|
/** Environment variables this destination's headers reference. */
|
|
163
173
|
readonly headerVariables: readonly string[];
|
|
@@ -166,4 +176,4 @@ declare const endpointOrigin: (endpoint: string | undefined) => string | undefin
|
|
|
166
176
|
/** Every configured destination, disabled ones included, for `doctor` and snapshots. */
|
|
167
177
|
declare const describeExportDestinations: (exporter: ExporterPolicy) => readonly DestinationDescription[];
|
|
168
178
|
|
|
169
|
-
export { DEFAULT_DESTINATION_NAME as D, type ExportDestination as E, HEADER_ENV_REFERENCE_PREFIX as H, MAX_DESTINATION_HEADERS as M, type ResolvedDestinationHeaders as R, type SpoolPolicy as S,
|
|
179
|
+
export { DEFAULT_DESTINATION_NAME as D, type ExportDestination as E, HEADER_ENV_REFERENCE_PREFIX as H, MAX_DESTINATION_HEADERS as M, type ResolvedDestinationHeaders as R, type SpoolPolicy as S, DEFAULT_DESTINATION_SIGNALS as a, DEFAULT_SPOOL_POLICY as b, DESTINATION_NAME_PATTERN as c, type DestinationDescription as d, type ExportDestinationConfig as e, type ExportSignal as f, type HeaderValueReference as g, MAX_EXPORT_DESTINATIONS as h, describeExportDestinations as i, effectiveSpoolPolicy as j, endpointOrigin as k, exportDestinationSchema as l, exportDestinationsSchema as m, exportSignalSchema as n, hasConfiguredDestinations as o, parseHeaderValueReference as p, resolveExportDestinations as q, resolveDestinationHeaders as r, spoolPolicySchema as s };
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import 'zod';
|
|
|
11
11
|
* is broken. `telemetry-sink` remains the traces signal, unrenamed, so an existing
|
|
12
12
|
* `doctor --json` consumer keeps reading the same field.
|
|
13
13
|
*/
|
|
14
|
-
type DeliverySubsystem = "state-store" | "telemetry-sink" | "telemetry-log-sink" | "lifecycle";
|
|
14
|
+
type DeliverySubsystem = "state-store" | "telemetry-sink" | "telemetry-log-sink" | "telemetry-metric-sink" | "lifecycle";
|
|
15
15
|
/**
|
|
16
16
|
* Sanitized delivery health.
|
|
17
17
|
*
|
package/dist/diagnostics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/diagnostics/health.ts"],"sourcesContent":["import type { OtelHookErrorCode } from \"../errors/index.js\";\nimport type { EpochMillis } from \"../model/primitives.js\";\n\n/**\n * One tracked delivery path.\n *\n * The two telemetry signals are separate subsystems because they fail\n * independently — a collector with no logs receiver leaves traces perfectly\n * healthy — and a single combined verdict would make an operator bisect which one\n * is broken. `telemetry-sink` remains the traces signal, unrenamed, so an existing\n * `doctor --json` consumer keeps reading the same field.\n */\nexport type DeliverySubsystem =\n | \"state-store\"\n | \"telemetry-sink\"\n | \"telemetry-log-sink\"\n | \"lifecycle\";\n\n/**\n * Sanitized delivery health.\n *\n * Every field is a count, a timestamp, a boolean, or a closed-vocabulary error\n * code — the same restriction the privacy service applies to everything else\n * that might reach a sink, so a health snapshot is itself safe to export or log\n * without a second review.\n */\nexport type DeliveryHealthSnapshot = {\n readonly subsystem: DeliverySubsystem;\n readonly healthy: boolean;\n readonly totalAccepted: number;\n readonly totalRejected: number;\n readonly consecutiveFailures: number;\n readonly lastSuccessAt?: EpochMillis;\n readonly lastFailureAt?: EpochMillis;\n readonly lastErrorCode?: OtelHookErrorCode;\n /**\n * Export destination this snapshot describes. Present only when\n * `exporter.destinations` is in use, so a single-destination snapshot is\n * unchanged.\n */\n readonly destination?: string;\n};\n\nexport type HealthTrackerOptions = {\n /** Consecutive failures at or beyond this count flip `healthy` to false. Default 3. */\n readonly unhealthyAfterConsecutiveFailures?: number;\n /** Labels every snapshot with an export destination name. */\n readonly destination?: string;\n};\n\n/**\n * Accumulates success/failure counts for one subsystem instance.\n *\n * Deliberately per-instance rather than a module-level registry: a store or\n * sink constructs its own tracker and exposes a `health()` accessor, so two\n * instances in one process never share counters (see ADR 0001 on module-level\n * identity).\n */\nexport interface HealthTracker {\n recordSuccess(count?: number, at?: number): void;\n recordFailure(code: OtelHookErrorCode, count?: number, at?: number): void;\n snapshot(): DeliveryHealthSnapshot;\n}\n\nexport const createHealthTracker = (\n subsystem: DeliverySubsystem,\n options: HealthTrackerOptions = {},\n): HealthTracker => {\n const unhealthyThreshold = options.unhealthyAfterConsecutiveFailures ?? 3;\n let totalAccepted = 0;\n let totalRejected = 0;\n let consecutiveFailures = 0;\n let lastSuccessAt: number | undefined;\n let lastFailureAt: number | undefined;\n let lastErrorCode: OtelHookErrorCode | undefined;\n\n return {\n recordSuccess: (count = 1, at?: number): void => {\n totalAccepted += count;\n consecutiveFailures = 0;\n if (at !== undefined) {\n lastSuccessAt = at;\n }\n },\n recordFailure: (code: OtelHookErrorCode, count = 1, at?: number): void => {\n totalRejected += count;\n consecutiveFailures += 1;\n lastErrorCode = code;\n if (at !== undefined) {\n lastFailureAt = at;\n }\n },\n snapshot: (): DeliveryHealthSnapshot => ({\n subsystem,\n healthy: consecutiveFailures < unhealthyThreshold,\n totalAccepted,\n totalRejected,\n consecutiveFailures,\n ...(lastSuccessAt === undefined ? {} : { lastSuccessAt }),\n ...(lastFailureAt === undefined ? {} : { lastFailureAt }),\n ...(lastErrorCode === undefined ? {} : { lastErrorCode }),\n ...(options.destination === undefined ? {} : { destination: options.destination }),\n }),\n };\n};\n\nexport type OverallHealth = {\n readonly healthy: boolean;\n readonly subsystems: readonly DeliveryHealthSnapshot[];\n};\n\n/** Combines snapshots from every configured subsystem into one overall verdict. */\nexport const summarizeHealth = (snapshots: readonly DeliveryHealthSnapshot[]): OverallHealth => ({\n healthy: snapshots.every((snapshot) => snapshot.healthy),\n subsystems: [...snapshots],\n});\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/diagnostics/health.ts"],"sourcesContent":["import type { OtelHookErrorCode } from \"../errors/index.js\";\nimport type { EpochMillis } from \"../model/primitives.js\";\n\n/**\n * One tracked delivery path.\n *\n * The two telemetry signals are separate subsystems because they fail\n * independently — a collector with no logs receiver leaves traces perfectly\n * healthy — and a single combined verdict would make an operator bisect which one\n * is broken. `telemetry-sink` remains the traces signal, unrenamed, so an existing\n * `doctor --json` consumer keeps reading the same field.\n */\nexport type DeliverySubsystem =\n | \"state-store\"\n | \"telemetry-sink\"\n | \"telemetry-log-sink\"\n | \"telemetry-metric-sink\"\n | \"lifecycle\";\n\n/**\n * Sanitized delivery health.\n *\n * Every field is a count, a timestamp, a boolean, or a closed-vocabulary error\n * code — the same restriction the privacy service applies to everything else\n * that might reach a sink, so a health snapshot is itself safe to export or log\n * without a second review.\n */\nexport type DeliveryHealthSnapshot = {\n readonly subsystem: DeliverySubsystem;\n readonly healthy: boolean;\n readonly totalAccepted: number;\n readonly totalRejected: number;\n readonly consecutiveFailures: number;\n readonly lastSuccessAt?: EpochMillis;\n readonly lastFailureAt?: EpochMillis;\n readonly lastErrorCode?: OtelHookErrorCode;\n /**\n * Export destination this snapshot describes. Present only when\n * `exporter.destinations` is in use, so a single-destination snapshot is\n * unchanged.\n */\n readonly destination?: string;\n};\n\nexport type HealthTrackerOptions = {\n /** Consecutive failures at or beyond this count flip `healthy` to false. Default 3. */\n readonly unhealthyAfterConsecutiveFailures?: number;\n /** Labels every snapshot with an export destination name. */\n readonly destination?: string;\n};\n\n/**\n * Accumulates success/failure counts for one subsystem instance.\n *\n * Deliberately per-instance rather than a module-level registry: a store or\n * sink constructs its own tracker and exposes a `health()` accessor, so two\n * instances in one process never share counters (see ADR 0001 on module-level\n * identity).\n */\nexport interface HealthTracker {\n recordSuccess(count?: number, at?: number): void;\n recordFailure(code: OtelHookErrorCode, count?: number, at?: number): void;\n snapshot(): DeliveryHealthSnapshot;\n}\n\nexport const createHealthTracker = (\n subsystem: DeliverySubsystem,\n options: HealthTrackerOptions = {},\n): HealthTracker => {\n const unhealthyThreshold = options.unhealthyAfterConsecutiveFailures ?? 3;\n let totalAccepted = 0;\n let totalRejected = 0;\n let consecutiveFailures = 0;\n let lastSuccessAt: number | undefined;\n let lastFailureAt: number | undefined;\n let lastErrorCode: OtelHookErrorCode | undefined;\n\n return {\n recordSuccess: (count = 1, at?: number): void => {\n totalAccepted += count;\n consecutiveFailures = 0;\n if (at !== undefined) {\n lastSuccessAt = at;\n }\n },\n recordFailure: (code: OtelHookErrorCode, count = 1, at?: number): void => {\n totalRejected += count;\n consecutiveFailures += 1;\n lastErrorCode = code;\n if (at !== undefined) {\n lastFailureAt = at;\n }\n },\n snapshot: (): DeliveryHealthSnapshot => ({\n subsystem,\n healthy: consecutiveFailures < unhealthyThreshold,\n totalAccepted,\n totalRejected,\n consecutiveFailures,\n ...(lastSuccessAt === undefined ? {} : { lastSuccessAt }),\n ...(lastFailureAt === undefined ? {} : { lastFailureAt }),\n ...(lastErrorCode === undefined ? {} : { lastErrorCode }),\n ...(options.destination === undefined ? {} : { destination: options.destination }),\n }),\n };\n};\n\nexport type OverallHealth = {\n readonly healthy: boolean;\n readonly subsystems: readonly DeliveryHealthSnapshot[];\n};\n\n/** Combines snapshots from every configured subsystem into one overall verdict. */\nexport const summarizeHealth = (snapshots: readonly DeliveryHealthSnapshot[]): OverallHealth => ({\n healthy: snapshots.every((snapshot) => snapshot.healthy),\n subsystems: [...snapshots],\n});\n"],"mappings":";AAiEO,IAAM,sBAAsB,CACjC,WACA,UAAgC,CAAC,MACf;AAClB,QAAM,qBAAqB,QAAQ,qCAAqC;AACxE,MAAI,gBAAgB;AACpB,MAAI,gBAAgB;AACpB,MAAI,sBAAsB;AAC1B,MAAI;AACJ,MAAI;AACJ,MAAI;AAEJ,SAAO;AAAA,IACL,eAAe,CAAC,QAAQ,GAAG,OAAsB;AAC/C,uBAAiB;AACjB,4BAAsB;AACtB,UAAI,OAAO,QAAW;AACpB,wBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,eAAe,CAAC,MAAyB,QAAQ,GAAG,OAAsB;AACxE,uBAAiB;AACjB,6BAAuB;AACvB,sBAAgB;AAChB,UAAI,OAAO,QAAW;AACpB,wBAAgB;AAAA,MAClB;AAAA,IACF;AAAA,IACA,UAAU,OAA+B;AAAA,MACvC;AAAA,MACA,SAAS,sBAAsB;AAAA,MAC/B;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAI,kBAAkB,SAAY,CAAC,IAAI,EAAE,cAAc;AAAA,MACvD,GAAI,kBAAkB,SAAY,CAAC,IAAI,EAAE,cAAc;AAAA,MACvD,GAAI,kBAAkB,SAAY,CAAC,IAAI,EAAE,cAAc;AAAA,MACvD,GAAI,QAAQ,gBAAgB,SAAY,CAAC,IAAI,EAAE,aAAa,QAAQ,YAAY;AAAA,IAClF;AAAA,EACF;AACF;AAQO,IAAM,kBAAkB,CAAC,eAAiE;AAAA,EAC/F,SAAS,UAAU,MAAM,CAAC,aAAa,SAAS,OAAO;AAAA,EACvD,YAAY,CAAC,GAAG,SAAS;AAC3B;","names":[]}
|
|
@@ -339,6 +339,7 @@ declare const sessionStartEventSchema: z.ZodObject<{
|
|
|
339
339
|
}, z.core.$strict>>;
|
|
340
340
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
341
341
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
342
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
342
343
|
type: z.ZodLiteral<"session.start">;
|
|
343
344
|
sessionKind: z.ZodEnum<{
|
|
344
345
|
unknown: "unknown";
|
|
@@ -408,6 +409,7 @@ declare const sessionEndEventSchema: z.ZodObject<{
|
|
|
408
409
|
}, z.core.$strict>>;
|
|
409
410
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
410
411
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
412
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
411
413
|
type: z.ZodLiteral<"session.end">;
|
|
412
414
|
reason: z.ZodEnum<{
|
|
413
415
|
error: "error";
|
|
@@ -491,6 +493,7 @@ declare const promptSubmittedEventSchema: z.ZodObject<{
|
|
|
491
493
|
}, z.core.$strict>>;
|
|
492
494
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
493
495
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
496
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
494
497
|
type: z.ZodLiteral<"prompt.submitted">;
|
|
495
498
|
promptSource: z.ZodEnum<{
|
|
496
499
|
unknown: "unknown";
|
|
@@ -587,6 +590,7 @@ declare const generationStartEventSchema: z.ZodObject<{
|
|
|
587
590
|
}, z.core.$strict>>;
|
|
588
591
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
589
592
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
593
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
590
594
|
type: z.ZodLiteral<"generation.start">;
|
|
591
595
|
generationId: z.ZodString;
|
|
592
596
|
model: z.ZodObject<{
|
|
@@ -669,6 +673,7 @@ declare const generationEndEventSchema: z.ZodObject<{
|
|
|
669
673
|
}, z.core.$strict>>;
|
|
670
674
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
671
675
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
676
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
672
677
|
type: z.ZodLiteral<"generation.end">;
|
|
673
678
|
generationId: z.ZodString;
|
|
674
679
|
model: z.ZodObject<{
|
|
@@ -804,6 +809,7 @@ declare const toolStartEventSchema: z.ZodObject<{
|
|
|
804
809
|
}, z.core.$strict>>;
|
|
805
810
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
806
811
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
812
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
807
813
|
type: z.ZodLiteral<"tool.start">;
|
|
808
814
|
toolCallId: z.ZodString;
|
|
809
815
|
toolName: z.ZodString;
|
|
@@ -906,6 +912,7 @@ declare const toolEndEventSchema: z.ZodObject<{
|
|
|
906
912
|
}, z.core.$strict>>;
|
|
907
913
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
908
914
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
915
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
909
916
|
type: z.ZodLiteral<"tool.end">;
|
|
910
917
|
toolCallId: z.ZodString;
|
|
911
918
|
toolName: z.ZodString;
|
|
@@ -1012,6 +1019,7 @@ declare const subagentStartEventSchema: z.ZodObject<{
|
|
|
1012
1019
|
}, z.core.$strict>>;
|
|
1013
1020
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1014
1021
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1022
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1015
1023
|
type: z.ZodLiteral<"subagent.start">;
|
|
1016
1024
|
subagentInvocationId: z.core.$ZodBranded<z.ZodString, "InvocationId", "out">;
|
|
1017
1025
|
subagentType: z.ZodOptional<z.ZodString>;
|
|
@@ -1063,6 +1071,7 @@ declare const subagentEndEventSchema: z.ZodObject<{
|
|
|
1063
1071
|
}, z.core.$strict>>;
|
|
1064
1072
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1065
1073
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1074
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1066
1075
|
type: z.ZodLiteral<"subagent.end">;
|
|
1067
1076
|
subagentInvocationId: z.core.$ZodBranded<z.ZodString, "InvocationId", "out">;
|
|
1068
1077
|
outcome: z.ZodEnum<{
|
|
@@ -1140,6 +1149,7 @@ declare const compactionPerformedEventSchema: z.ZodObject<{
|
|
|
1140
1149
|
}, z.core.$strict>>;
|
|
1141
1150
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1142
1151
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1152
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1143
1153
|
type: z.ZodLiteral<"compaction.performed">;
|
|
1144
1154
|
trigger: z.ZodEnum<{
|
|
1145
1155
|
unknown: "unknown";
|
|
@@ -1215,6 +1225,7 @@ declare const errorRaisedEventSchema: z.ZodObject<{
|
|
|
1215
1225
|
}, z.core.$strict>>;
|
|
1216
1226
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1217
1227
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1228
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1218
1229
|
type: z.ZodLiteral<"error.raised">;
|
|
1219
1230
|
errorCode: z.ZodEnum<{
|
|
1220
1231
|
"invalid-input": "invalid-input";
|
|
@@ -1325,6 +1336,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1325
1336
|
}, z.core.$strict>>;
|
|
1326
1337
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1327
1338
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1339
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1328
1340
|
type: z.ZodLiteral<"session.start">;
|
|
1329
1341
|
sessionKind: z.ZodEnum<{
|
|
1330
1342
|
unknown: "unknown";
|
|
@@ -1393,6 +1405,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1393
1405
|
}, z.core.$strict>>;
|
|
1394
1406
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1395
1407
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1408
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1396
1409
|
type: z.ZodLiteral<"session.end">;
|
|
1397
1410
|
reason: z.ZodEnum<{
|
|
1398
1411
|
error: "error";
|
|
@@ -1475,6 +1488,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1475
1488
|
}, z.core.$strict>>;
|
|
1476
1489
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1477
1490
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1491
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1478
1492
|
type: z.ZodLiteral<"prompt.submitted">;
|
|
1479
1493
|
promptSource: z.ZodEnum<{
|
|
1480
1494
|
unknown: "unknown";
|
|
@@ -1570,6 +1584,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1570
1584
|
}, z.core.$strict>>;
|
|
1571
1585
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1572
1586
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1587
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1573
1588
|
type: z.ZodLiteral<"generation.start">;
|
|
1574
1589
|
generationId: z.ZodString;
|
|
1575
1590
|
model: z.ZodObject<{
|
|
@@ -1651,6 +1666,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1651
1666
|
}, z.core.$strict>>;
|
|
1652
1667
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1653
1668
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1669
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1654
1670
|
type: z.ZodLiteral<"generation.end">;
|
|
1655
1671
|
generationId: z.ZodString;
|
|
1656
1672
|
model: z.ZodObject<{
|
|
@@ -1774,6 +1790,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1774
1790
|
}, z.core.$strict>>;
|
|
1775
1791
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1776
1792
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1793
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1777
1794
|
type: z.ZodLiteral<"tool.start">;
|
|
1778
1795
|
toolCallId: z.ZodString;
|
|
1779
1796
|
toolName: z.ZodString;
|
|
@@ -1875,6 +1892,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1875
1892
|
}, z.core.$strict>>;
|
|
1876
1893
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1877
1894
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
1895
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1878
1896
|
type: z.ZodLiteral<"tool.end">;
|
|
1879
1897
|
toolCallId: z.ZodString;
|
|
1880
1898
|
toolName: z.ZodString;
|
|
@@ -1980,6 +1998,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1980
1998
|
}, z.core.$strict>>;
|
|
1981
1999
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
1982
2000
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
2001
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
1983
2002
|
type: z.ZodLiteral<"subagent.start">;
|
|
1984
2003
|
subagentInvocationId: z.core.$ZodBranded<z.ZodString, "InvocationId", "out">;
|
|
1985
2004
|
subagentType: z.ZodOptional<z.ZodString>;
|
|
@@ -2030,6 +2049,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2030
2049
|
}, z.core.$strict>>;
|
|
2031
2050
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
2032
2051
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
2052
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2033
2053
|
type: z.ZodLiteral<"subagent.end">;
|
|
2034
2054
|
subagentInvocationId: z.core.$ZodBranded<z.ZodString, "InvocationId", "out">;
|
|
2035
2055
|
outcome: z.ZodEnum<{
|
|
@@ -2106,6 +2126,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2106
2126
|
}, z.core.$strict>>;
|
|
2107
2127
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
2108
2128
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
2129
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2109
2130
|
type: z.ZodLiteral<"compaction.performed">;
|
|
2110
2131
|
trigger: z.ZodEnum<{
|
|
2111
2132
|
unknown: "unknown";
|
|
@@ -2180,6 +2201,7 @@ declare const canonicalEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
2180
2201
|
}, z.core.$strict>>;
|
|
2181
2202
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
2182
2203
|
extensions: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>]>>>;
|
|
2204
|
+
contextAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
2183
2205
|
type: z.ZodLiteral<"error.raised">;
|
|
2184
2206
|
errorCode: z.ZodEnum<{
|
|
2185
2207
|
"invalid-input": "invalid-input";
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { E as ExportDestination } from './destinations-
|
|
2
|
-
import { E as ExporterPolicy } from './schema-
|
|
3
|
-
import { C as Clock, d as Logger,
|
|
1
|
+
import { E as ExportDestination } from './destinations-DvqsPulb.js';
|
|
2
|
+
import { E as ExporterPolicy } from './schema-SpFM6YQY.js';
|
|
3
|
+
import { C as Clock, d as Logger, l as TelemetrySink } from './ports-C3k_5eOQ.js';
|
|
4
4
|
import { Attributes } from '@opentelemetry/api';
|
|
5
5
|
import { S as StoreNamespace } from './keys-Dej5bN3L.js';
|
|
6
|
+
import { n as SpanCorrelationResolver, m as SpanCorrelation, k as MetricPoint } from './metric-model-C9lLqqpI.js';
|
|
6
7
|
import { InstrumentationScope } from '@opentelemetry/core';
|
|
7
8
|
import { Resource } from '@opentelemetry/resources';
|
|
8
9
|
import { ReadableLogRecord } from '@opentelemetry/sdk-logs';
|
|
9
10
|
import { b as ContentFact } from './content-M9xIKG7h.js';
|
|
10
|
-
import { b as CanonicalEvent, e as CanonicalEventType } from './events-
|
|
11
|
-
import { b as SpanCorrelationResolver, a as SpanCorrelation } from './semconv-Dw7gcQcg.js';
|
|
11
|
+
import { b as CanonicalEvent, e as CanonicalEventType } from './events-fcomX6d5.js';
|
|
12
12
|
import { DeliveryHealthSnapshot } from './diagnostics.js';
|
|
13
|
+
import { OtelHookErrorInfo } from './errors.js';
|
|
13
14
|
|
|
14
15
|
type SpoolEnqueueResult = {
|
|
15
16
|
readonly spooled: true;
|
|
@@ -73,6 +74,12 @@ type SpoolOverflowPolicy = "refuse-new" | "drop-oldest";
|
|
|
73
74
|
* stopping the drain behind it.
|
|
74
75
|
*/
|
|
75
76
|
type SpoolSendOutcome = boolean | "discard";
|
|
77
|
+
/** Outcome of validating one batch read back from a queue file. */
|
|
78
|
+
type SpoolValidation<TBatch> = {
|
|
79
|
+
readonly batch: TBatch;
|
|
80
|
+
} | {
|
|
81
|
+
readonly rejection: string;
|
|
82
|
+
};
|
|
76
83
|
|
|
77
84
|
type SerializedSpan = {
|
|
78
85
|
readonly name: string;
|
|
@@ -609,6 +616,125 @@ declare const createSignalFanout: (options: SignalFanoutOptions) => SignalFanout
|
|
|
609
616
|
*/
|
|
610
617
|
declare const shareCorrelationPerBatch: (correlate: SpanCorrelationResolver) => SpanCorrelationResolver;
|
|
611
618
|
|
|
619
|
+
/**
|
|
620
|
+
* A batch of metric points a destination could not take, kept for the next
|
|
621
|
+
* invocation.
|
|
622
|
+
*
|
|
623
|
+
* Points are plain JSON (`MetricPoint`), so a batch replays without the process
|
|
624
|
+
* that recorded it. A cumulative point is a snapshot of a running total: replaying
|
|
625
|
+
* an old one after a newer one was delivered restates an earlier value with an
|
|
626
|
+
* earlier timestamp, which a receiver orders by time rather than adding.
|
|
627
|
+
*/
|
|
628
|
+
type MetricSpoolBatch = {
|
|
629
|
+
readonly providerId: string;
|
|
630
|
+
readonly installationId: string;
|
|
631
|
+
readonly resourceAttributes: Attributes;
|
|
632
|
+
readonly instrumentationScope: {
|
|
633
|
+
readonly name: string;
|
|
634
|
+
readonly version?: string;
|
|
635
|
+
};
|
|
636
|
+
readonly points: readonly MetricPoint[];
|
|
637
|
+
readonly enqueuedAt: number;
|
|
638
|
+
};
|
|
639
|
+
declare const validateMetricSpoolBatch: (value: unknown, identity: StoreNamespace) => SpoolValidation<MetricSpoolBatch>;
|
|
640
|
+
interface DurableMetricSpool {
|
|
641
|
+
enqueue(batch: MetricSpoolBatch): Promise<SpoolEnqueueResult>;
|
|
642
|
+
drain(send: (batch: MetricSpoolBatch) => Promise<SpoolSendOutcome>, options?: {
|
|
643
|
+
readonly maxBatches?: number;
|
|
644
|
+
}): Promise<SpoolDrainResult>;
|
|
645
|
+
size(): Promise<number>;
|
|
646
|
+
stats?(): Promise<SpoolStats>;
|
|
647
|
+
}
|
|
648
|
+
type DurableMetricSpoolOptions = StoreNamespace & {
|
|
649
|
+
readonly rootDir: string;
|
|
650
|
+
readonly clock: Clock;
|
|
651
|
+
readonly logger?: Logger;
|
|
652
|
+
readonly maxSpoolFiles?: number;
|
|
653
|
+
/** Queue directory below the identity namespace. Default `spool-metrics`. */
|
|
654
|
+
readonly queueName?: string;
|
|
655
|
+
readonly maxBytes?: number;
|
|
656
|
+
readonly maxAgeMillis?: number;
|
|
657
|
+
readonly overflow?: SpoolOverflowPolicy;
|
|
658
|
+
};
|
|
659
|
+
/** Durable queue for metric batches, in its own directory beside the trace and log spools. */
|
|
660
|
+
declare const createFileDurableMetricSpool: (options: DurableMetricSpoolOptions) => DurableMetricSpool;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* OTLP HTTP/protobuf sink for hook-derived metrics (issue #69).
|
|
664
|
+
*
|
|
665
|
+
* Unlike the trace and log sinks, it does not take canonical events: the points it
|
|
666
|
+
* sends are already aggregated (see `metric-model.ts` and
|
|
667
|
+
* `lifecycle/metric-series.ts`), because cumulative aggregation needs state the
|
|
668
|
+
* telemetry layer must not own. This module only encodes, sends, spools what a
|
|
669
|
+
* destination could not take, and replays the spool on flush.
|
|
670
|
+
*
|
|
671
|
+
* There is deliberately no `MeterProvider` and no periodic reader. A hook process
|
|
672
|
+
* lives for one callback; a reader that collects on an interval would either never
|
|
673
|
+
* fire or hold the process open. Points are exported once, right after the
|
|
674
|
+
* callback's telemetry, inside the same bounded flush window.
|
|
675
|
+
*
|
|
676
|
+
* Fails open like the other sinks: every failure is a diagnostic, never a throw.
|
|
677
|
+
*/
|
|
678
|
+
type MetricsEndpointResolution = {
|
|
679
|
+
readonly endpoint: string;
|
|
680
|
+
readonly derived: boolean;
|
|
681
|
+
} | {
|
|
682
|
+
readonly unresolvable: "no-endpoint";
|
|
683
|
+
};
|
|
684
|
+
/**
|
|
685
|
+
* Where metric points are posted: `metrics.endpoint` as stated, else the traces
|
|
686
|
+
* endpoint with `/v1/traces` swapped for `/v1/metrics` (or `/v1/metrics` appended
|
|
687
|
+
* to a base URL).
|
|
688
|
+
*/
|
|
689
|
+
declare const resolveMetricsEndpoint: (exporter: ExporterPolicy) => MetricsEndpointResolution;
|
|
690
|
+
type MetricsDeliverability = {
|
|
691
|
+
readonly status: "configured";
|
|
692
|
+
readonly endpoint: string;
|
|
693
|
+
readonly derivedEndpoint: boolean;
|
|
694
|
+
} | {
|
|
695
|
+
readonly status: "disabled";
|
|
696
|
+
readonly reason: "metrics-disabled" | "exporter-disabled" | "protocol-none" | "protocol-unsupported" | "no-endpoint";
|
|
697
|
+
};
|
|
698
|
+
declare const describeMetricsDeliverability: (exporter: ExporterPolicy) => MetricsDeliverability;
|
|
699
|
+
type MetricExportResult = {
|
|
700
|
+
/** Points delivered or spooled. */
|
|
701
|
+
readonly accepted: number;
|
|
702
|
+
readonly rejected: number;
|
|
703
|
+
readonly errors: readonly OtelHookErrorInfo[];
|
|
704
|
+
};
|
|
705
|
+
interface OtlpMetricTelemetrySink {
|
|
706
|
+
/** Whether this sink sends anything. A disabled sink accepts nothing and reports nothing. */
|
|
707
|
+
readonly enabled: boolean;
|
|
708
|
+
/**
|
|
709
|
+
* `context`: the session context the points' events agree on (see
|
|
710
|
+
* `agreedContextAttributes`). It overrides the same keys on the Resource for
|
|
711
|
+
* this export, as the trace and log sinks do; the points carry it already.
|
|
712
|
+
*/
|
|
713
|
+
exportPoints(points: readonly MetricPoint[], context?: Readonly<Record<string, string | number | boolean>>): Promise<MetricExportResult>;
|
|
714
|
+
/** Replays spooled batches; bounded, best-effort, never throws. */
|
|
715
|
+
flush(): Promise<void>;
|
|
716
|
+
shutdown(): Promise<void>;
|
|
717
|
+
health(): DeliveryHealthSnapshot;
|
|
718
|
+
drainSpool(maxBatches?: number): Promise<{
|
|
719
|
+
readonly drained: number;
|
|
720
|
+
readonly remaining: number;
|
|
721
|
+
readonly failed: number;
|
|
722
|
+
}>;
|
|
723
|
+
}
|
|
724
|
+
type OtlpMetricSinkOptions = {
|
|
725
|
+
readonly exporter: ExporterPolicy;
|
|
726
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
727
|
+
readonly providerId: string;
|
|
728
|
+
readonly installationId: string;
|
|
729
|
+
readonly clock: Clock;
|
|
730
|
+
readonly logger?: Logger;
|
|
731
|
+
readonly spool?: DurableMetricSpool;
|
|
732
|
+
readonly instrumentationScope?: InstrumentationScope;
|
|
733
|
+
/** Export destination this sink delivers to. */
|
|
734
|
+
readonly destination?: string;
|
|
735
|
+
};
|
|
736
|
+
declare const createOtlpMetricSink: (options: OtlpMetricSinkOptions) => OtlpMetricTelemetrySink;
|
|
737
|
+
|
|
612
738
|
/**
|
|
613
739
|
* Spool queue directories for one destination, below the identity namespace.
|
|
614
740
|
*
|
|
@@ -620,6 +746,7 @@ declare const shareCorrelationPerBatch: (correlate: SpanCorrelationResolver) =>
|
|
|
620
746
|
declare const spoolQueueNamesFor: (destination: string) => {
|
|
621
747
|
readonly traces: string;
|
|
622
748
|
readonly logs: string;
|
|
749
|
+
readonly metrics: string;
|
|
623
750
|
};
|
|
624
751
|
/**
|
|
625
752
|
* The exporter policy one destination's sinks are built from.
|
|
@@ -636,6 +763,9 @@ type ExportDestinationSinks = {
|
|
|
636
763
|
readonly logs: OtlpLogTelemetrySink;
|
|
637
764
|
readonly spool?: DurableSpool;
|
|
638
765
|
readonly logSpool?: DurableLogSpool;
|
|
766
|
+
/** Hook-derived metrics; a disabled sink unless this destination takes `metrics`. */
|
|
767
|
+
readonly metrics: OtlpMetricTelemetrySink;
|
|
768
|
+
readonly metricSpool?: DurableMetricSpool;
|
|
639
769
|
};
|
|
640
770
|
/** A destination left out of this invocation, and why — by name only. */
|
|
641
771
|
type SkippedExportDestination = {
|
|
@@ -702,4 +832,4 @@ declare const createExportDestinationSinks: (options: ExportDestinationsOptions)
|
|
|
702
832
|
*/
|
|
703
833
|
declare const createDestinationFanout: (destinations: readonly ExportDestinationSinks[]) => SignalFanoutSink;
|
|
704
834
|
|
|
705
|
-
export { type
|
|
835
|
+
export { createSignalFanout as $, type SignalFanoutSink as A, type SkippedExportDestination as B, type ContentWithholdingReason as C, type DurableLogSpool as D, type ExportDestinationSinks as E, type SpoolBatch as F, type SpoolDrainResult as G, type SpoolDropCounts as H, type SpoolDropReason as I, type SpoolEnqueueResult as J, type SpoolOverflowPolicy as K, LOG_MAPPING_VERSION as L, MAX_LOG_BODY_CHARACTERS as M, NO_LOG_CONTENT as N, type OtlpLogSinkOptions as O, type SpoolSendOutcome as P, type SpoolStats as Q, canonicalEventsToLogRecords as R, type SerializedLogRecord as S, createDestinationFanout as T, createExportDestinationSinks as U, createFileDurableLogSpool as V, createFileDurableMetricSpool as W, createFileDurableSpool as X, createOtlpLogSink as Y, createOtlpMetricSink as Z, createOtlpTraceSink as _, type DurableLogSpoolOptions as a, describeLogsDeliverability as a0, describeMetricsDeliverability as a1, exporterPolicyForDestination as a2, logSignalOf as a3, logSignalsForLifecycleEvents as a4, resolveLogsEndpoint as a5, resolveMetricsEndpoint as a6, shareCorrelationPerBatch as a7, spoolQueueNamesFor as a8, validateMetricSpoolBatch as a9, type DurableMetricSpool as b, type DurableMetricSpoolOptions as c, type DurableSpool as d, type DurableSpoolOptions as e, type ExportDestinationsOptions as f, LOG_SIGNALS as g, type LogContentPolicy as h, type LogMappingOptions as i, type LogMappingResult as j, type LogSignal as k, type LogSpoolBatch as l, type LogsDeliverability as m, MAX_LOG_RECORDS_PER_BATCH as n, MAX_LOG_RECORDS_PER_EVENT as o, MCP_TOOL_NAME_PATTERN as p, type MetricExportResult as q, type MetricSpoolBatch as r, type MetricsDeliverability as s, type OtlpLogTelemetrySink as t, type OtlpMetricSinkOptions as u, type OtlpMetricTelemetrySink as v, type OtlpTelemetrySink as w, type OtlpTraceSinkOptions as x, type SerializedSpan as y, type SignalFanoutOptions as z };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { O as OtelHookConfig } from './schema-
|
|
2
|
+
import { O as OtelHookConfig } from './schema-SpFM6YQY.js';
|
|
3
3
|
import { OtelHookErrorInfo } from './errors.js';
|
|
4
|
-
import { b as CanonicalEvent, I as UsageTemporality, f as CanonicalUsage } from './events-
|
|
4
|
+
import { b as CanonicalEvent, I as UsageTemporality, f as CanonicalUsage } from './events-fcomX6d5.js';
|
|
5
5
|
import { I as IdentityClaim, W as WorkspaceIdentity, d as InvocationIdentity } from './identity-BrVBs901.js';
|
|
6
6
|
import { h as SourceTransport, R as ResolvedProviderId, c as DetectionConfidence, d as EventId } from './primitives-CJ8-rn-f.js';
|
|
7
7
|
import { P as PrivacyService } from './service-CbI9CObT.js';
|
|
8
|
-
import { b as DeliveryIdentifierSupport, f as ProviderDeliveryClaim, j as ProviderHookResponse } from './adapter-
|
|
9
|
-
import { P as ProviderRegistry } from './registry-
|
|
10
|
-
import { I as IdGenerator,
|
|
8
|
+
import { b as DeliveryIdentifierSupport, f as ProviderDeliveryClaim, j as ProviderHookResponse } from './adapter-DQiPu8xF.js';
|
|
9
|
+
import { P as ProviderRegistry } from './registry-gyJqaWmp.js';
|
|
10
|
+
import { I as IdGenerator, l as TelemetrySink, j as StateStore, C as Clock, d as Logger, W as WorktreeLocator, P as PayloadEnricher, S as SessionContextReader } from './ports-C3k_5eOQ.js';
|
|
11
11
|
import { A as AttributionOutcome, a as AttributionReason } from './taxonomy-DwhTtuWd.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -292,6 +292,12 @@ type OtelHookDependencies = {
|
|
|
292
292
|
* default: nothing reads beyond the payload unless a host asks for it.
|
|
293
293
|
*/
|
|
294
294
|
readonly payloadEnrichers?: readonly PayloadEnricher[];
|
|
295
|
+
/**
|
|
296
|
+
* Reads the session context a harness wrote (`docs/session-context.md`). Absent
|
|
297
|
+
* means none: no event carries `contextAttributes`. The filesystem
|
|
298
|
+
* implementation is `createDirectorySessionContextReader`.
|
|
299
|
+
*/
|
|
300
|
+
readonly sessionContext?: SessionContextReader;
|
|
295
301
|
};
|
|
296
302
|
/**
|
|
297
303
|
* Minimal orchestrator wiring detection, identity, parsing, privacy checks,
|