Subscribe to all ActiveSupport notifications #1214
Replies: 1 comment 3 replies
-
Hey @lustickd - thanks for bringing this up! We originally envisioned that folks wouldn't want all of their notifications to be traced; we presumed that people would have a somewhat small list of things they knew needed tracing. Hence, we just supported string subscriptions. That said, I could easily see how you'd want to do something like If you're interested in contributing this, I've written up what a PR to do this would need to implement! I don't know if / when I or others would get around to working on this personally, but I would be quite happy to review a PR that provides the functionality. 😄 It would be possible to modify things here to accept a regular expression; the main problem is that we use the actual subscription name as part of the span name, as you can see here. Subscribing with a regex would make it impossible to know that name up-front like the code currently expects, so a few modifications would have to be made here and there:
We'd really need tests ensuring the following, but for most of this it would be possible to copy / modify the tests that already exist.
|
Beta Was this translation helpful? Give feedback.
-
It's annoying to set up traces 1 by 1 for each notification. Luckily activesupport takes a regex:
Now every event gets traced, like
sql.active_record
,factory_bot.run_factory
, etc..OpenTelemetry::Instrumentation::ActiveSupport.subscribe
will throw an error if you try to pass a regex. You can convert the regex to a string but you won't get the right event name in your logs.Beta Was this translation helpful? Give feedback.
All reactions