Skip to content

Commit

Permalink
Added sentry (#181)
Browse files Browse the repository at this point in the history
* added sentry

* removed 1/0
  • Loading branch information
awaistkd authored Oct 31, 2023
1 parent 6f38aa4 commit ef1010a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ config :postoffice, PostofficeWeb.Endpoint,
]

# Configures Elixir's Logger
config :logger, :console,
config :logger,
backends: [:console, Sentry.LoggerBackend],
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]

Expand All @@ -50,6 +51,16 @@ config :postoffice, Oban,
],
queues: [default: 10, http: 100, pubsub: 15]

config :sentry,
dsn: System.get_env("POSTOFFICE_SENTRY_DSN", ""),
environment_name: Mix.env(),
enable_source_code_context: true,
root_source_code_path: File.cwd!(),
tags: %{
env: Mix.env()
},
included_environments: [:prod]

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env()}.exs"
2 changes: 2 additions & 0 deletions lib/postoffice_web/endpoint.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule PostofficeWeb.Endpoint do
use Sentry.PlugCapture
use Phoenix.Endpoint, otp_app: :postoffice

@session_options [
Expand Down Expand Up @@ -38,6 +39,7 @@ defmodule PostofficeWeb.Endpoint do
pass: ["*/*"],
json_decoder: Phoenix.json_library()

plug Sentry.PlugContext
plug Plug.MethodOverride
plug Plug.Head

Expand Down
1 change: 1 addition & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ defmodule Postoffice.MixProject do
{:phoenix_live_dashboard, "0.7.2"},
{:phoenix_live_reload, "1.4.0", only: :dev},
{:gettext, "0.20.0"},
{:sentry, "8.1.0"},
{:jason, "1.4.0"},
{:plug_cowboy, "2.5.2"},
{:bcrypt_elixir, "3.0.1"},
Expand Down

0 comments on commit ef1010a

Please sign in to comment.