Repository navigation
Conversation
…ties The $trace_id and $span_id taken from the active OpenTelemetry span are values the SDK adds, so they now fill after the call's properties, context tags and super_properties, and before before_send. They fill as a pair: when any layer sets either key, the SDK adds neither. This covers capture, capture_ai and capture_exception on Client and AsyncPosthog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
💡 Motivation and Context
On
v1, the$trace_idand$span_idthat the SDK takes from the active OpenTelemetry span are merged into the call's own properties, so they win over the same keys in context tags andsuper_properties. Across the v1 SDKs, a value the caller sets (on the event, in a context or globally) wins over a value the SDK adds. posthog-node and posthog-go already let caller and context trace IDs win over the active span's, and posthog-rs is moving to the same rule.properties, context tags andsuper_properties, beforebefore_send.$trace_idor$span_id, it adds neither, so an event never pairs one trace's ID with another span.capture,capture_aiandcapture_exceptiononClient, andAsyncPosthog, follow the rule.Client.capture_exceptionstill always adds the span IDs.💚 How did you test it?
capture,capture_aiandcapture_exception: both IDs added when no layer sets them; a call property, a context tag or a super property wins and stops both derived IDs;before_sendsees the derived IDs and can change them. The caller, context and super cases fail without this change.pytest posthog/test(5326 passed),ruff check,ruff format --check,mypyandmake public_api_checkpass locally.📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Authored with Claude Code (Claude Opus 5.5), directed by @eli-r-ph.
🤖 Generated with Claude Code