Watchtower
Self-hosted observability and code-quality stack
A coding agent works from source files, docs, and test output. What it usually can’t see is what the code did when it actually ran.
Watchtower gives it that view. The README puts it in one line: build โ test โ observe telemetry โ adjust.
It’s a set of containers on my machine. Any app instrumented with OpenTelemetry points at localhost:4317, and a few seconds later its traces, logs, and metrics are queryable with curl. The same stack runs SonarQube, so code quality sits next to runtime behavior.
Watch and Watchtower
The names are close, and that’s my fault. They’re different projects.
Watch is an application: incident intake and tiered escalation. Watchtower is infrastructure: where Watch’s telemetry lands. Running Watch locally, watch-backend exports all three signals to Watchtower’s Alloy collector and doesn’t run a collector of its own.
Watch also reads from it. Its triage step queries Tempo with TraceQL, and the v0.11 release notes record that path verified live against Watchtower’s Tempo.
What’s in the box
make docker-up starts eight containers:
| Service | Port | Job |
|---|---|---|
| Alloy | 4317 / 4318 | OTLP in, one pipeline per signal out |
| Tempo | 3200 | Traces |
| Loki | 3100 | Logs |
| Prometheus | 9090 | Metrics, via remote-write |
| Grafana | 3000 | Explore and dashboards, datasources pre-provisioned |
| SonarQube + Postgres | 9000 | Static analysis |
| rust-build | 8055 | Sandboxed cargo over HTTP |
The Grafana datasources are cross-linked. Click a trace and you get its logs. Click a trace ID in a log line and you get the trace. Metrics exemplars link back to traces.
The README is written for agents as much as people. Its first section is the OTLP endpoint. Right after that come the curl commands for querying Tempo, Loki, and Prometheus.
Where it came from
In December 2025 I wrote about what Claude Code could do with local observability: a Docker Compose stack of Grafana, Prometheus, Loki, Jaeger, and SonarQube, and the idea that runtime data and quality data should inform what an assistant builds next.
In February I wrote the Watchtower pattern itself. Put Grafana Alloy in front as the collector, dual-write to your existing vendor and to an LGTM stack you control, and point AI workflows at the copy. That version ran on a kind cluster with Helm charts and distributed Mimir. As I put it a few days later, it “started as a work project for learning Kubernetes.”
Five days after the first commit, the Docker Compose path landed, along with SonarQube. It’s been the primary path since. The kind and Helm setup is still in the repo as the learning path, with its gotchas written down.
Decisions worth explaining
I took the dual-write out. The blog post’s whole argument is the fork. But on my machine there’s no production vendor to protect. In April I removed the Grafana Cloud exporter from the Compose config. The commit message: the export “was crash-looping Alloy without creds and isn’t needed โ OTel data stays on-host for local LLM analysis.” The kind path still has a dual-write config and a make enable-local-only switch.
Prometheus, not Mimir, in Compose. The kind path runs mimir-distributed, and the repo documents seven chart settings it took to make that work on a laptop. The Compose path runs plain Prometheus with remote-write enabled. Same query API, one container.
App-specific config stays out of the repo. Alloy loads every *.alloy file in a directory. The committed pipeline.alloy is the generic OTLP pipeline. Scrape targets for my own apps, like Conduct’s API and worker, go in a gitignored local-scrapes.alloy that forwards into the same remote-write. The stack stays reusable and the tree stays clean.
SonarQube and rust-build are local only. The repo has a Terragrunt skeleton for running the stack on AWS: ECS Fargate across two prod regions and a dev region, Loki and Tempo on S3. It excludes SonarQube on purpose. That’s build-quality tooling, not production traffic. The rust-build sandbox, which Conduct uses to compile and test generated Rust in a non-root container, is local-only too. Code generation is a research capability on hardware I own.
That skeleton has never been applied. In February the plan was EKS. What actually runs in AWS is the platform repo’s version: the Terragrunt draft was rewritten into modules there and deployed as Watch’s staging observability slice. Watch’s production telemetry goes to Grafana Cloud, so production never depends on Watchtower.
A bug worth telling
In September I pinned every image to a real version. Four were on floating tags, and the plan was routine patch and minor bumps. Running the bumps, rather than reading them, turned up three problems.
Tempo 2.10 is distroless. No shell, no wget, no curl. The healthcheck called wget, so it could never pass. Grafana and Alloy both waited on Tempo being healthy, so docker compose up would have died and Alloy would never have started. It was the third time a missing binary had broken a healthcheck in this repo. CLAUDE.md now has a table of what each image actually ships, and the rule is to ask the image’s shell before writing a healthcheck.
The new pin test imported PyYAML, which wasn’t installed anywhere. There’s no CI to catch that. It now parses the compose file with the standard library.
The third problem was the real one. A healthy container means a process booted, not that telemetry arrives. So I added make smoke: emit traces, logs, and metrics under a fresh service.name, then poll Tempo, Loki, and Prometheus until all three find them. A unique name per run means a pass can’t be stale data.
Ten days later I found the hole in that. The smoke test queried the backends directly, so it would pass with Grafana completely broken. A fourth stage now re-runs the same queries through Grafana’s datasource proxy. I checked that it fails, too: with a bad password, stage three passes and stage four fails.
Keeping it current
Dependency updates happen by hand with Claude, roughly every two weeks. For a while a scheduled job did them. It was removed on October 24 because it had no docker: it kept committing pins it could never deploy or smoke-test.
The gates:
make testchecks every compose image is pinned to a real version. No floating tags, no daemon needed.make smokeproves telemetry arrives, end to end, through Grafana.make scanruns Trivy over every image, because Dependabot covers lockfiles but not what’s inside a container.
The first scan, on October 27, found 4 critical and 74 high CVEs with fixes available in Loki 2.9. That series hasn’t had a release in about a year. Taking Loki 3 is a major upgrade, so it sits in a backlog of majors waiting for a decision, alongside Tempo 3. SonarQube upgrades get a database dump first, because the migration is one-way.
Releases
Ten tags. v0.1.0 in February marked the Compose stack and SonarQube. v0.3.0 through v0.11.0, July 2 to July 12, follow Watch’s release process: minor versions of Watch, the platform repo, and Watchtower are tagged together as a tested-together statement.
Most of those Watchtower tags carry no code changes. The v0.11 release says so directly, then records what was verified: Tempo answered the triage matrix’s TraceQL queries, and Watch’s accessibility work shipped through Watchtower’s SonarQube gates. The changes since, like the pins, the smoke test, and the CVE scan, aren’t in a tagged release.
What it isn’t
- Not production observability. Watch’s production telemetry goes to a managed vendor. Watchtower is for development, testing, and staging.
- Not a vendor replacement. The original pattern was additive: keep the platform you have, fork a copy to a stack with open APIs.
- Not finished on metrics. OTLP metrics from instrumented apps come through sparse. A counter comparison in April showed about 12 times as many metric points accepted by Alloy as reached Prometheus. Traces and logs come through without losses. The repo still lists it as not root-caused.
What’s next
The metric drop-off is the open bug. The Loki 3 and Tempo 3 upgrades are the open decisions, and Loki has a security reason to go first. The dashboards/ directory is still empty.
The code is MIT-0 licensed. Take whatever’s useful.