Skip to content

feat: LLM observability via OTLP (Langfuse and any collector) - #27

Merged
xeaser merged 12 commits into
mainfrom
feat/llm-observability-otlp
Aug 27, 2026
Merged

feat: LLM observability via OTLP (Langfuse and any collector)#27
xeaser merged 12 commits into
mainfrom
feat/llm-observability-otlp

Conversation

@xeaser

@xeaser xeaser commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

run and watch --execute now record a parent span plus a gen_ai.chat child (model, tokens, cost, local prompt/completion) to .squad/traces/spans.jsonl. Live OTLP push uses the official Go SDK (http/protobuf default and grpc) only when an endpoint is set. No squad-oc aspire; Aspire stays a valid consumer, not a shipped dashboard.

  • Env wins over optional .squad/config.json otlp.*. Empty endpoint starts no provider (no localhost:4318 default).
  • Capture default off (OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT). JSONL always stores bodies; traces --export never includes them.
  • traces table adds MODEL / TOKENS / COST and a generation-only cost footer.
  • scripts/live-traces.ps1 on D:\xAI\squad-oc-dummy plus scripts/langfuse/ (Langfuse v4, 127.0.0.1). CI stays go test ./....
  • Dummy / live scripts pin stock OpenCode ids (opencode/big-pickle, opencode/hy3-free). This host has no xai / anthropic providers until /connect.

Beads: squad-2on.1 (and children). TUI/SQLite scrape is still squad-t9d.

Test plan

  • gofmt on changed Go files
  • go vet ./...
  • golangci-lint run --timeout=4m
  • go test ./... -count=1
  • go test -race -count=1 on traces / opencodeclient / watch (WinLibs gcc)
  • govulncheck ./...
  • go build ./cmd/squad-oc
  • actionlint
  • scripts/live-traces.ps1 on dummy (JSONL + local Langfuse v4 ingest)
  • CI ci check on this PR

xeaser added 10 commits August 27, 2026 16:04
Add optional squad.OTLPConfig and traces.ResolveSettings with env-wins
precedence. Empty endpoint is unset (no autoexport). Default protocol
http/protobuf; capture defaults false. Unknown protocol errors.
Map OpenCode Prompt Info into RunResult, share traces.Write for JSONL
plus optional push, skip double-record from watch via SkipRecord, and
exit 2 on a bad OTLP protocol before work starts.
File spans.jsonl is default; endpoint env enables live push.
Both http/protobuf and grpc; capture default off. Aspire stays
wont-port consumer. CONTRIBUTING notes live-traces.ps1.
@xeaser xeaser added the enhancement New feature or request label Aug 27, 2026
@xeaser
xeaser merged commit f33b663 into main Aug 27, 2026
10 checks passed
@xeaser
xeaser deleted the feat/llm-observability-otlp branch August 27, 2026 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant