add diagnostic logging for agent result handling
This commit is contained in:
parent
e4623f0c3d
commit
bd24dfcbed
1 changed files with 13 additions and 0 deletions
|
|
@ -334,6 +334,8 @@ defmodule ToweropsWeb.AgentChannel do
|
|||
@impl true
|
||||
@spec handle_in(String.t(), map(), socket()) :: {:noreply, socket()}
|
||||
def handle_in("result", %{"binary" => binary_b64}, socket) when is_binary(binary_b64) do
|
||||
Logger.info("Received SNMP result from agent (binary size: #{byte_size(binary_b64)})")
|
||||
|
||||
with {:ok, binary} <- safe_base64_decode(binary_b64),
|
||||
{:ok, result} <- Validator.validate_snmp_result(binary) do
|
||||
maybe_debug_log(socket, "Received SNMP result from agent",
|
||||
|
|
@ -547,6 +549,17 @@ defmodule ToweropsWeb.AgentChannel do
|
|||
end
|
||||
end
|
||||
|
||||
# Catch-all for unmatched events (diagnostic)
|
||||
def handle_in(event, payload, socket) do
|
||||
Logger.warning("Unhandled agent channel event",
|
||||
event: event,
|
||||
payload_keys: Map.keys(payload),
|
||||
agent_token_id: socket.assigns.agent_token_id
|
||||
)
|
||||
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
# Private helpers
|
||||
|
||||
@spec handle_validated_mikrotik_result(MikrotikResult.t(), socket()) :: {:noreply, socket()}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue