-
Notifications
You must be signed in to change notification settings - Fork 244
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(context): do not modify stack array directly when attach and detach #1760
base: main
Are you sure you want to change the base?
fix(context): do not modify stack array directly when attach and detach #1760
Conversation
|
Hi @tientt-holistics, thank you for your contribution! It looks like there's a few failures related to Rubocop in the CI: https://github.com/open-telemetry/opentelemetry-ruby/actions/runs/11834674510/job/33062312585?pr=1760#step:6:267 Could you take a look? |
cd841ef
to
4058a91
Compare
Hi @kaylareopelle, I just fixed the rubocop warning. But I don't know how to trigger the workflow again. Could you mind help me do that? Thank you |
Hi @tientt-holistics, thanks for the fix! Since this is your first PR in this repository, a maintainer or an approve will need to approve your CI runs. I just kicked them off again. If you're ever stuck waiting after a commit, post a comment and someone should be able to approve the runs soon after. |
I have added some details to an issue for reviewers: #1766 My concern here is that switching to using Immutable Arrays results in additional object allocations per |
This approach requires additional allocations, as @arielvalentin noted. I implemented an alternative with a linked list back in February: #1597. I rejected that due to performance concerns, however when I repeat the benchmarks with this PR, the immutable array approach is consistently worse:
|
An alternative using the existing array code with a Fiber attribute, like
|
Another option, if we're willing to take a dependency on
|
@arielvalentin pointed out that this uses fiber-local variables in its implementation, so it suffers from the same problem of other gems breaking encapsulation and copying the contents of the Fiber local entries. |
As mentioned in open-telemetry/opentelemetry-ruby/pull/1598
This PR will replace the
stack.push
andstack.pop
with Thread.current assignment