Skip to content

fix(tracing): Don't send a null parent_span_id from sentry_set_trace - #2047

Open
limbonaut wants to merge 3 commits into
masterfrom
fix/omit-parent-spanid
Open

fix(tracing): Don't send a null parent_span_id from sentry_set_trace#2047
limbonaut wants to merge 3 commits into
masterfrom
fix/omit-parent-spanid

Conversation

@limbonaut

Copy link
Copy Markdown
Collaborator

sentry_set_trace wrote parent_span_id unconditionally, so a caller passing no parent got a stored null that serialized to "parent_span_id":null on the wire, and a caller passing an empty string got "parent_span_id":"". Other SDKs leave the key out when there is no parent, and Native already does so elsewhere: sentry_regenerate_trace never sets it, and the transaction path removes it when it is empty-ish. This guards the write so a NULL or zero-length parent omits the key, which is what a downstream SDK needs when it starts a fresh trace.

An absent parent was stored as a null value, which serialized to
"parent_span_id":null on the wire instead of being left out.
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.37%. Comparing base (de1d458) to head (38267a7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2047      +/-   ##
==========================================
- Coverage   74.37%   74.37%   -0.01%     
==========================================
  Files         103      103              
  Lines       26665    26667       +2     
  Branches     4852     4853       +1     
==========================================
+ Hits        19832    19833       +1     
+ Misses       5501     5498       -3     
- Partials     1332     1336       +4     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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