-
Notifications
You must be signed in to change notification settings - Fork 335
feat(node): beforeSpanSend hook and per-span limits #4584
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
turnipdabeets
merged 27 commits into
feat/traces-node-mvp
from
feat/traces-before-span-send
Sep 4, 2026
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
86bac7b
feat(node): beforeSpanSend hook and per-span limits
turnipdabeets ab5ccb1
Merge feat/traces-node-mvp into feat/traces-before-span-send
turnipdabeets dad18df
fix(traces): take the propagation fields from the span, not the hook
turnipdabeets 268bb81
refactor(traces): derive the internal span record from the hook-visib…
turnipdabeets 308c686
fix(traces): close four gaps in the per-span attribute bound
turnipdabeets d7959f6
fix(traces): keep a span whose hook froze a rebuilt record
turnipdabeets 7c484b7
fix(traces): report an inert beforeSpanSend entry at critical
turnipdabeets c3c20a5
test(traces): cover the hook shape that actually drops the propagatio…
turnipdabeets d046d2f
fix(traces): keep earliest-set attributes and bound span names
turnipdabeets 3baf6bc
Merge remote-tracking branch 'origin/feat/traces-before-span-send' in…
turnipdabeets e32c6e9
fix(traces): charge every value against the attribute traversal budget
turnipdabeets dff40e9
fix(traces): stop a hook-deleted prototype key from coming back
turnipdabeets cb14919
Merge remote-tracking branch 'origin/feat/traces-before-span-send' in…
turnipdabeets deacd9c
fix(traces): stop nullish leaves spending the truncation budget
turnipdabeets 41179c6
fix(traces): wait for the span export before a flush settles
turnipdabeets 1b11488
docs(traces): tighten the truncation comments and the traces changesets
turnipdabeets 8997a16
fix(traces): recheck consent between span batches
turnipdabeets dac06cc
Merge branch 'feat/traces-node-mvp' into feat/traces-before-span-send
turnipdabeets 39fb861
fix(traces): materialize a toJSON that resolves to nothing
turnipdabeets b4f08b7
fix(traces): take the default for a fractional numeric option
turnipdabeets 28883b0
fix(traces): drop a beforeSpanSend result missing a required field
turnipdabeets da5384f
fix(traces): give a later beforeSpanSend hook the real span identity
turnipdabeets 3f95aeb
test(traces): pin the toJSON bound through buildOtlpSpan
turnipdabeets b8425c8
fix(traces): reserve exception slots by provenance, not event name
turnipdabeets 0bb43aa
fix(traces): make maxEventsPerSpan an absolute cap
turnipdabeets 152cd1c
Merge feat/traces-node-mvp into feat/traces-before-span-send
turnipdabeets 1644346
docs(traces): drop the exception reserve from the span-limits changeset
turnipdabeets File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'posthog-node': minor | ||
| '@posthog/core': minor | ||
| '@posthog/types': minor | ||
| --- | ||
|
|
||
| Add a `traces.beforeSpanSend` hook to edit a finished span before it is queued, or drop it by returning `null` — a hook that throws, or returns anything that is not a span record, also drops the span. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'posthog-node': minor | ||
| '@posthog/core': minor | ||
| '@posthog/types': minor | ||
| --- | ||
|
|
||
| Attach `exception.stacktrace` to the exception events recorded by `recordException` and by a throwing `withSpan` callback — remove it in `traces.beforeSpanSend` to keep your server's file paths out of PostHog. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'posthog-node': minor | ||
| '@posthog/core': minor | ||
| '@posthog/types': minor | ||
| --- | ||
|
|
||
| Cap spans at 128 user attributes, 128 events and 8192 characters per string, configurable with `traces.maxAttributesPerSpan`, `traces.maxEventsPerSpan` and `traces.maxAttributeValueLength`. The earliest entries are kept, and a span that lost any reports how many as `droppedAttributesCount` and `droppedEventsCount`. The event cap is absolute, so an `exception` event the SDK records for you spends an ordinary slot. |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.