Closed
Description
Environment
- Elixir version (elixir -v): 1.5.1
- Erlang/OTP version (erl): Erlang/OTP 20 [erts-9.0.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
- Sentry version (mix deps): 6.0.3
- Operating system: macOS 10.13.1
Description
Full diff of changes to add sentry to my project:
diff --git a/config/config.exs b/config/config.exs
index ac0d6bf..3250b5c 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -32,6 +32,13 @@ config :api_tournament, :sendgrid,
signup_template: "2b592f2e-7928-41eb-b0c3-a7ca76bcddee",
changed_template: "e683d87d-0e7e-437b-bad5-ab9913c9676d"
+config :sentry, dsn: "https://PUBLIC:SECRET@sentry.io/PORT",
+ included_environments: [:prod, :dev],
+ enable_source_code_context: true,
+ root_source_code_path: File.cwd!,
+ in_app_module_whitelist: [APITournament],
+ environment_name: Mix.env
+
# 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"
diff --git a/lib/application.ex b/lib/application.ex
index 8076c3d..7117978 100644
--- a/lib/application.ex
+++ b/lib/application.ex
@@ -37,6 +37,7 @@ defmodule APITournament.Application do
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: APITournament.Supervisor]
+ :ok = :error_logger.add_report_handler(Sentry.Logger)
Supervisor.start_link(children, opts)
end
diff --git a/lib/endpoint.ex b/lib/endpoint.ex
index 765d93d..4db57e4 100644
--- a/lib/endpoint.ex
+++ b/lib/endpoint.ex
@@ -8,6 +8,8 @@ defmodule APITournament.Endpoint do
"""
use Phoenix.Endpoint, otp_app: :api_tournament
use Absinthe.Phoenix.Endpoint
+ use Plug.ErrorHandler
+ use Sentry.Plug
socket "/sock", APITournament.MainSocket
diff --git a/mix.exs b/mix.exs
index 8c2e04c..05fca95 100644
--- a/mix.exs
+++ b/mix.exs
@@ -28,7 +28,11 @@ defmodule APITournament.Mixfile do
def application do
[
mod: {APITournament.Application, []},
- extra_applications: [:logger, :runtime_tools, :cloud_watch, :ex_aws],
+ extra_applications: [:sentry,
+ :logger,
+ :runtime_tools,
+ :cloud_watch,
+ :ex_aws],
included_applications: [:qrcode],
]
end
@@ -80,6 +84,7 @@ defmodule APITournament.Mixfile do
{:nimble_csv, "~> 0.3"},
{:math, "~> 0.3"},
{:cors_plug, "~> 1.2"},
+ {:sentry, "~> 6.0.0"},
]
end
diff --git a/mix.lock b/mix.lock
index 23d0bbb..24f2d2c 100644
--- a/mix.lock
+++ b/mix.lock
@@ -54,6 +54,7 @@
"qrcode": {:git, "https://github.com/numerai/qrcode", "55192958b08692fdb9444c47e66a6985f3217fb1", [ref: "5519295"]},
"ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], [], "hexpm"},
"sendgrid": {:hex, :sendgrid, "1.7.0", "a1c31fed719483b202d91ec7c8a5db79e1104dae04cb40e0c5dfe0bc53a0abeb", [], [{:httpoison, ">= 0.11.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, ">= 2.0.0 or >= 3.0.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"},
+ "sentry": {:hex, :sentry, "6.0.3", "e83f21901008a6c76ff81cc696a053fbd1d6a12600050d3e61928c7945b3621e", [], [{:hackney, "~> 1.8 or 1.6.5", [hex: :hackney, repo: "hexpm", optional: false]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}, {:poison, "~> 1.5 or ~> 2.0 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}, {:uuid, "~> 1.0", [hex: :uuid, repo: "hexpm", optional: false]}], "hexpm"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm"},
"sweet_xml": {:hex, :sweet_xml, "0.6.5", "dd9cde443212b505d1b5f9758feb2000e66a14d3c449f04c572f3048c66e6697", [], [], "hexpm"},
"timex": {:hex, :timex, "3.1.24", "d198ae9783ac807721cca0c5535384ebdf99da4976be8cefb9665a9262a1e9e3", [:mix], [{:combine, "~> 0.7", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm"},
PUBLIC
, SECRET
, and PORT
are filled in with the correct values on my end and running MIX_ENV=dev mix sentry.send_test_event
successfully causes an issue to show up in sentry.io. However, when I run my server with mix phx.server
and cause an error with raise "Sentry Test Error 12345"
in one of my endpoints, nothing appears on sentry.io. I'm doing all of this testing locally on my Mac in the dev
environment.
Metadata
Metadata
Assignees
Labels
No labels