Repository navigation
perf(logging): move local trace and provider log writes off the event loop - #19303
Closed
daniyal-sh wants to merge 1 commit into
Closed
daniyal-sh wants to merge 1 commit into
daniyal-sh wants to merge 1 commit into
Conversation
Contributor
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR changes existing production trace and provider-log behavior by introducing asynchronous rotation, bounded trace buffering with possible drops, and new shutdown/retention coordination. It also adds a line-level static-analysis diagnostic suppression, so the runtime and tooling changes warrant human review. You can add or adjust custom eligibility rules. Learn more. |
AdEx-Partners-DE
added a commit
to AdEx-Partners-DE/t3code
that referenced
this pull request
Oct 14, 2026
… loop (adopts upstream pingdotgg#19303) Own diff of pingdotgg#19303 at 6fd1017 against its merge base. logging.test.ts and observability.test.ts: 34 passed before, 37 after; EventNdjsonLogger.test.ts: 19 passed before, 20 after; tsc clean in apps/server and packages/shared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Note Grok responding on behalf of Julius. Superseded by #19430, which combines and finishes this work. Closing in favor of that PR. |
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
Local trace and provider event logging append and rotate files synchronously on the server event loop. Batching still blocks unrelated work while Windows storage is slow. A two-minute Windows CPU capture sampled about 5,049 ms inside the synchronous append/write stack, and the same capture's server log recorded a 2.6-second event-loop warning.
Change
Add a shared asynchronous rotating sink with serialized writes and use it for both local trace and provider event logs. Trace producers enqueue a bounded next batch; excess pressure and failed writes drop trace records with bounded failure/recovery warnings. Provider logging preserves batching, per-thread ordering, attribution, and backpressure. Provider retention reads and removals are asynchronous too. Accepted writes finish before another flush rotates files or shutdown drains the scope.
Both producers require the same sink and shutdown ordering to remove the underlying synchronous local-observability I/O problem. The existing synchronous sink remains available to its other consumers. The internal performance note records the batching/async-I/O trap.
Scope and approval
Submitted as a focused fix for demonstrably blocking local observability I/O: the sink, its trace/provider consumers, their tests, and the relevant internal constraint. No new user-facing feature, telemetry endpoint, SQLite durability default, or logging setting is introduced. The focused obvious-defect exception is requested on that basis; no prior maintainer approval is claimed. This PR does not include reconnect hydration, asset fan-out, credential, Git, or preview-scanning changes.
Verification
vp test run packages/shared/src/logging.test.ts packages/shared/src/observability.test.ts apps/server/src/provider/EventNdjsonLogger.test.ts: 57 passed, 1 existing platform skip. Held-write tests prove unrelated fibers run while disk I/O is pending, the trace backlog stays bounded, and close drains accepted records. Tests also check concurrent append/rotation ordering, reopening, failed-append recovery, provider retention, and partial-write attribution.107f6024, Windows/Node 24.19.0; submission based on8b460a3c.Post-rebase validation on this branch at
8b460a3c(Effect 4.0.4): 57 logging/trace/provider tests passed, one existing platform skip.vp run --filter t3 --filter @t3tools/shared --filter @t3tools/desktop typecheck, changed-file lint/format, and patch whitespace checks passed. Production server/desktop bundles and sandboxed preload verification passed on the original benchmark checkout with these fixes, before upstream's dependency upgrade.Implemented and validated using GPT-6.1 Sol in T3 Code through the Codex harness.