From 96cbda2cce88d71132b294f0d84d1d2b29c9d6d8 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Sat, 25 Feb 2023 13:39:24 +0100 Subject: [PATCH] Add extra error info + telemetry for AsyncInsertRepo (#2708) * Add extra error info + telemetry for AsyncInsertRepo * format --- lib/plausible/ingestion/counters.ex | 8 ++++++-- lib/plausible/prom_ex.ex | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/plausible/ingestion/counters.ex b/lib/plausible/ingestion/counters.ex index 843080ed8..8c4b70aae 100644 --- a/lib/plausible/ingestion/counters.ex +++ b/lib/plausible/ingestion/counters.ex @@ -84,8 +84,12 @@ defmodule Plausible.Ingestion.Counters do {_, _} = AsyncInsertRepo.insert_all(Record, records) catch _, thrown -> - Logger.error( - "Caught an error when trying to flush ingest counters: #{inspect(thrown)}" + Sentry.capture_message( + "Caught an error when trying to flush ingest counters.", + extra: %{ + number_of_records: Enum.count(records), + error: inspect(thrown) + } ) end end diff --git a/lib/plausible/prom_ex.ex b/lib/plausible/prom_ex.ex index cf903eb01..ced0fd81e 100644 --- a/lib/plausible/prom_ex.ex +++ b/lib/plausible/prom_ex.ex @@ -9,7 +9,13 @@ defmodule Plausible.PromEx do Plugins.Application, Plugins.Beam, {Plugins.Phoenix, router: PlausibleWeb.Router, endpoint: PlausibleWeb.Endpoint}, - {Plugins.Ecto, repos: [Plausible.Repo, Plausible.ClickhouseRepo, Plausible.IngestRepo]}, + {Plugins.Ecto, + repos: [ + Plausible.Repo, + Plausible.ClickhouseRepo, + Plausible.IngestRepo, + Plausible.AsyncInsertRepo + ]}, Plugins.Oban, Plausible.PromEx.Plugins.PlausibleMetrics ]