You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Appsignal is using fiber-local variables to store the current appsignal transaction and some information about logger.
When opening a new Fiber, you will not have access to the Appsignal current transaction inside the new fiber since the transaction it's stored in a fiber-local variable and they are not shared between fibers. (https://docs.ruby-lang.org/en/3.2/Thread.html#method-i-5B-5D) See below example:
My suggestion is to make the Appsignal transaction available as a thread local variable, instead of using Thread.current[:appsignal_transaction] to use Thread.current.thread_variable_set(:appsignal_transaction, ...) and Thread.current.thread_variable_get(:appsignal_transaction)`.
With the way our transaction API works, it doesn't support async events. Having fibers concurrently instrumented will result in a broken event timeline. Best way to go about it right now is to create a new transaction in a fiber.
We'll update the Ruby gem's API in the future, to support concurrent events better.
Currently, Appsignal is using fiber-local variables to store the current appsignal transaction and some information about logger.
When opening a new Fiber, you will not have access to the Appsignal current transaction inside the new fiber since the transaction it's stored in a fiber-local variable and they are not shared between fibers. (https://docs.ruby-lang.org/en/3.2/Thread.html#method-i-5B-5D) See below example:
My suggestion is to make the Appsignal transaction available as a thread local variable, instead of using
Thread.current[:appsignal_transaction]
to useThread.current.thread_variable_set(:appsignal_transaction, ...)
and Thread.current.thread_variable_get(:appsignal_transaction)`.I have encountered this issue using dry-effects library. Please see this issue.
I am not sure if there are any other concerns, but I can open up a PR with the changes if green light.
Thank you!
TODO
Thread.current[]
andThread.current[]=
withThread.current.thread_variable_set
andThread.current.thread_variable_get
The text was updated successfully, but these errors were encountered: