Used to verify the otel-cf-workers + Effect wiring end-to-end. No longer needed now that spans are confirmed landing in Axiom.
Unified · Split
| @@ -1,9 +1,7 @@ | ||
| 1 | 1 | import { env } from "cloudflare:workers"; |
| 2 | 2 | import { createMiddleware, createStart } from "@tanstack/react-start"; |
| 3 | −import { Effect } from "effect"; | |
| 4 | 3 | import { handleApiRequest } from "./api"; |
| 5 | 4 | import { handleMcpRequest } from "./mcp"; |
| 6 | −import { TelemetryLive } from "./services/telemetry"; | |
| 7 | 5 | |
| 8 | 6 | // --------------------------------------------------------------------------- |
| 9 | 7 | // Marketing routes — proxied to the marketing worker via service binding |
| @@ -107,25 +105,6 @@ const sentryTunnelMiddleware = createMiddleware({ type: "request" }).server( · 97 unmodified lines | ||
| 107 | 105 | }, |
| 108 | 106 | ); |
| 109 | 107 | |
| 110 | −// --------------------------------------------------------------------------- | |
| 111 | −// Debug middleware — /api/debug/boom triggers an Effect span + throw so we | |
| 112 | −// can verify traces hit Axiom and errors hit Sentry. Safe to leave in prod | |
| 113 | −// since it's gated on an exact path match and only ever fails. | |
| 114 | −// --------------------------------------------------------------------------- | |
| 115 | − | |
| 116 | −const debugBoomMiddleware = createMiddleware({ type: "request" }).server( | |
| 117 | − async ({ pathname, next }) => { | |
| 118 | − if (pathname !== "/api/debug/boom") return next(); | |
| 119 | − const program = Effect.gen(function* () { | |
| 120 | − yield* Effect.logInfo("debug boom: about to throw"); | |
| 121 | − yield* Effect.sync(() => { | |
| 122 | − throw new Error("debug boom: telemetry smoke test"); | |
| 123 | − }); | |
| 124 | − }).pipe(Effect.withSpan("debug.boom"), Effect.provide(TelemetryLive)); | |
| 125 | − return Effect.runPromise(program) as unknown as Response; | |
| 126 | − }, | |
| 127 | −); | |
| 128 | − | |
| 129 | 108 | // --------------------------------------------------------------------------- |
| 130 | 109 | // API middleware — routes /api/* to the Effect HTTP layer |
| 131 | 110 | // --------------------------------------------------------------------------- |
| @@ -146,7 +125,6 @@ export const startInstance = createStart(() => ({ · 14 unmodified lines | ||
| 146 | 125 | marketingMiddleware, |
| 147 | 126 | mcpRequestMiddleware, |
| 148 | 127 | sentryTunnelMiddleware, |
| 149 | − debugBoomMiddleware, | |
| 150 | 128 | apiRequestMiddleware, |
| 151 | 129 | ], |
| 152 | 130 | })); |