-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Propose a new way to continue a trace #14
base: main
Are you sure you want to change the base?
Conversation
6ead2c6
to
48c5fc7
Compare
48c5fc7
to
5f9650b
Compare
text/0014-continue-traces.md
Outdated
use Sentry\Tracing\TransactionContext; | ||
use function Sentry\startTransaction; | ||
|
||
$transactionContext = TransactionContext::continueFromHeaders($sentryTraceHeader, $baggageHeader); |
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.
On Java, it's a bit different but similar https://docs.sentry.io/platforms/android/performance/instrumentation/custom-instrumentation/#distributed-tracing
We've not implemented the continueFromHeaders
method, reason is here.
use Sentry\Tracing\TransactionContext; | ||
use function Sentry\startTransaction; | ||
|
||
$transactionContext = TransactionContext::fromParent($transaction); |
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 would only work if you have access to the transaction
instance, would you do that rather than adding spans to the running transaction?
Usually, continuing trace is used for distributed tracing, such as frontend <-> servers.
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 reason for this RFC was a use-case in getsentry/sentry itself. There are cases where we start transactions inside transactions.
Link to our [internal Slack conversation].(https://sentry.slack.com/archives/C043MQLSLTS/p1663598491050169)
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.
For completeness, these are the patterns of usage that currently break dynamic sampling.
https://github.com/getsentry/sentry/blob/a10312cf1f10af0a79a07b9895565963429dce24/src/sentry/ingest/ingest_consumer.py#L156-L168
# Drawbacks/Impact | ||
|
||
- This will increase the public API surface of our SDKs | ||
- Depending on the option, it's either more complex or more magical. |
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.
I'd opt for exposing the option but giving it a reasonable default so that most people don't have to deal with it.
That said, I'd echo Manoel's question: In what circumstances is starting a new transaction in the same process better than just nesting spans?
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.
See #14 (comment)
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.
Okay, yes, thanks for that. But I'm still not sure if the issue is what this fixes or the fact that maybe we really shouldn't be nesting transactions...
👍🏻 for the general idea. I implemented 👎🏻 on a bool option that looks up the current |
I would ask @beezz, @untitaker etc to also maybe clarify the use case and if this is a workaround for some other problem because it is not entirely clear to many of us why starting a new transaction is necessary instead of just adding spans. |
Regarding preference, I agree with @Swatinem that a new method with explicit semantics is better than another magic bool variable that breaks hub assumptions on the current one. |
A similar issue that would be solved by a solution to continue the trace thru the same process. |
Thanks again for all your input! 🙂 |
Can we revisit this? We ran into this again with monitors where we need to continue a trace (eg: create transaction context) but not yet create a transaction which I believe part of this RFC covers. |
@mitsuhiko After talking with @evanpurkhiser and @davidenwang, it seems like this would be a different ask than the initial goal of this RFC. |
@cleptric we can probably separate these things down but there are two paths we might want to look at:
We can open a new RFC with a clearer set goal but unless we have an initial hunch where we are leaning here we might want to understand this first. # Does this create a transaction or a trace. What are the consequences of either?
sentry_sdk.continue_trace_from_environment() |
This RFC proposes a new way to continue a trace when creating nested transactions.
Rendered RFC
Refs getsentry/develop#690