From: "ioquatix (Samuel Williams)" Date: 2022-10-15T00:32:14+00:00 Subject: [ruby-core:110296] [Ruby master Feature#19056] Introduce `Fiber.annotation` for attaching messages to fibers. Issue #19056 has been updated by ioquatix (Samuel Williams). A counter-proposal to introduce `Fiber#name`, but this is different concept. ``` fiber = Fiber.current fiber.name = "Processor" while item = queue.pop fiber.annotation = "Processing item #{item}..." # ... work ... end ``` In this case, `Fiber#annotation` is related to the current activity of the Fiber, not its general name in relation to other fibers. However, I'm not against introducing `Fiber#name` in another proposal. This feature is already part of `Async::Task` and is very useful for debugging programs with a lot of fibers, since we can visualise the activity of all the different fibers easily. I'll share a screenshot and/or video. ---------------------------------------- Feature #19056: Introduce `Fiber.annotation` for attaching messages to fibers. https://bugs.ruby-lang.org/issues/19056#change-99582 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- It's useful to know what a fiber is doing especially when they have a temporal execution (i.e. sockets connecting vs connected, binding vs accepting, queue popping, etc) Let's introduce `Fiber.annotate` and `Fiber#annotation` for logging a short message attached to Fibers. ```ruby Fiber.annotate "Counting to 10" 10.times{|I| puts I} # Fiber.current.annotation => "Counting to 10" ``` Pull Request: https://github.com/ruby/ruby/pull/6554 -- https://bugs.ruby-lang.org/ Unsubscribe: