docs(traces): evict aged spans only at the live-span bound - #68
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
dustinbyrne
approved these changes
Sep 18, 2026
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
Amends
traces›Live span boundsso over-age spans are evicted only whenstartSpanfindsmaxLiveSpansreached. Below the bound, a span that runs longer thanmaxSpanAgeMsand then ends is exported.Why. The requirement's own reason for age eviction is leak recovery at the count bound. Evicting below the bound doesn't serve that, and it drops real long spans (batch jobs, migrations): their already-exported children arrive as orphans. The loss was reproduced in a review of PostHog/posthog-python#953.
Where the two implementations stand.
posthog-nodestartSpan(current text); fixed in PostHog/posthog-js#5018posthog-pythonChanges
Live span bounds: sweep at the bound, then return a no-op handle if, and only if, the bound is still reached; age eviction is forbidden at any other time;maxSpanAgeMsis described as the leak-recovery threshold; the mobile-background note is narrowed.a long span below the bound is exported. The two existing scenarios still hold.openspec/changes/archive/2026-09-18-evict-aged-spans-only-at-live-bound/.Created, validated and archived with
@fission-ai/openspec@1.4.1(the version CI pins):openspec new change→openspec validate evict-aged-spans-only-at-live-bound --strict→openspec archive -y, which applied the delta toopenspec/specs/traces/spec.md. All four artifacts are complete and every task is checked.openspec validate --specs --strict --no-interactive(the CI job) andgit diff --checkpass.🤖 Generated with Claude Code