@velum-labs/routekit-telemetry-core 0.18.0 → 0.18.2

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 ADDED
@@ -0,0 +1,28 @@
1
+ # `@velum-labs/routekit-telemetry-core`
2
+
3
+ Parameterized telemetry consent, redaction, and anonymous event plumbing.
4
+
5
+ This package owns opt-in consent files, environment overrides, `DO_NOT_TRACK`
6
+ handling, category toggles, install identity reset, schema inventory, event
7
+ payload validation, redaction policy, and bounded shutdown helpers. It does not
8
+ send events itself; product hosts provide the destination and transport.
9
+
10
+ ```ts
11
+ import {
12
+ buildTelemetryEvent,
13
+ telemetryStatusMetadata,
14
+ anonymousEventProperties,
15
+ createConsentManager,
16
+ durationBucket
17
+ } from "@velum-labs/routekit-telemetry-core";
18
+ ```
19
+
20
+ Telemetry is off by default unless a host enables it through a persisted
21
+ consent file or explicit environment variable. Disabled telemetry must avoid
22
+ stable identity creation and discard queued events.
23
+
24
+ ## Boundaries
25
+
26
+ - RouteKit daemon telemetry transport lives in `@velum-labs/routekit-daemon`.
27
+ - OpenTelemetry tracing and span export policy live in `@velum-labs/routekit-tracing`.
28
+ - Product telemetry inventory is documented in `../../docs/telemetry-inventory.md`.
package/dist/index.d.ts CHANGED
@@ -65,7 +65,7 @@ declare const BILLING_MODES: readonly ["metered-api", "subscription", "upstream-
65
65
  declare const DIALECTS: readonly ["openai-chat", "openai-responses", "anthropic-messages", "openai-embeddings"];
66
66
  declare const REQUEST_KINDS: readonly ["chat", "responses", "messages", "embeddings"];
67
67
  declare const PREFERENCE_ACTIONS: readonly ["master", "category", "identity-reset"];
68
- declare const DAEMON_ACTIONS: readonly ["started", "stopped", "restarted", "reloaded"];
68
+ declare const DAEMON_ACTIONS: readonly ["started", "stopped", "restarted", "reloaded", "roll_started", "roll_committed", "roll_failed"];
69
69
  export declare const TELEMETRY_EVENT_DEFINITIONS: {
70
70
  readonly "routekit.command_completed": {
71
71
  readonly category: "adoption";
@@ -149,7 +149,7 @@ export declare const TELEMETRY_EVENT_DEFINITIONS: {
149
149
  readonly action: {
150
150
  readonly type: "string";
151
151
  readonly maxLength: 16;
152
- readonly values: readonly ["started", "stopped", "restarted", "reloaded"];
152
+ readonly values: readonly ["started", "stopped", "restarted", "reloaded", "roll_started", "roll_committed", "roll_failed"];
153
153
  };
154
154
  readonly outcome: {
155
155
  readonly type: "string";
@@ -165,6 +165,37 @@ export declare const TELEMETRY_EVENT_DEFINITIONS: {
165
165
  readonly type: "string";
166
166
  readonly maxLength: 32;
167
167
  };
168
+ readonly reason: {
169
+ readonly type: "string";
170
+ readonly maxLength: 16;
171
+ readonly values: readonly ["restart", "upgrade"];
172
+ readonly required: false;
173
+ };
174
+ readonly from_version: {
175
+ readonly type: "string";
176
+ readonly maxLength: 32;
177
+ readonly required: false;
178
+ };
179
+ readonly to_version: {
180
+ readonly type: "string";
181
+ readonly maxLength: 32;
182
+ readonly required: false;
183
+ };
184
+ readonly rollback_stage: {
185
+ readonly type: "string";
186
+ readonly maxLength: 32;
187
+ readonly required: false;
188
+ };
189
+ readonly duration_bucket: {
190
+ readonly type: "string";
191
+ readonly maxLength: 16;
192
+ readonly values: readonly ["<1s", "1-10s", "10-60s", "1-5m", "5-30m", ">30m"];
193
+ readonly required: false;
194
+ };
195
+ readonly forced: {
196
+ readonly type: "boolean";
197
+ readonly required: false;
198
+ };
168
199
  };
169
200
  };
170
201
  readonly "routekit.gateway_usage_summary": {
@@ -329,6 +360,12 @@ export type TelemetryEventProperties = {
329
360
  outcome: (typeof OUTCOMES)[number];
330
361
  supervisor: "systemd" | "launchd" | "detached" | "unknown";
331
362
  version: string;
363
+ reason?: "restart" | "upgrade";
364
+ from_version?: string;
365
+ to_version?: string;
366
+ rollback_stage?: string;
367
+ duration_bucket?: (typeof DURATION_BUCKETS)[number];
368
+ forced?: boolean;
332
369
  };
333
370
  /** Gateway summaries are the only families permitted to carry canonical provider/model identifiers. */
334
371
  "routekit.gateway_usage_summary": {
package/dist/index.js CHANGED
@@ -289,7 +289,15 @@ const DIALECTS = [
289
289
  ];
290
290
  const REQUEST_KINDS = ["chat", "responses", "messages", "embeddings"];
291
291
  const PREFERENCE_ACTIONS = ["master", "category", "identity-reset"];
292
- const DAEMON_ACTIONS = ["started", "stopped", "restarted", "reloaded"];
292
+ const DAEMON_ACTIONS = [
293
+ "started",
294
+ "stopped",
295
+ "restarted",
296
+ "reloaded",
297
+ "roll_started",
298
+ "roll_committed",
299
+ "roll_failed"
300
+ ];
293
301
  export const TELEMETRY_EVENT_DEFINITIONS = {
294
302
  "routekit.command_completed": {
295
303
  category: "adoption",
@@ -325,7 +333,23 @@ export const TELEMETRY_EVENT_DEFINITIONS = {
325
333
  maxLength: 16,
326
334
  values: ["systemd", "launchd", "detached", "unknown"]
327
335
  },
328
- version: { type: "string", maxLength: 32 }
336
+ version: { type: "string", maxLength: 32 },
337
+ reason: {
338
+ type: "string",
339
+ maxLength: 16,
340
+ values: ["restart", "upgrade"],
341
+ required: false
342
+ },
343
+ from_version: { type: "string", maxLength: 32, required: false },
344
+ to_version: { type: "string", maxLength: 32, required: false },
345
+ rollback_stage: { type: "string", maxLength: 32, required: false },
346
+ duration_bucket: {
347
+ type: "string",
348
+ maxLength: 16,
349
+ values: DURATION_BUCKETS,
350
+ required: false
351
+ },
352
+ forced: { type: "boolean", required: false }
329
353
  }
330
354
  },
331
355
  "routekit.gateway_usage_summary": {
@@ -138,7 +138,18 @@ test("schema inventory exposes exact category-truthful event families and fields
138
138
  },
139
139
  "routekit.daemon_lifecycle": {
140
140
  category: "reliability",
141
- fields: ["action", "outcome", "supervisor", "version"]
141
+ fields: [
142
+ "action",
143
+ "outcome",
144
+ "supervisor",
145
+ "version",
146
+ "reason",
147
+ "from_version",
148
+ "to_version",
149
+ "rollback_stage",
150
+ "duration_bucket",
151
+ "forced"
152
+ ]
142
153
  },
143
154
  "routekit.gateway_usage_summary": {
144
155
  category: "usage",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@velum-labs/routekit-telemetry-core",
3
3
  "private": false,
4
- "version": "0.18.0",
4
+ "version": "0.18.2",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/velum-labs/routekit.git",
@@ -26,7 +26,7 @@
26
26
  "provenance": true
27
27
  },
28
28
  "dependencies": {
29
- "@velum-labs/routekit-runtime": "0.18.0"
29
+ "@velum-labs/routekit-runtime": "0.18.2"
30
30
  },
31
31
  "keywords": [
32
32
  "routekit",