1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-23 00:14:48 +00:00

Fix Sentry registration

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-09-27 18:01:53 +02:00
parent 92dcc0780d
commit 8915a5caad
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
3 changed files with 12 additions and 11 deletions

View file

@ -141,10 +141,6 @@ config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
config :logger, Sentry.LoggerBackend,
level: :warn,
capture_log_messages: true
config :mobilizon, Mobilizon.Web.Auth.Guardian,
issuer: "mobilizon",
token_ttl: %{

View file

@ -11,6 +11,7 @@ defmodule Mobilizon.Service.ActorSuspension do
alias Mobilizon.Medias.File
alias Mobilizon.Posts.Post
alias Mobilizon.Resources.Resource
alias Mobilizon.Service.ErrorReporting.Sentry
alias Mobilizon.Service.Export.Cachable
alias Mobilizon.Storage.Repo
alias Mobilizon.Users.User

View file

@ -13,7 +13,9 @@ defmodule Mobilizon.Service.ErrorReporting.Sentry do
@impl ErrorReporting
def configure do
Logger.add_backend(Sentry.LoggerBackend)
if enabled?() do
Logger.add_backend(Sentry.LoggerBackend)
end
end
def capture_message(message, opts \\ []) when is_binary(message) do
@ -31,12 +33,14 @@ defmodule Mobilizon.Service.ErrorReporting.Sentry do
@impl ErrorReporting
@spec attach :: :ok | {:error, :already_exists}
def attach do
:telemetry.attach(
"oban-errors",
[:oban, :job, :exception],
&handle_event/4,
[]
)
if enabled?() do
:telemetry.attach(
"oban-errors",
[:oban, :job, :exception],
&handle_event/4,
[]
)
end
end
@impl ErrorReporting