Repository navigation
fix(sandbox): emit one log line per installed dep, not a 16KB array - #4271
Merged
Merged
Conversation
The single sandbox.install.deps line carried the whole dependencies array, which the log pipeline truncates at 16KB — a 391-dep monorepo's line is cut mid-JSON and becomes unparseable, so VictoriaLogs can't aggregate it (the top-deps panel collapsed to name=""). Emit one small sandbox.dep.installed line per package (name+version+context) so stats by (name) count() works without unrolling a nested array, plus a trailing sandbox.install.deps summary line with the install-level totals.
pedrofrxncx
enabled auto-merge (squash)
July 2, 2026 21:30
pedrofrxncx
disabled auto-merge
July 2, 2026 21:31
decocms Bot
pushed a commit
that referenced
this pull request
Jul 2, 2026
PR: #4271 fix(sandbox): emit one log line per installed dep, not a 16KB array Bump type: patch - @decocms/sandbox (packages/sandbox/package.json): 1.9.0 -> 1.9.1 Deploy-Scope: both
pedrofrxncx
added a commit
that referenced
this pull request
Jul 2, 2026
…#4273) * fix(sandbox): chunk dep-install log lines to survive the log pipeline Third and final format for the dep-install telemetry. Both prior shapes were destroyed by the log pipeline in prod: - one line with the whole dependencies array → truncated at 16KB → unparseable JSON (VictoriaLogs extracts nothing); - one line per dep (#4271) → ~350-line burst per install → the collector's rate sampler drops ~99% (survivors tagged sample_rate=100), leaving 2-4 random transitive deps per install. Emit chunked sandbox.deps lines of ~200 name@version strings (~7KB each, 1-3 lines per install): under the truncation cap AND under the burst sampler. The deps field is a pre-JSON-encoded string so no pipeline stage can flatten the array; VictoriaLogs `unroll (deps)` parses it back into per-dep rows — verified end-to-end against the live datasource with an inserted probe line. * fix(sandbox): chunk dep lines by serialized bytes, not dep count Count-based chunking (200/line) doesn't bound the serialized line size: npm names allow up to 214 chars, so a line could reach ~40KB and hit the same 16KB truncation this format exists to avoid. Pack name@version strings greedily by Buffer.byteLength under a 14KB cap (leaving ~2KB for the JSON envelope). Adds a regression test with 200 long-named deps. * fix(sandbox): budget final line bytes incl. deps-string quote escaping The chunker sized the raw deps array, but deps is stored as a string field so the outer JSON.stringify escapes every element's quotes ("x" -> \"x\", +2 bytes each). Short-dep-heavy lines undercounted by ~2 bytes/dep could cross 16KB and truncate. Budget the FINAL line: measured envelope + per-dep escaped cost, cap 15.5KB. Adds a 4000-short-dep regression test.
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.
Problem
The merged dep-install telemetry (#4269) emitted the whole
dependenciesarray in a singlesandbox.install.depsJSON log line. The log pipeline truncates lines at 16KB, so a large monorepo (e.g. a 391-dep install) gets cut mid-JSON → the line is unparseable → VictoriaLogsunpack_jsonextracts nothing → the top-deps aggregation collapses toname="". Confirmed live:_msglength was exactly 16384 bytes.Fix
Emit one small line per dependency (
sandbox.dep.installedwithname,version, + pm/repo/branch/bootId), each well under the cap, plus a trailingsandbox.install.depssummary line with install-level totals (dependencyCount). Per-line rows are also what let VictoriaLogsstats by (name) count()aggregate directly — no nested-array unroll.Trade-off
More lines per install (one per dep, capped at the existing
MAX_DEPS=10000). Tiny lines, infrequent (per sandbox boot), well within VL capacity — and the correct shape for per-package aggregation, which is the whole point.Testing
bun test daemon/setup/dep-metrics.test.tspasses;bun run fmtclean. Dashboard panel queries updated to the per-dep line format.🤖 Generated with Claude Code
Summary by cubic
Switch dep-install telemetry to emit one log line per installed dependency (
sandbox.dep.installed: name, version, context) plus a small summary line (sandbox.install.deps: dependencyCount). This prevents 16KB log truncation and restores accurate per-package aggregation in VictoriaLogs.Written for commit a46b67e. Summary will update on new commits.