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

Do not return null from startTransaction. #1126

Merged
merged 4 commits into from
Dec 21, 2020

Conversation

maciejwalkowiak
Copy link
Contributor

📜 Description

Changes startTransaction method to never return null.

💡 Motivation and Context

null could have been returned only if hub is closed or if stack contains zero items.

  • when hub is closed, transaction will not be captured anyway since captureTransaction does the check for closed hub anyways
  • it's not technically possible that stack contains zero items

💚 How did you test it?

Tests already cover it.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • All tests passing
  • No breaking changes

🔮 Next steps

Create abstraction over stack to make sure that stack can never be empty.

@maciejwalkowiak
Copy link
Contributor Author

As requested - extracted ITransaction interface and created NoOpTransaction class.

@codecov-io
Copy link

codecov-io commented Dec 21, 2020

Codecov Report

Merging #1126 (a438968) into main (33e5766) will decrease coverage by 0.26%.
The diff coverage is 38.63%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1126      +/-   ##
============================================
- Coverage     75.20%   74.93%   -0.27%     
- Complexity     1599     1606       +7     
============================================
  Files           164      165       +1     
  Lines          5561     5593      +32     
  Branches        546      547       +1     
============================================
+ Hits           4182     4191       +9     
- Misses         1128     1150      +22     
- Partials        251      252       +1     
Impacted Files Coverage Δ Complexity Δ
sentry/src/main/java/io/sentry/Hub.java 74.92% <0.00%> (-0.31%) 70.00 <0.00> (ø)
sentry/src/main/java/io/sentry/HubAdapter.java 8.62% <ø> (ø) 4.00 <0.00> (ø)
sentry/src/main/java/io/sentry/IHub.java 80.00% <ø> (ø) 8.00 <0.00> (ø)
sentry/src/main/java/io/sentry/ISentryClient.java 89.47% <ø> (ø) 10.00 <0.00> (ø)
sentry/src/main/java/io/sentry/NoOpHub.java 58.33% <ø> (ø) 21.00 <0.00> (ø)
...ntry/src/main/java/io/sentry/NoOpSentryClient.java 60.00% <ø> (ø) 6.00 <0.00> (ø)
sentry/src/main/java/io/sentry/Sentry.java 41.86% <ø> (ø) 17.00 <0.00> (ø)
...ry/src/main/java/io/sentry/SentryEnvelopeItem.java 90.09% <ø> (ø) 29.00 <0.00> (ø)
...try/src/main/java/io/sentry/SentryTransaction.java 98.27% <ø> (ø) 26.00 <0.00> (ø)
sentry/src/main/java/io/sentry/Span.java 89.47% <ø> (ø) 11.00 <0.00> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 33e5766...a438968. Read the comment docs.

@maciejwalkowiak
Copy link
Contributor Author

In this case I think we can ignore @codecov-io. I can artificially bump the coverage but I don't see the point.

Copy link
Contributor

@marandaneto marandaneto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maciejwalkowiak maciejwalkowiak merged commit 082b4b5 into main Dec 21, 2020
@maciejwalkowiak maciejwalkowiak deleted the start-transaction-not-null branch December 21, 2020 13:25
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.

4 participants