@@ -78,19 +78,19 @@ defmodule NewRelic.Telemetry.PhoenixLiveView do
78
78
79
79
def handle_event ( @ live_view_mount_start , meas , meta , config ) do
80
80
if meta . socket . transport_pid do
81
- uri = URI . parse ( meta . uri )
81
+ { host , path } = parse_uri ( meta . uri )
82
82
83
83
# We're in the LiveView WebSocket process, collect a Transaction
84
- with :collect <- Transaction.Reporter . start_transaction ( :web , uri . path ) do
84
+ with :collect <- Transaction.Reporter . start_transaction ( :web , path ) do
85
85
NewRelic.DistributedTrace . start ( :other )
86
86
framework_name = "/Phoenix.LiveView/Live/#{ inspect ( meta . socket . view ) } /#{ meta . socket . assigns . live_action } "
87
87
88
88
NewRelic . add_attributes (
89
89
pid: inspect ( self ( ) ) ,
90
90
start_time: meas . system_time ,
91
91
framework_name: framework_name ,
92
- host: uri . host ,
93
- path: uri . path ,
92
+ host: host ,
93
+ path: path ,
94
94
"live_view.router": inspect ( meta . socket . router ) ,
95
95
"live_view.endpoint": inspect ( meta . socket . endpoint ) ,
96
96
"live_view.action": meta . socket . assigns [ :live_action ] ,
@@ -173,4 +173,12 @@ defmodule NewRelic.Telemetry.PhoenixLiveView do
173
173
def handle_event ( _event , _meas , _meta , _config ) do
174
174
:ignore
175
175
end
176
+
177
+ defp parse_uri ( nil ) ,
178
+ do: { "unknown" , "unknown" }
179
+
180
+ defp parse_uri ( uri ) do
181
+ uri = URI . parse ( uri )
182
+ { uri . host , uri . path }
183
+ end
176
184
end
0 commit comments