Skip to content
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

Make transaction a required argument of Span #1921

Merged
merged 3 commits into from
Oct 25, 2022
Merged

Make transaction a required argument of Span #1921

merged 3 commits into from
Oct 25, 2022

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented Oct 21, 2022

According to the specification, a Span must has a Transaction, whether it's directly assigned to it or inherited from its parent Span.

So this commit enforces that by requiring the transaction: argument on Span's constructor.

Although it makes test setup a bit more complicated, it does make tests reflect our real-world expectation more accurately.

Although this PR changes the constructor of the Span and Transaction classes, they were never designed to be initialized directly by users. So this is not considered a breaking change

Closes #1890

@st0012 st0012 added this to the 6.0.0 milestone Oct 21, 2022
@st0012 st0012 self-assigned this Oct 21, 2022
According to the specification, a Span must has a Transaction, whether it's
directly assigned to it or inherited from its parent Span.

So this commit enforces that by requiring the `transaction:` argument on
Span's constructor.

Although it makes test setup a bit more complicated, it does make
tests reflect our real-world expectation more accurately.
@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2022

Codecov Report

Base: 98.46% // Head: 98.45% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (78bf9e7) compared to base (3097c49).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1921      +/-   ##
==========================================
- Coverage   98.46%   98.45%   -0.01%     
==========================================
  Files         151      151              
  Lines        9258     9269      +11     
==========================================
+ Hits         9116     9126      +10     
- Misses        142      143       +1     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry/span.rb 100.00% <100.00%> (ø)
sentry-ruby/lib/sentry/transaction.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/client_spec.rb 97.28% <100.00%> (+0.03%) ⬆️
sentry-ruby/spec/sentry/scope/setters_spec.rb 97.52% <100.00%> (+0.15%) ⬆️
sentry-ruby/spec/sentry/scope_spec.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry/span_spec.rb 100.00% <100.00%> (ø)
sentry-ruby/spec/sentry_spec.rb 99.79% <100.00%> (+<0.01%) ⬆️
sentry-ruby/lib/sentry/core_ext/object/deep_dup.rb 94.11% <0.00%> (-5.89%) ⬇️
sentry-ruby/lib/sentry/breadcrumb.rb 96.29% <0.00%> (-3.71%) ⬇️
...y-rails/lib/sentry/rails/controller_transaction.rb 100.00% <0.00%> (ø)
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@st0012 st0012 marked this pull request as ready for review October 22, 2022 10:22
@st0012 st0012 modified the milestones: 6.0.0, 5.6.0 Oct 23, 2022
@st0012 st0012 merged commit 29c444b into master Oct 25, 2022
@st0012 st0012 deleted the refactor-#1890 branch October 25, 2022 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make transaction required in Span constructor
3 participants