Reorganize worker observability layer into worker/observability/ (M8 part 3/3)
Collects the five post-run diagnostic + escalation modules into src/main/worker/observability/: run_events persistence, stdout/stderr noise filter, credential-shape log redactor, self-wake circuit breaker, and retry-aware failure escalation pipeline. circuit-breaker.ts and failure-escalation.ts remain as standalone files inside the directory — each owns a distinct state machine that deserves its own boundary — rather than collapsing into a single index.ts. handlers/*.ts and tests/unit/*.test.ts updated to point at the new paths.
This commit is contained in:
1 parent
da3543fcd9
commit
2c6dd8ed08
11 files changed
+10
-10
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
import { createCircuitBreaker } from "../circuit-breaker";
|
import { createCircuitBreaker } from "../observability/circuit-breaker";
|
||||||
import { handleFailureEscalation, handleSuccessReset } from "../failure-escalation";
|
import { handleFailureEscalation, handleSuccessReset } from "../observability/failure-escalation";
|
||||||
import { persistRunEvent } from "../run-event-recorder";
|
import { persistRunEvent } from "../observability/run-event-recorder";
|
||||||
import type { workerMessageSchema } from "../entry/types";
|
import type { workerMessageSchema } from "../entry/types";
|
||||||
import type { HandlerContext, HandlerDeps, WorkerMessageEvent } from "./handler-context";
|
import type { HandlerContext, HandlerDeps, WorkerMessageEvent } from "./handler-context";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { filterRunLogChunk } from "../run-log-filter";
|
import { filterRunLogChunk } from "../observability/run-log-filter";
|
||||||
import { persistRunEvent } from "../run-event-recorder";
|
import { persistRunEvent } from "../observability/run-event-recorder";
|
||||||
import type { HandlerContext, HandlerDeps, WorkerMessageEvent } from "./handler-context";
|
import type { HandlerContext, HandlerDeps, WorkerMessageEvent } from "./handler-context";
|
||||||
|
|
||||||
const LEASE_RENEWAL_INTERVAL_MS = 5 * 60 * 1000; // 5 minutes
|
const LEASE_RENEWAL_INTERVAL_MS = 5 * 60 * 1000; // 5 minutes
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { persistRunEvent } from "../run-event-recorder";
|
import { persistRunEvent } from "../observability/run-event-recorder";
|
||||||
import type { HandlerContext, HandlerDeps, WorkerMessageEvent } from "./handler-context";
|
import type { HandlerContext, HandlerDeps, WorkerMessageEvent } from "./handler-context";
|
||||||
|
|
||||||
export function handleRunStatus(
|
export function handleRunStatus(
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import type { AppDatabase } from "../database";
|
import type { AppDatabase } from "../../database";
|
||||||
|
|
||||||
interface PersistInput {
|
interface PersistInput {
|
||||||
companyId: string;
|
companyId: string;
|
||||||
File renamed without changes.
@@ -3,7 +3,7 @@ import {
|
|||||||
handleFailureEscalation,
|
handleFailureEscalation,
|
||||||
handleSuccessReset,
|
handleSuccessReset,
|
||||||
type EscalationDeps,
|
type EscalationDeps,
|
||||||
} from "@main/worker/failure-escalation";
|
} from "@main/worker/observability/failure-escalation";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the retry-aware failure escalation pipeline.
|
* Tests for the retry-aware failure escalation pipeline.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { redactTokens } from "../../src/main/worker/log-redactor";
|
import { redactTokens } from "../../src/main/worker/observability/log-redactor";
|
||||||
|
|
||||||
/** Verifies the worker process token redactor strips known
|
/** Verifies the worker process token redactor strips known
|
||||||
* credential-shaped substrings from log strings before they leave the
|
* credential-shaped substrings from log strings before they leave the
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { createCircuitBreaker, MAX_CONSECUTIVE_WAKES } from "@main/worker/circuit-breaker";
|
import { createCircuitBreaker, MAX_CONSECUTIVE_WAKES } from "@main/worker/observability/circuit-breaker";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the self-wake circuit breaker used in worker-message-handler.ts.
|
* Tests for the self-wake circuit breaker used in worker-message-handler.ts.
|
||||||
|
|||||||
Reference in new issue
Block a user