Repository navigation
docs(event-batcher): bound analytics requests by serialized size - #133
Closed
posthog[bot] wants to merge 1 commit into
Closed
posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
Adds one event-batcher requirement: an SDK-managed analytics send is split so each request stays within a byte target below the ingestion body limit, in addition to the event-count limit. Splitting preserves order and drops nothing, and an event larger than the target is sent alone rather than dropped locally. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: f33060ac-cc4a-4ef5-9c1d-105b692663ce
Contributor
|
Closing this one. The SDK table doesn't match what ships: posthog-python (5 MiB, |
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.
Why
The
event-batcherspec bounds a batch only by event count, flush interval, and explicit flush. The one place size appears is reactive — "Some SDKs reduce effective batch size after oversized-payload errors (413)". Ingestion refuses a request body over the deployment's limit (10 MiB on PostHog's hosted ingestion, as thelogsspec already records) and refuses the whole request, so an SDK that batches by count alone can build a request it cannot send and lose every event in it.posthog-rs#288 (merged 2026-10-18) split background analytics sends at 5 MiB for exactly this reason, matching what posthog-js capture v1 already does — and neither rule is in the contract.
Changes
Adds one
event-batcherrequirement, Analytics requests are bounded by serialized size:413shrink stays as the backstop.Proposed, applied and archived on this branch as
2026-10-19-bound-analytics-batches-by-size.Verified SDK behavior
partitionEvents)packages/browser-next/src/capture-v1.ts413handling after the factThe
capture-aispec already names an "~5 MiB batch target", but explicitly as a non-normative transport note for the AI lane.Uncertain — worth a human call
SHALL, consistent with the repo stating the winner where SDKs diverge. Confirm that is the intent rather than aSHOULD.How did you test this code?
openspec validate --specs --strictreports the same 33 passed / 31 failed totals as the base branch (all pre-existing "requirement text is very long" warnings; the new requirement raises the same warning as its neighbours).Created with PostHog Desktop
🤖 Generated with Claude Code