@osfactory/otel-hook 0.10.0 → 0.11.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 +82 -3
- package/dist/{adapter-B9RwW6TO.d.ts → adapter-DiLknaTF.d.ts} +1 -1
- package/dist/cli.js +1131 -77
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +11 -4
- package/dist/config.js +100 -18
- package/dist/config.js.map +1 -1
- package/dist/{destinations-DWOkVxV1.d.ts → destinations-BIl3gGzx.d.ts} +12 -2
- package/dist/diagnostics.d.ts +1 -1
- package/dist/diagnostics.js.map +1 -1
- package/dist/{export-destinations-lORbe25J.d.ts → export-destinations-QWKGGEjk.d.ts} +130 -5
- package/dist/{filesystem-store-DX3dGIgu.d.ts → filesystem-store-D3SCNmbX.d.ts} +1 -1
- package/dist/{hook-BAxXoKsp.d.ts → hook-BOecWGSz.d.ts} +4 -4
- package/dist/index.d.ts +14 -14
- package/dist/index.js +1114 -90
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +3 -3
- package/dist/integration.d.ts +29 -11
- package/dist/integration.js +1117 -154
- package/dist/integration.js.map +1 -1
- package/dist/lifecycle.d.ts +54 -3
- package/dist/lifecycle.js +270 -4
- package/dist/lifecycle.js.map +1 -1
- package/dist/{memory-aJilVG4R.d.ts → memory-Cs51jyRk.d.ts} +1 -1
- package/dist/{semconv-Dw7gcQcg.d.ts → metric-model-DDnWxL9d.d.ts} +154 -2
- package/dist/{payload-D7gc0-WQ.d.ts → payload-ChtrEX6A.d.ts} +1 -1
- package/dist/{ports-plO5MKrY.d.ts → ports-CeqLq31i.d.ts} +24 -0
- package/dist/providers.d.ts +8 -8
- package/dist/{registry-C7XO4DzD.d.ts → registry-CcJNF3WY.d.ts} +2 -2
- package/dist/runtime.d.ts +7 -7
- package/dist/runtime.js +55 -9
- package/dist/runtime.js.map +1 -1
- package/dist/{schema-CHb3GU1r.d.ts → schema-DMnoU1V_.d.ts} +64 -1
- package/dist/state.d.ts +3 -3
- package/dist/state.js +23 -0
- package/dist/state.js.map +1 -1
- package/dist/telemetry.d.ts +5 -5
- package/dist/telemetry.js +860 -17
- package/dist/telemetry.js.map +1 -1
- package/dist/testing.d.ts +8 -8
- package/dist/testing.js +55 -9
- package/dist/testing.js.map +1 -1
- package/package.json +3 -1
|
@@ -28,6 +28,33 @@ declare const logsPolicySchema: z.ZodObject<{
|
|
|
28
28
|
}, z.core.$strict>;
|
|
29
29
|
type LogsPolicy = z.infer<typeof logsPolicySchema>;
|
|
30
30
|
declare const DEFAULT_LOGS_POLICY: LogsPolicy;
|
|
31
|
+
/**
|
|
32
|
+
* Policy for hook-derived metrics (issue #69).
|
|
33
|
+
*
|
|
34
|
+
* Off by default, like logs: an upgrade must not start a new stream to a
|
|
35
|
+
* collector nobody sized for it. `enabled` governs the `default` destination
|
|
36
|
+
* (the single-endpoint settings); an `exporter.destinations[]` entry receives
|
|
37
|
+
* metrics when its `signals` list names `metrics`. Metrics carry no content, so
|
|
38
|
+
* listing the signal is the whole opt-in.
|
|
39
|
+
*
|
|
40
|
+
* - `temporality`: `cumulative` (default) exports running totals per series,
|
|
41
|
+
* kept in the state store across hook processes, so a receiver that merges
|
|
42
|
+
* counters by keeping the largest value stays correct. `delta` exports what one
|
|
43
|
+
* callback observed and keeps no state.
|
|
44
|
+
* - `includeSessionId`: put `session.id` on every data point (default true). Turn
|
|
45
|
+
* it off where per-session series are too many for the backend.
|
|
46
|
+
*/
|
|
47
|
+
declare const metricsPolicySchema: z.ZodObject<{
|
|
48
|
+
enabled: z.ZodBoolean;
|
|
49
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
50
|
+
temporality: z.ZodEnum<{
|
|
51
|
+
delta: "delta";
|
|
52
|
+
cumulative: "cumulative";
|
|
53
|
+
}>;
|
|
54
|
+
includeSessionId: z.ZodBoolean;
|
|
55
|
+
}, z.core.$strict>;
|
|
56
|
+
type MetricsPolicy = z.infer<typeof metricsPolicySchema>;
|
|
57
|
+
declare const DEFAULT_METRICS_POLICY: MetricsPolicy;
|
|
31
58
|
/**
|
|
32
59
|
* Runtime exporter policy.
|
|
33
60
|
*
|
|
@@ -57,12 +84,22 @@ declare const exporterPolicySchema: z.ZodObject<{
|
|
|
57
84
|
includeContent: z.ZodBoolean;
|
|
58
85
|
maxBatchSize: z.ZodNumber;
|
|
59
86
|
}, z.core.$strict>;
|
|
87
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
enabled: z.ZodBoolean;
|
|
89
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
90
|
+
temporality: z.ZodEnum<{
|
|
91
|
+
delta: "delta";
|
|
92
|
+
cumulative: "cumulative";
|
|
93
|
+
}>;
|
|
94
|
+
includeSessionId: z.ZodBoolean;
|
|
95
|
+
}, z.core.$strict>>;
|
|
60
96
|
destinations: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
61
97
|
name: z.ZodString;
|
|
62
98
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
63
99
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
64
100
|
tracesEndpoint: z.ZodOptional<z.ZodString>;
|
|
65
101
|
logsEndpoint: z.ZodOptional<z.ZodString>;
|
|
102
|
+
metricsEndpoint: z.ZodOptional<z.ZodString>;
|
|
66
103
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
67
104
|
none: "none";
|
|
68
105
|
"http/protobuf": "http/protobuf";
|
|
@@ -72,6 +109,7 @@ declare const exporterPolicySchema: z.ZodObject<{
|
|
|
72
109
|
signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
73
110
|
traces: "traces";
|
|
74
111
|
logs: "logs";
|
|
112
|
+
metrics: "metrics";
|
|
75
113
|
}>>>>;
|
|
76
114
|
}, z.core.$strict>>>>;
|
|
77
115
|
spool: z.ZodOptional<z.ZodObject<{
|
|
@@ -142,12 +180,22 @@ declare const otelHookConfigSchema: z.ZodObject<{
|
|
|
142
180
|
includeContent: z.ZodBoolean;
|
|
143
181
|
maxBatchSize: z.ZodNumber;
|
|
144
182
|
}, z.core.$strict>;
|
|
183
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
184
|
+
enabled: z.ZodBoolean;
|
|
185
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
186
|
+
temporality: z.ZodEnum<{
|
|
187
|
+
delta: "delta";
|
|
188
|
+
cumulative: "cumulative";
|
|
189
|
+
}>;
|
|
190
|
+
includeSessionId: z.ZodBoolean;
|
|
191
|
+
}, z.core.$strict>>;
|
|
145
192
|
destinations: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodObject<{
|
|
146
193
|
name: z.ZodString;
|
|
147
194
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
148
195
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
149
196
|
tracesEndpoint: z.ZodOptional<z.ZodString>;
|
|
150
197
|
logsEndpoint: z.ZodOptional<z.ZodString>;
|
|
198
|
+
metricsEndpoint: z.ZodOptional<z.ZodString>;
|
|
151
199
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
152
200
|
none: "none";
|
|
153
201
|
"http/protobuf": "http/protobuf";
|
|
@@ -157,6 +205,7 @@ declare const otelHookConfigSchema: z.ZodObject<{
|
|
|
157
205
|
signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
158
206
|
traces: "traces";
|
|
159
207
|
logs: "logs";
|
|
208
|
+
metrics: "metrics";
|
|
160
209
|
}>>>>;
|
|
161
210
|
}, z.core.$strict>>>>;
|
|
162
211
|
spool: z.ZodOptional<z.ZodObject<{
|
|
@@ -237,6 +286,7 @@ declare const otelHookConfigPatchSchema: z.ZodObject<{
|
|
|
237
286
|
endpoint: z.ZodOptional<z.ZodString>;
|
|
238
287
|
tracesEndpoint: z.ZodOptional<z.ZodString>;
|
|
239
288
|
logsEndpoint: z.ZodOptional<z.ZodString>;
|
|
289
|
+
metricsEndpoint: z.ZodOptional<z.ZodString>;
|
|
240
290
|
protocol: z.ZodOptional<z.ZodEnum<{
|
|
241
291
|
none: "none";
|
|
242
292
|
"http/protobuf": "http/protobuf";
|
|
@@ -246,6 +296,7 @@ declare const otelHookConfigPatchSchema: z.ZodObject<{
|
|
|
246
296
|
signals: z.ZodOptional<z.ZodReadonly<z.ZodArray<z.ZodEnum<{
|
|
247
297
|
traces: "traces";
|
|
248
298
|
logs: "logs";
|
|
299
|
+
metrics: "metrics";
|
|
249
300
|
}>>>>;
|
|
250
301
|
}, z.core.$strict>>>>>;
|
|
251
302
|
logs: z.ZodOptional<z.ZodObject<{
|
|
@@ -254,6 +305,15 @@ declare const otelHookConfigPatchSchema: z.ZodObject<{
|
|
|
254
305
|
includeContent: z.ZodOptional<z.ZodBoolean>;
|
|
255
306
|
maxBatchSize: z.ZodOptional<z.ZodNumber>;
|
|
256
307
|
}, z.core.$strict>>;
|
|
308
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
309
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
310
|
+
endpoint: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
311
|
+
temporality: z.ZodOptional<z.ZodEnum<{
|
|
312
|
+
delta: "delta";
|
|
313
|
+
cumulative: "cumulative";
|
|
314
|
+
}>>;
|
|
315
|
+
includeSessionId: z.ZodOptional<z.ZodBoolean>;
|
|
316
|
+
}, z.core.$strict>>;
|
|
257
317
|
spool: z.ZodOptional<z.ZodObject<{
|
|
258
318
|
maxBytes: z.ZodOptional<z.ZodNumber>;
|
|
259
319
|
maxAgeMillis: z.ZodOptional<z.ZodNumber>;
|
|
@@ -316,4 +376,7 @@ declare const DEFAULT_CONFIG: OtelHookConfig;
|
|
|
316
376
|
/** Whether the runtime may read Claude Code transcripts at `Stop` (default false). */
|
|
317
377
|
declare const readsClaudeTranscriptUsage: (config: OtelHookConfig) => boolean;
|
|
318
378
|
|
|
319
|
-
|
|
379
|
+
/** The metrics policy in force, defaults filled in. */
|
|
380
|
+
declare const effectiveMetricsPolicy: (exporter: ExporterPolicy) => MetricsPolicy;
|
|
381
|
+
|
|
382
|
+
export { DEFAULT_CONFIG as D, type ExporterPolicy as E, type LogsPolicy as L, type MetricsPolicy as M, type OtelHookConfig as O, type ProvidersPolicy as P, DEFAULT_DETECTION_POLICY as a, DEFAULT_DIAGNOSTICS_POLICY as b, DEFAULT_EXPORTER_POLICY as c, DEFAULT_LOGS_POLICY as d, DEFAULT_METRICS_POLICY as e, DEFAULT_PROVIDERS_POLICY as f, type DetectionPolicy as g, type DiagnosticsPolicy as h, type OtelHookConfigPatch as i, detectionPolicySchema as j, diagnosticsPolicySchema as k, effectiveMetricsPolicy as l, exporterPolicySchema as m, logsPolicySchema as n, metricsPolicySchema as o, otelHookConfigPatchSchema as p, otelHookConfigSchema as q, providersPolicySchema as r, readsClaudeTranscriptUsage as s };
|
package/dist/state.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { S as StoreNamespace } from './keys-Dej5bN3L.js';
|
|
2
|
-
import { L as LockingStateStore } from './filesystem-store-
|
|
3
|
-
export { F as FilesystemStateStore, a as FilesystemStateStoreOptions, S as StateStoreDependencies, c as createFilesystemStateStore, i as isLockingStateStore, w as withOptionalSessionLock } from './filesystem-store-
|
|
4
|
-
import { C as Clock } from './ports-
|
|
2
|
+
import { L as LockingStateStore } from './filesystem-store-D3SCNmbX.js';
|
|
3
|
+
export { F as FilesystemStateStore, a as FilesystemStateStoreOptions, S as StateStoreDependencies, c as createFilesystemStateStore, i as isLockingStateStore, w as withOptionalSessionLock } from './filesystem-store-D3SCNmbX.js';
|
|
4
|
+
import { C as Clock } from './ports-CeqLq31i.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './errors.js';
|
|
7
7
|
import './primitives-CJ8-rn-f.js';
|
package/dist/state.js
CHANGED
|
@@ -894,6 +894,29 @@ var stateValueSchema = z10.discriminatedUnion("kind", [
|
|
|
894
894
|
* (Claude Code's transcript), so the next read starts where the last ended.
|
|
895
895
|
* `source` is an opaque digest of what was read, never a path.
|
|
896
896
|
*/
|
|
897
|
+
/**
|
|
898
|
+
* Running state of one metric series (issue #69), so a cumulative data point
|
|
899
|
+
* exported by a later hook process continues the same total. Holds numbers and
|
|
900
|
+
* a series digest only; the series' attributes are re-supplied by the caller
|
|
901
|
+
* and never read back from disk.
|
|
902
|
+
*/
|
|
903
|
+
z10.strictObject({
|
|
904
|
+
kind: z10.literal("metric-series"),
|
|
905
|
+
/** Start of the cumulative interval. */
|
|
906
|
+
startTimeMillis: epochMillisSchema,
|
|
907
|
+
/** Counters: the running total. */
|
|
908
|
+
value: z10.number().finite().min(0).optional(),
|
|
909
|
+
/** Histograms: the running aggregation. */
|
|
910
|
+
histogram: z10.strictObject({
|
|
911
|
+
count: z10.number().int().min(0),
|
|
912
|
+
sum: z10.number().finite().min(0),
|
|
913
|
+
min: z10.number().finite(),
|
|
914
|
+
max: z10.number().finite(),
|
|
915
|
+
bucketCounts: z10.array(z10.number().int().min(0)).max(64)
|
|
916
|
+
}).optional(),
|
|
917
|
+
/** Opaque digest of the last delivery folded in; makes a replay a no-op. */
|
|
918
|
+
appliedDelivery: z10.string().regex(/^[A-Za-z0-9_-]{1,128}$/).optional()
|
|
919
|
+
}),
|
|
897
920
|
z10.strictObject({
|
|
898
921
|
kind: z10.literal("read-cursor"),
|
|
899
922
|
source: z10.string().regex(/^[A-Za-z0-9_-]{1,128}$/),
|