Skip to content

Tracing inside Fibers #1389

Open
Open
@rmosolgo

Description

@rmosolgo

👋 Hi! I'm coming here by way of a bug report in graphql-ruby: rmosolgo/graphql-ruby#3366

A recent GraphQL-Ruby release included a Fiber-based batch loading plugin: it takes little "jobs" during GraphQL execution, then uses a bunch of Fibers to run the jobs concurrently. (Hopefully, it'll leverage the Ruby 3 scheduler soon so that I/O in those fibers happens in parallel, but that's not done yet.)

A user noticed that code run inside Fibers doesn't show up in DataDog APM, and that it's likely due to the use of Thread.current for storing DataDog state:

def set_scope(scope)
Thread.current[object_id.to_s] = scope
end

(Inside a new Fiber, Thread.current is empty.)

I'm sorry to say I don't have an idea for how to address this, but I thought I'd open an issue in case y'all have any suggestions. This certainly seems related to #1136 , since both are about using Fibers.

Does anyone have a suggestion for how this issue might be addressed?

Metadata

Metadata

Assignees

Labels

communityWas opened by a community membercoreInvolves Datadog core librariesfeature-requestA request for a new feature or change to an existing one

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions