newrelic / elixir_agent

New Relic's Open Source Elixir Agent
https://hex.pm/packages/new_relic_agent
Apache License 2.0
254 stars 97 forks source link

Transactions often report wrong LiveView #397

Closed goto-engineering closed 1 year ago

goto-engineering commented 1 year ago

Describe the bug We are seeing a lot of transactions that report the wrong LiveView. We suspect that the view being reported is the first LiveView the user originally entered, and a redirect to another LiveView didn't register.

E.g. we're seeing:

WebTransaction/Phoenix/Phoenix.LiveView.Plug/liveview1
Uri: .../route_to_liveview_2

Presumably the user got liveview1 mounted and then clicked on a link to liveview2, where the actual transaction happened. Or are both transactions being mixed together?

Environment Erlang/OTP 25 [erts-13.1.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns] Elixir 1.14.2 (compiled with Erlang/OTP 23)

goto-engineering commented 1 year ago

Nvm. It seems that NR uses the action name passed to a route as the name for that view, and we were using a bunch of unhelpfully named actions. Just leaving them off caused NR to report the LiveView name correctly. Maybe concatenate the names into something like LiveView1.action2 instead of just using action2? Multiple LiveViews can have colliding action names, as happened in our case.

goto-engineering commented 1 year ago

I made a PR to hopefully address this: https://github.com/newrelic/elixir_agent/pull/398