<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Observability on Vedant Andhale</title>
    <link>https://www.vedant.me/tags/observability/</link>
    <description>Recent content in Observability on Vedant Andhale</description>
    <image>
      <url>https://www.vedant.me/</url>
      <link>https://www.vedant.me/</link>
    </image>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 10 Sep 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.vedant.me/tags/observability/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Write logs for the person investigating a failure</title>
      <link>https://www.vedant.me/notebook/logs-nobody-reads/</link>
      <pubDate>Thu, 10 Sep 2026 00:00:00 +0000</pubDate>
      
      <guid>https://www.vedant.me/notebook/logs-nobody-reads/</guid>
      <description>Useful log events identify the operation, outcome and correlation context without copying the whole request.</description>
      <content:encoded><![CDATA[<p><code>Something went wrong</code> is a log message, but it leaves the next person with almost all the original work. Which operation failed? Was it a timeout or a rejected request? Can the event be connected to what the user saw?</p>
<p>A useful event gives the investigation a place to start. For an external API call, that usually means the operation, a correlation identifier, elapsed time, outcome and an error category.</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre tabindex="0" class="chroma"><code><span class="lnt">1
</span><span class="lnt">2
</span><span class="lnt">3
</span><span class="lnt">4
</span><span class="lnt">5
</span><span class="lnt">6
</span><span class="lnt">7
</span><span class="lnt">8
</span><span class="lnt">9
</span></code></pre></td>
<td class="lntd">
<pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">    <span class="n">result</span> <span class="o">=</span> <span class="n">evaluate_shipment</span><span class="p">(</span><span class="n">payload</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="k">except</span> <span class="ne">TimeoutError</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">    <span class="n">logger</span><span class="o">.</span><span class="n">warning</span><span class="p">(</span>
</span></span><span class="line"><span class="cl">        <span class="s2">&#34;shipment evaluation timed out request_id=</span><span class="si">%s</span><span class="s2"> provider=</span><span class="si">%s</span><span class="s2">&#34;</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">        <span class="n">request_id</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">        <span class="n">provider_name</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="p">)</span>
</span></span><span class="line"><span class="cl">    <span class="k">raise</span>
</span></span></code></pre></td></tr></table>
</div>
</div><p>The code is illustrative. In a real service, structured fields are easier to query than values embedded in a sentence, if the logging setup supports them.</p>
<h2 id="give-levels-a-consistent-meaning">Give levels a consistent meaning</h2>
<p>If every successful request produces a warning, a warning stops being useful. Decide which events represent normal operation, recoverable trouble and a failed operation that needs attention. Keep that meaning consistent across the service.</p>
<p>An exception stack is useful where the exception is handled and the context is known. Logging the same exception at every layer can turn one failure into a wall of repeated traces.</p>
<h2 id="leave-out-what-the-investigation-does-not-need">Leave out what the investigation does not need</h2>
<p>Full request bodies are an expensive default. They can include tokens, personal information and long documents. An identifier or a count may answer the debugging question without recording the underlying content.</p>
<p>Similarly, a success event should not claim more than happened. “Request accepted” and “job completed” are different events if a worker performs the job later.</p>
<p>Before adding a log line, imagine the query that would find it. If the line cannot help connect a symptom to an operation, it may belong in a temporary local diagnostic rather than the permanent event stream.</p>
<p>Reference: <a href="https://docs.python.org/3/howto/logging.html">Python logging HOWTO</a>.</p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
