ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "Eregon (Benoit Daloze) via ruby-core" <ruby-core@ml.ruby-lang.org>
To: ruby-core@ml.ruby-lang.org
Cc: "Eregon (Benoit Daloze)" <noreply@ruby-lang.org>
Subject: [ruby-core:113767] [Ruby master Feature#19056] Introduce `Fiber.annotation` for attaching messages to fibers.
Date: Mon, 05 Jun 2023 09:30:20 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-103417.20230605093019.3344@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-19056.20221014230931.3344@ruby-lang.org

Issue #19056 has been updated by Eregon (Benoit Daloze).


Why not use a fiber-local variable for this? Then there is much less risk of conflict between libraries, and of course you can define convenience methods as you like.
Or as you implemented it in that gem, as an attribute + `annotate(message) { ... }`.

IMO this is good to be in a gem. I don't think it needs to be in core.

----------------------------------------
Feature #19056: Introduce `Fiber.annotation` for attaching messages to fibers.
https://bugs.ruby-lang.org/issues/19056#change-103417

* 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

---Files--------------------------------
clipboard-202210160132-n7lzp.png (865 KB)


-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/

  parent reply	other threads:[~2023-06-05  9:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 23:09 [ruby-core:110293] [Ruby master Bug#19056] Introduce `Fiber.annotation` for attaching messages to fibers ioquatix (Samuel Williams)
2022-10-15  0:32 ` [ruby-core:110296] [Ruby master Feature#19056] " ioquatix (Samuel Williams)
2022-10-15 12:34 ` [ruby-core:110311] " ioquatix (Samuel Williams)
2022-10-20  6:02 ` [ruby-core:110432] " matz (Yukihiro Matsumoto)
2022-10-21  5:18 ` [ruby-core:110456] " mame (Yusuke Endoh)
2022-11-01  1:09 ` [ruby-core:110562] " ioquatix (Samuel Williams)
2023-06-04 14:33 ` [ruby-core:113751] " ioquatix (Samuel Williams) via ruby-core
2023-06-05  9:30 ` Eregon (Benoit Daloze) via ruby-core [this message]
2023-06-05  9:31 ` [ruby-core:113768] " ioquatix (Samuel Williams) via ruby-core
2023-06-05  9:37 ` [ruby-core:113769] " Eregon (Benoit Daloze) via ruby-core
2023-06-05  9:43 ` [ruby-core:113770] " ioquatix (Samuel Williams) via ruby-core
2024-04-11  3:34 ` [ruby-core:117489] " ioquatix (Samuel Williams) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-103417.20230605093019.3344@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    --cc=noreply@ruby-lang.org \
    --cc=ruby-core@ml.ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).