<?xml version="1.0" encoding="utf-8" standalone="yes"?><?xml-stylesheet href="/feed_style.xsl" type="text/xsl"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="https://www.rssboard.org/media-rss"><channel><title>Langfuse on DazzLog</title><link>https://blog.dazzlog.de/tags/langfuse/</link><description>Recent content in Langfuse on DazzLog</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>dazz - [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/).</copyright><lastBuildDate>Tue, 08 Sep 2026 17:00:00 +0200</lastBuildDate><atom:link href="https://blog.dazzlog.de/tags/langfuse/index.xml" rel="self" type="application/rss+xml"/><icon>https://blog.dazzlog.de/logo.svg</icon><item><title>The Bright Factory Needed Windows</title><link>https://blog.dazzlog.de/posts/2026-09-08_observing-the-bright-factory/</link><pubDate>Tue, 08 Sep 2026 17:00:00 +0200</pubDate><guid>https://blog.dazzlog.de/posts/2026-09-08_observing-the-bright-factory/</guid><description><![CDATA[<div class="details admonition tldr open">
  <div class="details-summary admonition-title">
    <i class="icon ">&#xf259;</i> TL;DR<i class="details-icon fas fa-angle-right fa-fw"></i>
  </div>
  <div class="details-content">
    <div class="admonition-content">Claude Code and Pi both produced logs, but I had no practical view across them. I self-hosted Langfuse to collect their traces in one place. Pi works end to end, while Claude Code works through transcript replay but still needs one live-hook proof. Observability helped, but it also added cost, secrets, and new failure modes.</div>
  </div>
</div>
<p>Claude Code and Pi both kept session logs on my agent server. In theory, I could audit every run. In practice, that meant connecting to the machine, finding two different directories, and reading two different formats.</p>
<p>I had logs in the same way a box of receipts is accounting.</p>
<p>This became a problem when DazzHub reached parts of Stage 7, the “Bright Factory” in Upsun&rsquo;s <a href="https://upsun.com/blog/8-stages-ai-engineering-maturity/">AI engineering maturity model</a>. Agents could take whole issues through implementation and pull requests. Orca could keep several sessions and worktrees running on the shared VM. I could see terminals, but I could not answer simple questions across the fleet:</p>
<ul>
<li>Which agent worked on this issue?</li>
<li>Which tools did it call before it changed the file?</li>
<li>How much did a run cost?</li>
<li>Where did retries happen?</li>
<li>Did a hook fail, or did the model never produce the expected event?</li>
</ul>
<p>Stage 7 can look productive while still depending on a human watching the terminals. I wanted a central record before giving the agents more unattended work.</p>
<h2 id="why-i-chose-langfuse">Why I Chose Langfuse</h2>
<p>Both agents already produce local session data. I did not want to replace their harnesses or route every model call through a new application. Langfuse has integrations that observe the existing sessions:</p>
<ul>
<li>the Claude Code integration processes transcript data from <code>Stop</code> and <code>SessionEnd</code> hooks;</li>
<li>a Pi extension listens to Pi lifecycle events.</li>
</ul>
<p>Each integration can turn model generations and tool calls into traces grouped by session. That gave me one backend without forcing the two agents to behave as one agent.</p>
<p>I chose to self-host it on <code>dazztronic-box</code>. The point of moving the runtime off my laptop was to create shared infrastructure I control. Sending the audit trail to another service by default would have undermined part of that experiment.</p>
<p>Self-hosting Langfuse is not one container. My Compose stack contains:</p>
<ul>
<li>Langfuse web;</li>
<li>Langfuse worker;</li>
<li>PostgreSQL;</li>
<li>ClickHouse;</li>
<li>Redis;</li>
<li>MinIO.</li>
</ul>
<p>That is a substantial observer for one VM with 14 GiB of RAM. Before starting it, the box had 10 GiB available and 31 GiB free on disk. During first-boot migrations, memory use reached 8.5 GiB and swap grew by about 0.2 GiB. After fifteen minutes it settled at 5.8 GiB used with 8.9 GiB available. The images and volumes consumed around 5 GiB of disk.</p>
<div class="details admonition info open">
  <div class="details-summary admonition-title">
    <i class="icon ">&#xf05a;</i> The observer is not free<i class="details-icon fas fa-angle-right fa-fw"></i>
  </div>
  <div class="details-content">
    <div class="admonition-content">Langfuse added six containers and used around 5 GiB of disk. During migrations, memory use reached 8.5 GiB. “Add observability” sounds small until the observer needs its own resource budget.</div>
  </div>
</div>
<p>Those numbers made the decision real. I could no longer treat “add observability” as a checkbox.</p>
<h2 id="keeping-the-observer-separate">Keeping the Observer Separate</h2>
<p>DazzHub already had a Compose stack. Sharing its PostgreSQL would have saved one container, but it would also couple the application and its observer. I wanted to tear down or upgrade Langfuse without touching the project it watches.</p>
<p>I gave Langfuse its own Compose project, own database, and own volumes. Every published port binds to <code>127.0.0.1</code>. The web interface does not become reachable on the LAN because upstream&rsquo;s Compose file happened to publish port 3000.</p>
<p>I also vendored the upstream Compose file and pinned every image. MinIO made that more awkward than expected. The current Chainguard image only publishes <code>latest</code>, so I pinned its digest instead of pretending that a floating tag is a version.</p>
<p>The first boot took about five minutes. ClickHouse migrations ran before the web process answered requests. The socket accepted connections while HTTP calls hung, which looked broken if I checked too early. A second <code>docker compose up</code> was unnecessary; waiting was the fix.</p>
<p>I did not accept “all containers are Up” as verification. I sent one OTLP trace to the real ingestion endpoint and queried ClickHouse to confirm that one row arrived.</p>
<p>That check found the first protocol surprise. Langfuse v4 rejects the old <code>trace-create</code> event shape at <code>/api/public/ingestion</code> with HTTP 207. Trace and span ingestion moved to OTLP. The response looked enough like an authentication problem to waste time, but a bad key returned 401. The credential worked; the event type was obsolete.</p>
<h2 id="claude-code-the-silent-hook">Claude Code: The Silent Hook</h2>
<p>Langfuse provides an official Claude Code marketplace plugin. Installation was simple, and the plugin listed its <code>Stop</code> and <code>SessionEnd</code> hooks. A fresh agent session produced no trace.</p>
<p>It also produced no plugin log and no visible error.</p>
<p>The plugin stores configuration for Claude Code to inject through the operating-system keychain. On this server, Orca launches agent processes with:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>DBUS_SESSION_BUS_ADDRESS=disabled:
</span></span></code></pre></div><p>The GNOME keyring was running, but the agent process could not reach the Secret Service over D-Bus. The hook started without its Langfuse keys and failed open before writing a log. Failing open is sensible for a telemetry hook because tracing must not block coding. It also made the cause invisible.</p>
<div class="details admonition warning open">
  <div class="details-summary admonition-title">
    <i class="icon ">&#xf071;</i> Failing open can fail silently<i class="details-icon fas fa-angle-right fa-fw"></i>
  </div>
  <div class="details-content">
    <div class="admonition-content">The coding session should continue when telemetry breaks. But if the hook leaves no error and no trace, “nothing happened” and “observability is broken” look exactly the same.</div>
  </div>
</div>
<p>I moved the three Langfuse variables into a mode-600 environment file sourced by the runner&rsquo;s shell. Plain environment variables do not need D-Bus. A manual replay of a real transcript from a shell shaped like an Orca agent session processed three turns and increased the ClickHouse row count.</p>
<p>One qualification remains in my notes: I verified the hook script with the real transcript and real shell environment, but I have not yet recorded a fully automatic live <code>Stop</code> event after that fix. The difference is small in commands and important in evidence.</p>
<h2 id="pi-the-integration-that-needed-an-old-protocol">Pi: The Integration That Needed an Old Protocol</h2>
<p>Langfuse does not publish an official Pi extension. I found a community package, then read it before installing it. I checked its dependencies, network calls, file access, CI, and whether the npm package matched the repository. Pi extensions run inside the agent and deserve the same suspicion as any other code with session access.</p>
<p>The extension installed cleanly and immediately hit the Langfuse v4 protocol boundary. It depends on a v3 Langfuse SDK and still sends <code>trace-create</code>, <code>span-create</code>, and related events to the legacy ingestion endpoint. The v4 server rejected them.</p>
<p>Langfuse provides a migration mode that accepts both protocols. I enabled:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>LANGFUSE_MIGRATION_V4_WRITE_MODE=dual
</span></span></code></pre></div><p>After recreating the web and worker containers, a real <code>pi --print</code> turn completed and the trace count went from zero to one in ClickHouse. This is the strongest of my two agent integrations because I verified it from actual model turn to stored trace.</p>
<p>The bridge stays until the Pi integration moves to a v4-native SDK. For me, that is acceptable compatibility debt because it has a name and a clear removal condition.</p>
<h2 id="the-incident-inside-the-observability-work">The Incident Inside the Observability Work</h2>
<p>While diagnosing the shared environment, I printed the real Langfuse public and secret keys into an agent session transcript.</p>
<p>The instance only listens on localhost, and the transcript is visible to an operator who already controls the machine. The immediate impact was low. The irony was excellent: while building a central record of agent activity, I created the exact secret-bearing record I wanted to avoid.</p>
<div class="details admonition danger open">
  <div class="details-summary admonition-title">
    <i class="icon ">&#xfb8a;</i> Tracing also preserves mistakes<i class="details-icon fas fa-angle-right fa-fw"></i>
  </div>
  <div class="details-content">
    <div class="admonition-content">Central tracing gives accidental secrets a longer life and a much better search interface. I now verify that variables are present without printing their values.</div>
  </div>
</div>
<p>I wrote the incident into the machine changelog instead of quietly deleting the evidence. The current setup avoids printing secret values during normal checks. A verification command checks only that the variable lengths are non-zero.</p>
<p>Tracing increases the amount of sensitive context collected. Tool arguments, prompts, file paths, and accidental output now have a longer life and a nicer search interface. Central logging improves auditability and increases the value of the thing an attacker would want. Retention, access, and redaction need to become explicit before this grows beyond my own server.</p>
<h2 id="what-i-can-see-and-what-i-still-cannot">What I Can See, and What I Still Cannot</h2>
<p>The Langfuse stack runs locally and has accepted real traces. Pi is verified end to end. Claude Code&rsquo;s transcript replay works with the environment fix, while the automatic hook path still needs one final proof.</p>
<p>The stack also has an unresolved warning. The Langfuse worker logs recurring Redis socket timeouts even though Redis answers <code>PING</code> and real ingestion succeeds. I left it open rather than converting “did not break my test” into “harmless.” Real multi-agent traffic will show whether it drops jobs or only reports noisy blocking reads.</p>
<p>There is another structural weakness: Langfuse runs under the same <code>dazztronic</code> user and rootless Docker daemon as the agents it observes. An agent can stop its own observer. I accept that for this phase, and I wrote it down so it remains a decision.</p>
<p>Central traces do not make the factory autonomous. They give me evidence to decide which job can run unattended, where it fails, and whether its gate catches the failures I care about. That is less exciting than autonomy, but I need the evidence first.</p>
<p>That is the window I needed in the bright factory. The last post in this series looks at the controls still missing before I am willing to call it Stage 8.</p>
]]></description><media:thumbnail url="https://blog.dazzlog.de/hero.png"/></item></channel></rss>