Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions lib/logflare_web/live/search_live/logs_search_lv.ex
Original file line number Diff line number Diff line change
Expand Up @@ -494,11 +494,27 @@ defmodule LogflareWeb.Source.SearchLV do
) do
{:noreply, update_event_pagination(socket, &EventPagination.mark_loading(&1, intent))}
else
_ -> {:noreply, socket}
reason ->
log_dropped_page_request(socket, %{
intent: intent,
cursor_id: cursor_id,
cursor_timestamp: cursor_timestamp,
reason: reason
})

{:noreply, socket}
end
end

def handle_event("load_events", _params, socket), do: {:noreply, socket}
def handle_event("load_events", params, socket) do
log_dropped_page_request(socket, %{
params: Map.take(params, ["intent", "cursor-id", "cursor-timestamp"]),
loading: socket.assigns.loading,
tailing?: socket.assigns.tailing?
})

{:noreply, socket}
end

def handle_event(direction, _, socket) when direction in ["backwards", "forwards"] do
rules = socket.assigns.lql_rules
Expand Down Expand Up @@ -756,6 +772,16 @@ defmodule LogflareWeb.Source.SearchLV do
end
end

# A page request that never reaches the executor used to be indistinguishable from one
# that returned no rows: both leave the list untouched and the SQL in the debug modal
# unchanged, because that modal only ever shows the initial query.
defp log_dropped_page_request(socket, context) do
Logger.warning("Search: dropped a load_events request | #{inspect(context)}",
source_id: socket.assigns.source.token,
source_token: socket.assigns.source.token
)
end

defp update_event_pagination(socket, update) do
assign(socket, :event_pagination, update.(socket.assigns.event_pagination))
end
Expand Down
Loading