-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Hi, first I wanted to say this is clearly the cleanest and best Elixir New Relic lib available. Before finding this I was pretty sure I was going to need to write something similar to this myself, so thanks!
I have been able to add this to a Phoenix app pretty easily via the instrumentation hooks, however I think the ability to integrate with Phoenix could be improved. In particular a new generic tool is required in order to provide Ecto segments without explicitly passing around a transaction.
I would like to add some sort of TransactionRegistry which uses ETS and a pid key to store a transaction. API might look something like:
:ok = TransactionRegistry.init_transaction("/example")
:ok = TransactionRegistry.init_transaction_segment({Ecto, :query})
:ok = TransactionRegistry.record({Ecto, :query})
:ok = TransactionRegistry.init_transaction_segment({View, :render})
:ok = TransactionRegistry.record({View, :render})
:ok = TransactionRegistry.publishUnder the hood I believe this could use the existing API with little to no changes. Possibly the macros could be added to or adapted to work with this as well. If the pid has no transaction (init never called) the segment/record functions would just do nothing.
Anyway, if you think this would be valuable to the lib and are still planning on maintaining it I am happy to open a PR with this. I would also probably like follow up with a discorelic_phoenix app that wraps this app with some of the plumbing required to get new relic for phoenix working.
BTW, is there significance in the name?