I’m Jeff, from AppSignal. I’ve been working on getting our integration ready for the deprecation of Phoenix.Instrumenter in the upcoming version of Phoenix, and I could use some guidance.
Phoenix.Instrumenter to hook into the
phoenix_controller_call events to track events as they happened. Now, with the newly emitted Telemetry events, we’re moving that logic over to a new event handler that hooks into the
[:phoenix, :endpoint, :start] and
[:phoenix, :endpoint, :stop] events, which has been working great for our purposes.
However, we’re having some trouble getting the controller and action names out of the conn in the new events. Since the old
phoenix_controller_call events were called later in the request, the pipeline was already called, meaning the
:phoenix_controller and :phoenix_action` were already set in the conn. Since the Telemetry events are called right before the pipeline is started, we can’t set the controller and action names before the controller action is called. We’ve moved the logic to set the controller and action names to a before_send callback.
Again, this works. However, when an error happens that prevents the before_send callback from being called (like an unhandled exit or a timeout), we can’t determine in which controller action that error happened. We’re trying to figure out if there’s a way around that, or if this is intended behaviour.
We were excited to see this proposal to add controller events last year, which would allow us to revert to setting the action names before the action is called, but it seems like this was replaced with the endpoint events that are in master now. Are there any plans to bring something like this back?
In short; we’re able to instrument endpoint calls on Phoenix 1.5 currently, but we can’t match exits to their controller and action names, causing them to be reported as “outside of an action” in AppSignal. Would that be expected behaviour (since they’re process exits), or would there be a way around that? Any input would be greatly appreciated!