Urgent.News

What's breaking now, across thousands of outlets.

Tech

Why Your Telemetry Code Fails During Live Production Incidents

Most telemetry code gets written when you're calm, happy, and have zero idea how your system is actually going to fail. The result is predictable. A production incident hits at three in the morning, and your logs tell you everything you already know while hiding what you actually need. They show that a connection was attempted, but they completely omit the internal queue state that caused the…

Most telemetry code is crafted while developers are relaxed and unaware of potential system failures. Consequently, production incidents often reveal logs that are familiar rather than revealing. They confirm that a connection attempt occurred, but they neglect the internal queue state that led to a deadlock. Logging is treated as a record-keeping task.

Information statements are inserted into catch blocks solely to meet linter requirements for documentation. When an incident occurs, engineers spend hours searching through unstructured text to reconstruct the distributed state machine from dispersed print statements. Effective telemetry requires a shift in mindset. The code should not serve as diary entries for human readers.

Instead, it should emit state vectors that an observability system can query relative to actual reality. During an error, the log entry must contain the exact conditions that triggered the problematic branch. It must also include the invariants that were violated. Most backend services handle errors using a standard try-catch block.

The code attempts to process the payload, and if an exception occurs, it logs the error message using the stack trace and re-raises the exception. This approach is ineffective under heavy load. It captures only the exception message, which is already available from the stack trace, while disregarding the payload's shape, size, and specific field values that caused the parser to fail.

A more defensive approach involves capturing structural metadata instead of raw error strings. By using a library like kluvex.telemetry, developers can log event types, payload keys, payload size in bytes, schema version, and validation errors. This approach allows log aggregators to query patterns based on actual data. For instance, engineers can determine how many failures are associated with a specific schema version or whether payload size correlates with timeout rates.

As AI agents become involved in incident triage, the quality of telemetry directly impacts the intelligence of automated remediation loops. An LLM cannot debug a system if logs contain generic error messages and stack traces lacking local state. To enable automated agents to fix production issues, telemetry must function as a precise, structured API for system failures.

Developers should stop writing logs for personal use. Instead, they should focus on creating logs that serve as a structured API for automated debuggers.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Reranking Models: The Cheapest RAG Quality Upgrade

Last year I took over a support chatbot for a client with about 40,000 help center and internal wiki chunks in a vector database. Retrieval was pure dense vector search.

  • Reranking improves RAG accuracy from 61% to 84% for $40/month
  • Bi-encoders excel at recall, not precision, causing wrong chunk ranking
  • Hybrid retrieval with BM25 and dense vectors handles exact string matches better

More from Tuesday 27 October →