Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Sentry cleanup (#2590)
Adam Rutkowski61bf624761ef
diff --git a/lib/plausible_web/controllers/api/stats_controller.ex b/lib/plausible_web/controllers/api/stats_controller.exindex 20e774d545..4eab322655 100644--- a/lib/plausible_web/controllers/api/stats_controller.ex+++ b/lib/plausible_web/controllers/api/stats_controller.ex@@ -5,6 +5,8 @@ defmodule PlausibleWeb.Api.StatsController doalias Plausible.Statsalias Plausible.Stats.{Query, Filters}+ require Logger+@doc """Returns a time-series based on given parameters.@@ -805,7 +807,7 @@ defmodule PlausibleWeb.Api.StatsController docountry_entry = get_country(region_entry.country_code)Map.merge(region, %{name: region_entry.name, country_flag: country_entry.flag})else- Sentry.capture_message("Could not find region info", extra: %{code: region[:code]})+ Logger.warning("Could not find region info - code: #{inspect(region[:code])}")Map.merge(region, %{name: region[:code]})endend)@@ -842,7 +844,7 @@ defmodule PlausibleWeb.Api.StatsController docountry_flag: country_info.flag})else- Sentry.capture_message("Could not find city info", extra: %{code: city[:code]})+ Logger.warning("Could not find city info - code: #{inspect(city[:code])}")Map.merge(city, %{name: "N/A"})end@@ -1173,7 +1175,7 @@ defmodule PlausibleWeb.Api.StatsController dodefp get_country(code) docase Location.get_country(code) donil ->- Sentry.capture_message("Could not find country info", extra: %{code: code})+ Logger.warning("Could not find country info - code: #{inspect(code)}")%Location.Country{alpha_2: code,diff --git a/lib/plausible_web/endpoint.ex b/lib/plausible_web/endpoint.exindex 34078e93ea..90172f0c3a 100644--- a/lib/plausible_web/endpoint.ex+++ b/lib/plausible_web/endpoint.ex@@ -13,7 +13,7 @@ defmodule PlausibleWeb.Endpoint doat: "/",from: :plausible,gzip: false,- only: ~w(css fonts images js favicon.ico robots.txt)+ only: ~w(css images js favicon.ico robots.txt)plug Plug.Static,at: "/kaffy",diff --git a/lib/sentry_filter.ex b/lib/sentry_filter.exindex 84871972d2..700888030f 100644--- a/lib/sentry_filter.ex+++ b/lib/sentry_filter.ex@@ -6,6 +6,8 @@ defmodule Plausible.SentryFilter dodef exclude_exception?(%Sentry.CrashError{}, _source), do: truedef exclude_exception?(%Phoenix.NotAcceptableError{}, _), do: true+ def exclude_exception?(%Plug.CSRFProtection.InvalidCSRFTokenError{}, _), do: true+ def exclude_exception?(%Plug.Static.InvalidPathError{}, _), do: truedef exclude_exception?(exception, source) doSentry.DefaultEventFilter.exclude_exception?(exception, source)@@ -14,11 +16,6 @@ defmodule Plausible.SentryFilter do@spec before_send(Sentry.Event.t()) :: Sentry.Event.t()def before_send(event)- # https://hexdocs.pm/sentry/readme.html#fingerprinting- def before_send(%{exception: [%{type: DBConnection.ConnectionError}]} = event) do- %{event | fingerprint: ["ecto", "db_connection", "timeout"]}- end-def before_send(%{exception: [%{type: "Clickhousex.Error"}], original_exception: %{code: code}} = event)@@ -26,6 +23,10 @@ defmodule Plausible.SentryFilter do%{event | fingerprint: ["clickhouse", "db_connection", to_string(code)]}end+ def before_send(%{event_source: :logger, message: "Clickhousex.Protocol " <> _} = event) do+ %{event | fingerprint: ["clickhouse", "db_connection", "protocol_error"]}+ end+def before_send(event) doeventend