Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Don't log no_session_for_engagement errors coming from persistor (#5765)

Adrian Gruntkowskifc5f56e475aa
diff --git a/lib/plausible/ingestion/persistor/remote.ex b/lib/plausible/ingestion/persistor/remote.ex
index 4238504a68..65b479425c 100644
--- a/lib/plausible/ingestion/persistor/remote.ex
+++ b/lib/plausible/ingestion/persistor/remote.ex
@@ -38,6 +38,9 @@ defmodule Plausible.Ingestion.Persistor.Remote do
{:error, :persist_decode_error}
end
+ {:ok, %{body: "no_session_for_engagement"}} ->
+ {:error, :no_session_for_engagement}
+
{:ok, %{body: error}} ->
log_error(site_id, current_user_id, previous_user_id, error)
{:error, decode_error(error)}
diff --git a/test/plausible/ingestion/persistor_test.exs b/test/plausible/ingestion/persistor_test.exs
index e50f67bb34..e9886cd7b2 100644
--- a/test/plausible/ingestion/persistor_test.exs
+++ b/test/plausible/ingestion/persistor_test.exs
@@ -147,16 +147,14 @@ defmodule Plausible.Ingestion.PersistorTest do
Bypass.expect_once(bypass, "POST", "/event", fn conn ->
conn
- |> Plug.Conn.resp(500, "no_session_for_engagement")
+ |> Plug.Conn.resp(422, "no_session_for_engagement")
end)
- assert capture_log(fn ->
- assert {:error, :no_session_for_engagement} =
- Persistor.persist_event(ingest_event, nil,
- backend: Persistor.Remote,
- url: bypass_url(bypass)
- )
- end) =~ "no_session_for_engagement"
+ assert {:error, :no_session_for_engagement} =
+ Persistor.persist_event(ingest_event, nil,
+ backend: Persistor.Remote,
+ url: bypass_url(bypass)
+ )
end
test "remote persistor failing due to lock timeout" do