forked from potsda.mn/mobilizon
Fix Sentry registration
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
92dcc0780d
commit
8915a5caad
|
@ -141,10 +141,6 @@ config :logger, :console,
|
||||||
format: "$time $metadata[$level] $message\n",
|
format: "$time $metadata[$level] $message\n",
|
||||||
metadata: [:request_id]
|
metadata: [:request_id]
|
||||||
|
|
||||||
config :logger, Sentry.LoggerBackend,
|
|
||||||
level: :warn,
|
|
||||||
capture_log_messages: true
|
|
||||||
|
|
||||||
config :mobilizon, Mobilizon.Web.Auth.Guardian,
|
config :mobilizon, Mobilizon.Web.Auth.Guardian,
|
||||||
issuer: "mobilizon",
|
issuer: "mobilizon",
|
||||||
token_ttl: %{
|
token_ttl: %{
|
||||||
|
|
|
@ -11,6 +11,7 @@ defmodule Mobilizon.Service.ActorSuspension do
|
||||||
alias Mobilizon.Medias.File
|
alias Mobilizon.Medias.File
|
||||||
alias Mobilizon.Posts.Post
|
alias Mobilizon.Posts.Post
|
||||||
alias Mobilizon.Resources.Resource
|
alias Mobilizon.Resources.Resource
|
||||||
|
alias Mobilizon.Service.ErrorReporting.Sentry
|
||||||
alias Mobilizon.Service.Export.Cachable
|
alias Mobilizon.Service.Export.Cachable
|
||||||
alias Mobilizon.Storage.Repo
|
alias Mobilizon.Storage.Repo
|
||||||
alias Mobilizon.Users.User
|
alias Mobilizon.Users.User
|
||||||
|
|
|
@ -13,8 +13,10 @@ defmodule Mobilizon.Service.ErrorReporting.Sentry do
|
||||||
|
|
||||||
@impl ErrorReporting
|
@impl ErrorReporting
|
||||||
def configure do
|
def configure do
|
||||||
|
if enabled?() do
|
||||||
Logger.add_backend(Sentry.LoggerBackend)
|
Logger.add_backend(Sentry.LoggerBackend)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def capture_message(message, opts \\ []) when is_binary(message) do
|
def capture_message(message, opts \\ []) when is_binary(message) do
|
||||||
if enabled?() do
|
if enabled?() do
|
||||||
|
@ -31,6 +33,7 @@ defmodule Mobilizon.Service.ErrorReporting.Sentry do
|
||||||
@impl ErrorReporting
|
@impl ErrorReporting
|
||||||
@spec attach :: :ok | {:error, :already_exists}
|
@spec attach :: :ok | {:error, :already_exists}
|
||||||
def attach do
|
def attach do
|
||||||
|
if enabled?() do
|
||||||
:telemetry.attach(
|
:telemetry.attach(
|
||||||
"oban-errors",
|
"oban-errors",
|
||||||
[:oban, :job, :exception],
|
[:oban, :job, :exception],
|
||||||
|
@ -38,6 +41,7 @@ defmodule Mobilizon.Service.ErrorReporting.Sentry do
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@impl ErrorReporting
|
@impl ErrorReporting
|
||||||
def handle_event([:oban, :job, :exception], measure, %{job: job} = meta, _) do
|
def handle_event([:oban, :job, :exception], measure, %{job: job} = meta, _) do
|
||||||
|
|
Loading…
Reference in a new issue