Skip to content

docs(traces): evict aged spans only at the live-span bound - #68

Merged
turnipdabeets merged 1 commit into
mainfrom
docs/traces-age-eviction-at-bound
Sep 19, 2026
Merged

turnipdabeets merged 1 commit into
mainfrom
docs/traces-age-eviction-at-bound

Conversation

@turnipdabeets

@turnipdabeets turnipdabeets commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Amends tracesLive span bounds so over-age spans are evicted only when startSpan finds maxLiveSpans reached. Below the bound, a span that runs longer than maxSpanAgeMs and 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.

SDK When over-age spans are evicted
posthog-node on every startSpan (current text); fixed in PostHog/posthog-js#5018
posthog-python only at the count bound (in the unmerged traces stack ending at PostHog/posthog-python#957)

Changes

  • 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; maxSpanAgeMs is described as the leak-recovery threshold; the mobile-background note is narrowed.
  • New scenario: a long span below the bound is exported. The two existing scenarios still hold.
  • Behavior note: leaks below the bound are no longer counted as drops or warned about until the bound is reached.
  • Archived change: 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 changeopenspec validate evict-aged-spans-only-at-live-bound --strictopenspec archive -y, which applied the delta to openspec/specs/traces/spec.md. All four artifacts are complete and every task is checked. openspec validate --specs --strict --no-interactive (the CI job) and git diff --check pass.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@turnipdabeets
turnipdabeets merged commit 2469825 into main Sep 19, 2026
10 checks passed
@turnipdabeets
turnipdabeets deleted the docs/traces-age-eviction-at-bound branch September 19, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants