Skip to content

Commit

Permalink
Only stop websocket transaction when render completes
Browse files Browse the repository at this point in the history
  • Loading branch information
binaryseed committed Feb 14, 2025
1 parent 3864edc commit c5d00a3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/new_relic/telemetry/phoenix_live_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ defmodule NewRelic.Telemetry.PhoenixLiveView do
def handle_event(@live_view_render_stop, meas, meta, _config) do
Tracer.Direct.stop_span(meta.telemetry_span_context, duration: meas.duration)

Transaction.Reporter.stop_transaction(:web)
if meta.socket.transport_pid do
Transaction.Reporter.stop_transaction(:web)
end
end

def handle_event(@live_view_render_exception, meas, meta, _config) do
Expand All @@ -163,7 +165,9 @@ defmodule NewRelic.Telemetry.PhoenixLiveView do
attributes: [error: true, "error.kind": meta.kind, "error.reason": inspect(meta.reason)]
)

Transaction.Reporter.stop_transaction(:web)
if meta.socket.transport_pid do
Transaction.Reporter.stop_transaction(:web)
end
end

def handle_event(_event, _meas, _meta, _config) do
Expand Down

0 comments on commit c5d00a3

Please sign in to comment.