@bli-cockpit/telemetry-core 0.1.100 → 0.1.102

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.
@@ -202,6 +202,13 @@ export declare const CollectorHeartbeatSchema: z.ZodObject<{
202
202
  hook_stop_failed_24h: z.ZodOptional<z.ZodNumber>;
203
203
  hook_session_start_runs_24h: z.ZodOptional<z.ZodNumber>;
204
204
  hook_session_start_failed_24h: z.ZodOptional<z.ZodNumber>;
205
+ hook_prompt_hours_24h: z.ZodOptional<z.ZodArray<z.ZodObject<{
206
+ hour: z.ZodString;
207
+ runs: z.ZodNumber;
208
+ printed: z.ZodNumber;
209
+ timeouts: z.ZodNumber;
210
+ failed: z.ZodNumber;
211
+ }, z.core.$strict>>>;
205
212
  hook_stats_reason: z.ZodOptional<z.ZodString>;
206
213
  hook_performance: z.ZodOptional<z.ZodObject<{
207
214
  schema_version: z.ZodLiteral<"memory-hook-performance.v1">;
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export * from "./ingest-dto.js";
26
26
  export * from "./local-config.js";
27
27
  export * from "./memory-daemon-endpoint.js";
28
28
  export * from "./memory-hook-stats.js";
29
+ export * from "./memory-hook-hours.js";
29
30
  export * from "./sync-revive-contract.js";
30
31
  export * from "./memory-capture-contract.js";
31
32
  export * from "./founder-standing-contract.js";
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ export * from "./ingest-dto.js";
26
26
  export * from "./local-config.js";
27
27
  export * from "./memory-daemon-endpoint.js";
28
28
  export * from "./memory-hook-stats.js";
29
+ export * from "./memory-hook-hours.js";
29
30
  export * from "./sync-revive-contract.js";
30
31
  export * from "./memory-capture-contract.js";
31
32
  export * from "./founder-standing-contract.js";
@@ -187,6 +187,13 @@ export const TOWER_PATTERNS = [
187
187
  note: "one ops reader ran past its time budget and the board shows the rest without it (declared WARNING by the code)",
188
188
  basis: "dashboard 12 h: 15 lines",
189
189
  },
190
+ {
191
+ id: "ops-pipeline-read-reader-timeout",
192
+ class: "hiccup",
193
+ match: raw `^\[ops status\] pipeline read .*reason=reader_timeout`,
194
+ note: "the per-job gauge line for a row whose reader ran past its budget: that row is shown as not judged and the other rows still answer (pipeline-read.ts readerFailure)",
195
+ basis: "dashboard and inference service: 28 lines in 28 days (BLI incident ecc2d6c5), classed unknown before this rule",
196
+ },
190
197
  {
191
198
  id: "dashboard-memory-arm-deadline",
192
199
  class: "hiccup",
@@ -0,0 +1,25 @@
1
+ /**
2
+ * THE PROMPT HOOK, HOUR BY HOUR (ticket 24921).
3
+ *
4
+ * The memory receipt carried only 24-hour totals (`hook_runs_24h`, `hook_timeouts_24h`), and the server keeps only the
5
+ * newest receipt per machine, so "did the timeout rate drop since the database upgrade at 14:15?" could be answered
6
+ * from one laptop's own counter file and from nowhere else. The counter file already keeps hourly buckets; this sends
7
+ * the prompt hook's last 24 of them on the receipt, so the ops board can count from any hour inside that window.
8
+ *
9
+ * Counts and UTC hour labels only, like the file they come from. At most 24 entries; an hour in which the prompt hook
10
+ * never ran is left out rather than sent as zeroes.
11
+ */
12
+ import { z } from "zod";
13
+ import { type MemoryHookStatsFile } from "./memory-hook-stats.js";
14
+ /** Hours the receipt carries: the same 24 the totals cover. */
15
+ export declare const MEMORY_HOOK_HOURS_MAX = 24;
16
+ export declare const MemoryHookHourSchema: z.ZodObject<{
17
+ hour: z.ZodString;
18
+ runs: z.ZodNumber;
19
+ printed: z.ZodNumber;
20
+ timeouts: z.ZodNumber;
21
+ failed: z.ZodNumber;
22
+ }, z.core.$strict>;
23
+ export type MemoryHookHour = z.infer<typeof MemoryHookHourSchema>;
24
+ /** The prompt hook's hours inside the last 24 (the current hour included), oldest first, hours with no run left out. */
25
+ export declare function promptHookHours(file: MemoryHookStatsFile, now: Date): MemoryHookHour[];
@@ -0,0 +1,41 @@
1
+ /**
2
+ * THE PROMPT HOOK, HOUR BY HOUR (ticket 24921).
3
+ *
4
+ * The memory receipt carried only 24-hour totals (`hook_runs_24h`, `hook_timeouts_24h`), and the server keeps only the
5
+ * newest receipt per machine, so "did the timeout rate drop since the database upgrade at 14:15?" could be answered
6
+ * from one laptop's own counter file and from nowhere else. The counter file already keeps hourly buckets; this sends
7
+ * the prompt hook's last 24 of them on the receipt, so the ops board can count from any hour inside that window.
8
+ *
9
+ * Counts and UTC hour labels only, like the file they come from. At most 24 entries; an hour in which the prompt hook
10
+ * never ran is left out rather than sent as zeroes.
11
+ */
12
+ import { z } from "zod";
13
+ import { MEMORY_HOOK_BUCKET_PATTERN, memoryHookHourBucket, } from "./memory-hook-stats.js";
14
+ /** Hours the receipt carries: the same 24 the totals cover. */
15
+ export const MEMORY_HOOK_HOURS_MAX = 24;
16
+ export const MemoryHookHourSchema = z
17
+ .object({
18
+ /** `YYYY-MM-DDTHH`, UTC: the hour the counts belong to. */
19
+ hour: z.string().regex(MEMORY_HOOK_BUCKET_PATTERN),
20
+ runs: z.number().int().min(0),
21
+ printed: z.number().int().min(0),
22
+ timeouts: z.number().int().min(0),
23
+ failed: z.number().int().min(0),
24
+ })
25
+ .strict();
26
+ /** The prompt hook's hours inside the last 24 (the current hour included), oldest first, hours with no run left out. */
27
+ export function promptHookHours(file, now) {
28
+ const earliest = memoryHookHourBucket(new Date(now.getTime() - (MEMORY_HOOK_HOURS_MAX - 1) * 3_600_000));
29
+ const latest = memoryHookHourBucket(now);
30
+ const hours = [];
31
+ for (const [hour, events] of Object.entries(file.buckets)) {
32
+ // The key sorts chronologically as a string, which is why a string comparison may stand in for a date one.
33
+ if (hour < earliest || hour > latest)
34
+ continue;
35
+ const counts = events.prompt;
36
+ if (!counts || counts.runs === 0)
37
+ continue;
38
+ hours.push({ hour, runs: counts.runs, printed: counts.printed, timeouts: counts.timeouts, failed: counts.failed });
39
+ }
40
+ return hours.sort((left, right) => left.hour.localeCompare(right.hour));
41
+ }
@@ -124,6 +124,13 @@ export declare const MemoryInstallReceiptSchema: z.ZodObject<{
124
124
  hook_stop_failed_24h: z.ZodOptional<z.ZodNumber>;
125
125
  hook_session_start_runs_24h: z.ZodOptional<z.ZodNumber>;
126
126
  hook_session_start_failed_24h: z.ZodOptional<z.ZodNumber>;
127
+ hook_prompt_hours_24h: z.ZodOptional<z.ZodArray<z.ZodObject<{
128
+ hour: z.ZodString;
129
+ runs: z.ZodNumber;
130
+ printed: z.ZodNumber;
131
+ timeouts: z.ZodNumber;
132
+ failed: z.ZodNumber;
133
+ }, z.core.$strict>>>;
127
134
  hook_stats_reason: z.ZodOptional<z.ZodString>;
128
135
  hook_performance: z.ZodOptional<z.ZodObject<{
129
136
  schema_version: z.ZodLiteral<"memory-hook-performance.v1">;
@@ -33,6 +33,7 @@
33
33
  */
34
34
  import { z } from "zod";
35
35
  import { IsoDateTimeSchema } from "./common.js";
36
+ import { MEMORY_HOOK_HOURS_MAX, MemoryHookHourSchema } from "./memory-hook-hours.js";
36
37
  import { MemoryHookPerformanceSchema } from "./memory-hook-performance.js";
37
38
  export const MEMORY_INSTALL_RECEIPT_SCHEMA_VERSION = "memory-install-receipt.v1";
38
39
  /**
@@ -204,6 +205,12 @@ export const MemoryInstallReceiptSchema = z
204
205
  hook_stop_failed_24h: z.number().int().min(0).optional(),
205
206
  hook_session_start_runs_24h: z.number().int().min(0).optional(),
206
207
  hook_session_start_failed_24h: z.number().int().min(0).optional(),
208
+ /**
209
+ * The prompt hook's last 24 hours, one entry per hour it ran (ticket 24921), so the ops board can count from a
210
+ * given hour (`cockpit ops status --memory --since`). Absent on a collector older than the field, which reads as
211
+ * "no hourly data", never as an idle machine.
212
+ */
213
+ hook_prompt_hours_24h: z.array(MemoryHookHourSchema).max(MEMORY_HOOK_HOURS_MAX).optional(),
207
214
  /** Named when the counts are absent because the file could not be read. */
208
215
  hook_stats_reason: ReasonLabelSchema.optional(),
209
216
  /** Observed ordinary invocations, not legacy floors or a full host trace. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bli-cockpit/telemetry-core",
3
- "version": "0.1.100",
3
+ "version": "0.1.102",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",