-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(native): add tracing page to develop docs #13599
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this @JoshuaMoelans. I have only minor improvements that err on completeness. Feel free to ignore the suggestions.
### Tracing with Performance | ||
When any [traces sampling option](https://docs.sentry.io/platforms/native/configuration/sampling/#configuring-the-transaction-sample-rate) is enabled, the SDK can send spans. Just like in TwP, we still use a `propagation_context` to store the relevant data (a `trace_id` and a `span_id`). Now, events and spans can be connected through a common `trace_id` and, if a span is scoped, it will additionally be connected hierarchically to the event through its `span_id`. By default, both spans and events will inherit the `trace_id` from the `propagation_context` as generated during SDK initialization. | ||
|
||
Downstream SDKs are still able to use `sentry_set_trace()`, which updates the `propagation_context` with a new `trace_id`, `span_id` and `parent_span_id`. Root spans (=transactions) will pick up the data currently in the `propagation_context`, which can still be overwritten by `sentry_transaction_context_update_from_header()` before the span is started. Child spans will inherit the trace data from their parent. While a span is scoped, any event will use that span's data. If no spans are scoped, events will just use the `propagation_context` data directly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is both too technical and too imprecise at the same time. I think, since these are the develop docs, we can spend more time on this:
Downstream SDKs are still able to use `sentry_set_trace()`, which updates the `propagation_context` with a new `trace_id`, `span_id` and `parent_span_id`. Root spans (=transactions) will pick up the data currently in the `propagation_context`, which can still be overwritten by `sentry_transaction_context_update_from_header()` before the span is started. Child spans will inherit the trace data from their parent. While a span is scoped, any event will use that span's data. If no spans are scoped, events will just use the `propagation_context` data directly. | |
Independent of whether tracing is used with or without performance, downstream SDKs can use `sentry_set_trace()` to continue their traces in the Native SDK. This function updates the `propagation_context` with a new `trace_id`, `span_id`, and `parent_span_id`. | |
Root spans (=transactions) will inherit the trace context from the `propagation_context` during the transaction context creation, but introduce a new span layer. If users want to override the SDK-established traces with their external traces, this context can be overwritten by `sentry_transaction_context_update_from_header()`. All of this happens before transaction creation or scoping. | |
Child spans will then inherit the trace data from their parent. As long as a span is scoped, any event will use that span's trace context. If no spans are scoped, events will use the `propagation_context` directly. |
The flow of the trace-context (via the `propagation_context`) can be visualized for the following scenarios: | ||
|
||
 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following steps assume transaction creation and transaction context creation as a single step for brevity. As mentioned above, any trace context inheritance happens during transaction context creation. | |
vercel preview
DESCRIBE YOUR PR
Related to getsentry/sentry-native#1200 where we reworked the way the Sentry Native SDK handles tracing.
Todo
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes: