Reading an OpenTelemetry span from globalThis returns null
My logger read the active OpenTelemetry span off globalThis. It returned null every single time, and the unit test still passed. Here is the real fix, tested.
6 posts
My logger read the active OpenTelemetry span off globalThis. It returned null every single time, and the unit test still passed. Here is the real fix, tested.
A window error listener ignores every failed image, script and stylesheet. One argument fixes it, then feeds your logger events with no error, no message.
Adding a trace header to every outgoing request shouldn't mean editing forty methods. Hooks and events are the two different tools for two different jobs.
I hand-rolled an OTLP log exporter and tested it. Bare int64 numbers, ms times 1e6 timestamps, wrong severity and base64 trace IDs all still return 200.
Structured logging only pays off if the data field has a stable shape you can query on. Nothing enforces that by default. Here's how to catch drift with schema validation that never drops the log line, using the Standard Schema spec so it works with Zod, Valibot, or nothing at all.
AsyncLocalStorage lets you stamp a request ID onto every log line without passing it through every function. But it can fail without throwing a single error — so your logs just quietly lose the ID. Here are the three cases I reproduced, and the two-minute check that catches them.