In the Ruby client, it feels strange to me that the method for setting request-specific context information is done by calling a class-level method,
One common cause of errors in Rails is setting values at a class level that then persist between requests. I see that the implementation just defers this to
Thread.current, but I’m not entirely comfortable enough with threading and Rails to be sure that:
- A single thread is going to cover all the interactions that happen within a request
- A thread isn’t going to be reused for more than one request.
In my head, I’m more confident that number 2 is true, but I can’t be sure, and I imagine it might depend on which app server we’re using for serving requests.
Can anyone reassure me that this method doesn’t risk leaking data between requests, and attributing context to events that it shouldn’t?