feat: promptconduit collect — local-first OTLP receiver + dashboard#52
Merged
Conversation
Adds a self-contained agent-tracing dogfood stack:
- OTLP/HTTP+JSON receiver on 127.0.0.1:4318 (/v1/traces, /v1/logs;
/v1/metrics is accepted-and-discarded for now).
- Append-only NDJSON store under ~/.config/promptconduit/collect/
with 50MB rotation. No new go.mod dependencies — stdlib only.
- Embedded read-only HTML dashboard on 127.0.0.1:4319 with a tiny
JSON API (/api/traces, /api/spans) and 2s auto-refresh.
Point Claude Code at it:
export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_EXPORTER_OTLP_PROTOCOL=http/json
export OTEL_EXPORTER_OTLP_ENDPOINT=http://127.0.0.1:4318
This is the public, open-source half of the open-core split — the
collector works without any platform backend. The cloud-side OTLP
receiver lives in promptconduit/platform.
The handler test wrote a SpanRow to NDJSON and read it back. Inside
anyValueToGo we emit int64(412) — but encoding/json renders that as a
bare JSON number, and decoding back into map[string]any (the type of
SpanRow.Attributes) rebuilds it as float64(412). The previous
assertion (int64(412)) was comparing the pre-encode type against the
post-decode value and failing.
Fix:
- Round-trip test now asserts float64(412) (the value as the
dashboard sees it after reading the NDJSON).
- New TestAnyValueToGoTypes calls anyValueToGo directly and pins
down the in-process types (string, bool, int64, float64, bytes)
so a regression that drops the integer typing before encoding
still gets caught.
Verified locally: `go test ./...` passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Scaffolds the open-source half of an agent-tracing stack so we can start dogfooding today without any cloud backend.
promptconduit collectcommand starts an OTLP/HTTP+JSON receiver on127.0.0.1:4318(/v1/traces,/v1/logs;/v1/metricsaccepted-and-discarded).~/.config/promptconduit/collect/with 50MB rotation.127.0.0.1:4319— single HTML/JS file served fromgo:embed, lists traces grouped bytrace_idwith parent/child indentation, 2s auto-refresh, dark mode.This is the public, open-source side of the open-core split. The cloud-side OTLP receiver lives in
promptconduit/platform(companion PR) and accepts the same wire format, so the same agent can ship traces to either endpoint by swappingOTEL_EXPORTER_OTLP_ENDPOINT.Dogfood path
Files
cmd/collect.go— cobra commandcmd/root.go— registercollectCmd, add it to the update-check skip listinternal/collect/server.go— orchestrates OTLP receiver + dashboard + storeinternal/collect/otlp.go— minimal OTLP/HTTP+JSON parser + normalizationinternal/collect/store.go— NDJSON append store, span/log read & trace summariesinternal/collect/dashboard.go—/,/api/traces,/api/spansinternal/collect/ui/index.html— embedded single-file dashboardinternal/collect/otlp_test.go— round-trip + 415 + 405 testsTest plan
make testpasses (3 new tests ininternal/collect)make buildproduces a binary that links cleanly (no new deps)./promptconduit collectstarts both servers, prints addresses, exits cleanly on Ctrl-Ccurland confirm the dashboard shows itContent-Type: application/x-protobufreturns 415 with the documented hint/v1/metricsreturns 200 (accept-and-discard)spans.ndjson.1Out of scope (follow-ups)
promptconduit run <agent>wrapper that auto-sets OTEL env vars.https://claude.ai/code/session_01ECtvFtsTx4QMVWKttzMQW2
Generated by Claude Code