-
-
Notifications
You must be signed in to change notification settings - Fork 482
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logs are misleading when transaction is sampled due to parent being sampled #1712
Comments
After digging into this a bit, I think this there's a conflict between 2 tracing requirements or my understanding on them.
I think 2 is probably wrong as @sl0thentr0py Can you help me check if the above is true? |
@sl0thentr0py sorry that I wasn't clear about what "the above" meant. I meant that my 2nd point was incorrect and the condition should be changed. |
yes, 2. is incorrect and the condition should be changed. The transaction should be sent based on the sampling decision in 1. where |
@sl0thentr0py thanks for the confirmation! @rmsy in this case, the logging logic is fine. it's the transaction should not be sent, which I'll fix shortly. if you want to keep the current behavior (send unsampled transaction based on its parent's decision), you need prioritize the inherited sampling decision in your config.traces_sampler = lambda do |sampling_context|
parent_sampled = sampling_context[:parent_sampled]
if !parent_sampled.nil?
parent_sampled
else
# the rest of sampling logic
end
end |
Issue Description
Hello 馃憢
If a transaction has a parent which is sampled, the tracing debug logs are slightly misleading. Due to the precedence of the conditionals below, the
sample_rate
may befalse
or0.0
if a sampler proc is defined and returns one of them:sentry-ruby/sentry-ruby/lib/sentry/transaction.rb
Lines 108 to 115 in 8538717
This results in the following log message being logged, indicating the transaction will be discarded:
sentry-ruby/sentry-ruby/lib/sentry/transaction.rb
Lines 125 to 129 in 8538717
However, if
@parent_sampled
is true for the transaction, it is still sent infinish
:sentry-ruby/sentry-ruby/lib/sentry/transaction.rb
Lines 167 to 173 in 8538717
I assume the first two conditionals in the
sample_rate
assignment can just be reversed, but I wasn't 100% sure if doing that would have any other side-effects, so I opened this issue instead of a PR.Reproduction Steps
traces_sampler
proc which returnsfalse
or0.0
Sentry-Trace
headerExpected Behavior
The log message should not indicate that the transaction will be discarded.
Actual Behavior
The log message indicates that the transaction will be discarded.
Ruby Version
2.7.4
SDK Version
4.8.2
Integration and Its Version
Rails
Sentry Config
No response
The text was updated successfully, but these errors were encountered: