Skip to content

Conversation

cleptric
Copy link
Member

This partially reverts #886 and fixes #1009.

Pushing a new scope on each new span has too many side effects, like making it impossible to access the "root" scope to attach certain attributes like the user to it.
Instead, we now only set the span on the scope when it's started and set it back to its parent when it finishes.
As it's a hard requirement to always clone the hub when working with go routines, we now have a simulated isolation scope.

Parent child relations are correctly maintained with this changes, as well as error -> span correlation.

@cleptric cleptric self-assigned this May 12, 2025
@cleptric cleptric added the Bug Issue type label May 12, 2025
@cleptric cleptric requested a review from giortzisg May 12, 2025 10:22
Copy link

codecov bot commented May 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.08%. Comparing base (523e1b4) to head (7f189ee).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1013      +/-   ##
==========================================
- Coverage   85.12%   85.08%   -0.05%     
==========================================
  Files          53       53              
  Lines        5276     5275       -1     
==========================================
- Hits         4491     4488       -3     
- Misses        640      642       +2     
  Partials      145      145              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cleptric
Copy link
Member Author

@Darevski just pinging you here as you opened the PR with the initial changes last year. In my testing, all the issues you reported back then are still fixed with these changes.

@cleptric cleptric merged commit 00a135a into master May 13, 2025
17 checks passed
@cleptric cleptric deleted the fix-span-scopes branch May 13, 2025 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Issue type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SetUser does not work when called after starting a span

2 participants