defmodule Observer.Web.Tracing.Page do @moduledoc """ This is the live component responsible for handling the Tracing debug """ @behaviour Observer.Web.Page use Observer.Web, :live_component alias Observer.Web.Components.Attention alias Observer.Web.Components.Core alias Observer.Web.Components.MultiSelectList alias Observer.Web.Page alias ObserverWeb.Tracer @impl Phoenix.LiveComponent def render(assigns) do unselected_services_keys = assigns.node_info.services_keys -- assigns.node_info.selected_services_keys unselected_modules_keys = assigns.node_info.modules_keys -- assigns.node_info.selected_modules_keys unselected_functions_keys = assigns.node_info.functions_keys -- assigns.node_info.selected_functions_keys unselected_match_spec_keys = assigns.node_info.match_spec_keys -- assigns.node_info.selected_match_spec_keys trace_state = Tracer.state() trace_idle? = trace_state.status == :idle trace_owner? = trace_state.session_id == assigns.trace_session_id # Hide options when running show_tracing_options = trace_idle? and trace_owner? and assigns.show_tracing_options match_spec_info = ~H""" (more_info) """ attention_msg = ~H""" Incorrect use of the :dbg tracer in production can lead to performance degradation, latency and crashes. Observer Web tracing enforces limits on the maximum number of messages and applies a timeout (in seconds) to ensure the debugger doesn't remain active unintentionally. Check out the Erlang Debugger for more detailed information. """ assigns = assigns |> assign(unselected_services_keys: unselected_services_keys) |> assign(unselected_modules_keys: unselected_modules_keys) |> assign(unselected_functions_keys: unselected_functions_keys) |> assign(unselected_match_spec_keys: unselected_match_spec_keys) |> assign(match_spec_info: match_spec_info) |> assign(trace_idle?: trace_idle?) |> assign(trace_idle?: trace_idle?) |> assign(trace_owner?: trace_owner?) |> assign(show_tracing_options: show_tracing_options) |> assign(attention_msg: attention_msg) ~H"""