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(tracing): Make Span.Finish a no-op when the span is already finished #660

Merged
merged 4 commits into from Jul 5, 2023

Conversation

tonyo
Copy link
Member

@tonyo tonyo commented Jul 4, 2023

Span.Finish() should only be executed once, all the further executions should be no-ops. This should also prevent potential data races when Finish() is (erroneously) called concurrently.

Closes #587

@tonyo tonyo requested a review from cleptric July 4, 2023 14:37
@tonyo tonyo self-assigned this Jul 4, 2023
@codecov
Copy link

codecov bot commented Jul 4, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (1b2ac13) 80.61% compared to head (668b4ff) 80.60%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #660      +/-   ##
==========================================
- Coverage   80.61%   80.60%   -0.01%     
==========================================
  Files          43       43              
  Lines        4338     4337       -1     
==========================================
- Hits         3497     3496       -1     
  Misses        714      714              
  Partials      127      127              
Impacted Files Coverage Δ
tracing.go 86.13% <100.00%> (-0.03%) ⬇️

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

tracing.go Outdated
// (incorrectly) calling it twice never double sends to Sentry.

// doFinish runs the actual Span.Finish() logic.
func (s *Span) doFinish() {
Copy link
Member

Choose a reason for hiding this comment

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

For readability, can you move this below Finish()?

@tonyo tonyo merged commit 6db2fc7 into master Jul 5, 2023
14 checks passed
@tonyo tonyo deleted the tonyo/feat-span-finish-only-once branch July 5, 2023 12:34
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.

span.Finish() should be a noop when span is already finished
2 participants