Add extra error info + telemetry for AsyncInsertRepo (#2708)

* Add extra error info + telemetry for AsyncInsertRepo

* format
This commit is contained in:
Adam Rutkowski 2023-02-25 13:39:24 +01:00 committed by GitHub
parent 867dad6da7
commit 2d8775e5ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -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

View File

@ -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
]