Capture exceptions in Action Cable connections and channels#1251
Capture exceptions in Action Cable connections and channels#1251agrobbin wants to merge 1 commit intogetsentry:4-2from
Conversation
There are 5 types of hooks that Action Cable provides: * `Connection#connect` * `Connection#disconnect` * `Channel#subscribed` * `Channel#unsubscribed` * `Channel` actions Now, any exceptions raised within those hooks are captured by Sentry, and reported as `ActionCable/[...]` transactions. Additional context is included depending on the hook the exception was raised within. A note/quirk: the Rack env that's included in the scope is from the `Connection`, and therefore has a URL of the cable `mount_path` (usually `/cable`) as well as the headers from that initial connection request. Additionally, there is not currently a really clean way to hook in and set `user_context`. I don't know if that is a blocker for this integration, but wanted to make sure it was noted.
7a29165 to
2313db6
Compare
|
Hmm weird, I'm not sure why CI isn't able to load |
|
Ah, mystery solved! Turns out, Rails didn't introduce its Action Cable test helpers until 6.0. I'm not sure what the preference here would be, as I am pretty sure the Action Cable integration itself would still work in 5.2, there's just not a great way to test against both versions. Let me know what you'd like to do about that @st0012! |
|
@agrobbin thanks for the PR 👍 regarding the testing helper, can you take the necessary part of it to a helper file in also, can you help me setup actioncable in the Rails 6 example app ( finally, I'll change the PR's base to |
|
@agrobbin sorry that this was automatically closed due to I merged the |
|
Re-opened as #1295. |
Hi @st0012! I mentioned this in #470 (comment) (and #470 (comment)), and now that 4.x is reasonably stable, thought it worth getting this PR out there.
There are 5 types of hooks that Action Cable provides:
Connection#connectConnection#disconnectChannel#subscribedChannel#unsubscribedChannelactionsNow, any exceptions raised within those hooks are captured by Sentry, and reported as
ActionCable/[...]transactions. Additional context is included depending on the hook the exception was raised within.A note/quirk: the Rack env that's included in the scope is from the
Connection, and therefore has a URL of the cablemount_path(usually/cable) as well as the headers from that initial connection request.Additionally, there is not currently a really clean way to hook in and set
user_context. I don't know if that is a blocker for this integration, but wanted to make sure it was noted.Closes #470.