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

Fix: Discard unfinished Spans before sending them over to Sentry #1279

Merged
merged 6 commits into from
Feb 22, 2021

Conversation

maciejwalkowiak
Copy link
Contributor

📜 Description

Discard unfinished Spans before sending them over to Sentry

💡 Motivation and Context

Fixes #1262

💚 How did you test it?

Unit tests.

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

@maciejwalkowiak
Copy link
Contributor Author

A question from #1262 (comment) must be answered before we can merge it

@codecov-io
Copy link

Codecov Report

Merging #1279 (04c874d) into main (1e7be93) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1279      +/-   ##
============================================
+ Coverage     75.04%   75.06%   +0.02%     
- Complexity     1752     1754       +2     
============================================
  Files           183      183              
  Lines          6159     6165       +6     
  Branches        610      612       +2     
============================================
+ Hits           4622     4628       +6     
  Misses         1258     1258              
  Partials        279      279              
Impacted Files Coverage Δ Complexity Δ
sentry/src/main/java/io/sentry/SentryClient.java 88.57% <100.00%> (+0.25%) 78.00 <0.00> (+2.00)

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 1e7be93...04c874d. Read the comment docs.

unfinishedSpans.add(span);
}
}
transaction.getSpans().removeAll(unfinishedSpans);
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to log out. Maybe check if logging is enabled to warn level, if yes we log count of dropped span and the operations?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd log it too

@marandaneto
Copy link
Contributor

A question from #1262 (comment) must be answered before we can merge it

the answer is here: getsentry/develop#274 (comment)
let's do like python for now.

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.

I'd log unfinished spans and missing changelog, other than that, LGTM

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

👍

unfinishedSpans.add(span);
}
}
if (options.getLogger().isEnabled(SentryLevel.WARNING) && !unfinishedSpans.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (options.getLogger().isEnabled(SentryLevel.WARNING) && !unfinishedSpans.isEmpty()) {
if (!unfinishedSpans.isEmpty()) {

Copy link
Contributor

Choose a reason for hiding this comment

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

options.getLogger().log already checks if its enabled internally, !unfinishedSpans.isEmpty() isn't a heavy call I believe, it'd be fine logging directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

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.

Discard unfinished Spans before sending them over to Sentry
4 participants