chore: refresh Go toolchain, deps, logs, and benchmarks (go 1.27.1) - #4
daveseddon-runpod wants to merge 1 commit into
Conversation
Salvages the non-trace half of the Go refresh on top of the charset trace-validation contract, so it no longer conflicts with or reverts that validation: - go 1.27.1; enve v1.0.2 -> v1.2.2 (+unit v1.0.0 indirect) - Init refactored to drop the goto; Go docs corrected - ~40% leaner per-line log metadata (~195 bytes/line saved) - benchmarks (BENCHMARKS.md, re-measured on Go 1.27.1) and -race CI in .github/workflows/go.yaml - GO_README rewritten; its inbound-validation note reconciled from the dropped UUID-strict claim to the shipped charset allowlist - README Go-package links repointed to the repo root / GO_README.md The trace package keeps the charset-allowlist validation (X-Trace-ID / X-Request-ID: <=200 bytes, [A-Za-z0-9._-], else regenerate; sources capped at 64 and blanked when invalid); the UUID-strict variant is intentionally dropped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
||
| // Emit the full build metadata exactly once, so the fields no longer stamped | ||
| // on every line remain available in the logs. | ||
| slog.Info("rplog initialized", |
There was a problem hiding this comment.
(Re-raising this from #2, which was closed in favor of the #3 + #4 split. The Init refactor moved here, so the concern carries over.)
Two concerns with moving the VCS fields off every line into this one startup log:
-
This goes through the same leveled
jsonHandlerwhose level isFromTextOr("RUNPOD_LOG_LEVEL", LevelInfo). Any service runningRUNPOD_LOG_LEVEL=WARNorERROR(we already do this for log-volume reasons, e.g. SLS-446/447/448) will never emit this line at all. For that process,vcs_name/vcs_tag/vcs_timethen appear nowhere: not per-line (removed above) and not at startup (filtered). The join-via-vcs_commitstory silently breaks.TestInitdoes not cover a non-defaultRUNPOD_LOG_LEVEL, so this is not caught. Suggest logging this unconditionally (bypass the level filter, or use a level that is never suppressed). -
Dropping
vcs_name/vcs_tag/vcs_time(andsource) from every line is an unconditional, unflagged behavior change toInit's output for every caller. rplog is widely shared. Given the blast radius, worth confirming with an org-widerplog.Init(grep before merge, and/or gating the change rather than flipping the default with no deprecation window. Anything faceting on@vcs_tag/@vcs_timeper event in Datadog would regress.
What
A refresh of the Go implementation: modernize the toolchain and dependencies, trim redundant per-line log metadata, refactor
Init, add benchmarks, and run tests under-race.What changed
1. Toolchain & dependencies
go.mod: go → 1.27.1;envev1.0.2 → v1.2.2;go mod tidy..github/workflows/go.yaml): Go 1.27.1, addedgo vet, tests run with-race, plus a benchmark step. Test bodies modernized to current Go idioms (b.Loop(), range-over-int,WaitGroup.Go,SplitSeq).2.
Initrefactor + doc fixesgoto FILLEDpattern inInit, extractingmetadataFromBuildInfo()(behavior unchanged).GO_README.mdto describe the real API (Init+ standardlog/slog) — it previously documentedLog()/DebugContext/… functions that don't exist — and fixed broken links in both READMEs.3. Leaner per-line logs (opt-in to reuse)
Every record previously carried
vcs_name,vcs_commit,vcs_tag,vcs_timeand a fullsourcefile/line block — ~40% of a representative line, redundant on every record.sourceblock (AddSource:false)vcs_name(always"git"),vcs_tag,vcs_timeInitnow stampsvcs_commitonly per line (it uniquely identifies the build); the other VCS fields are emitted once in a new structured"rplog initialized"startup record and join back viavcs_commit.Optional to adopt — anyone building their own
slog.Handlerkeeps full control, andMetadata.Fields()is unchanged (returns the complete set), so Datadog-style tag exporters keep every field. Neitherrunpod/hostnorrunpod/ai-apiemits the fullvcs_*set per line today, so this aligns the default with what real consumers already do. Full write-up inGO_README.md→ "Downstream usage".4. Benchmarks
BENCHMARKS.md, re-measured on Go 1.27.1).ValidID,ClientMiddlewareRoundTrip) live in feat: add inbound header validation and tests to trace package #3.Verification
go build ./...,go vet ./...clean.go test -race -cover ./...green.go mod tidyclean on Go 1.27.1 (enve.StringOrsurvives the bump).🤖 Generated with Claude Code