Observability & Tracing

the observer effect

There is an honest, slightly uncomfortable truth that runs underneath every tool in this field: the act of measuring a system changes it. Borrowing a phrase from physics, the observer effect names the fact that you cannot observe a running program for free — every probe, counter, log line, and trace you add consumes some time, memory, or cache, and so perturbs the very behaviour you are trying to understand. The system you measure is never exactly the system you would have had if you had not measured it.

Concretely, every instrument carries a cost. A kprobe patches a breakpoint that adds a trap (hundreds of nanoseconds) on every hit. A log line costs the formatting, the write, and the I/O. A trace span adds work and a little memory per request. Even hardware performance counters, cheap as they are, are not literally zero, and turning on too many forces multiplexing that adds estimation error. The danger is not just slowing things down — it is DISTORTION: if your instrumentation is heaviest exactly where the program is hottest, you can make a fast path look slow, change the timing enough to hide or create a race condition, or perturb the cache so the numbers no longer reflect the un-instrumented program. A particularly sharp version: an instrumentation profiler that times every tiny function can spend more time measuring a hot function than the function itself takes, reporting it as expensive purely because you watched it.

It matters because it shapes the entire discipline of production observability and demands intellectual honesty. It is WHY sampling (peek occasionally) is preferred over full instrumentation for whole-program and production work, WHY good probes are engineered to be near-free when inactive (tracepoints, USDT), and WHY you sample logs and traces rather than capturing everything. The professional habits that follow are: keep the overhead small and measure the overhead itself; prefer read-mostly, low-impact tools on a live system to minimise blast radius; and never trust a single signal — corroborate a surprising measurement against another method, because the most dangerous number is one that is wrong in a way that looks plausible. The goal is never zero perturbation, which is impossible; it is perturbation small and well-understood enough that your conclusion still holds.

uninstrumented: fast_path() = 40ns/call with a kprobe: fast_path() = 40ns + ~300ns trap = ~340ns/call (8x!) # the 'expensive' function is mostly the cost of watching it -> distorted conclusion

Instrumenting a tiny hot function can dominate its own measured time, making it look expensive purely because you watched it — the observer effect in numbers.

The name borrows from physics but the systems meaning is concrete and unavoidable: the goal is not zero perturbation (impossible) but perturbation small and understood enough that the conclusion still holds — which is why you measure the overhead and never trust a single surprising signal alone.

Also called
probe overheadmeasurement perturbationprobe effect探針負擔量測擾動