Skip to content

Commit f75fff1

Browse files
authored
Replace rollbar with sentry (#102)
1 parent 82f0c88 commit f75fff1

File tree

11 files changed

+26
-68
lines changed

11 files changed

+26
-68
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: CI
22

3-
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- master
3+
on: [push, pull_request]
84

95
jobs:
106
test:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN mix compile
3232

3333
# build release
3434
COPY rel rel
35-
RUN mix release
35+
RUN mix do sentry.package_source_code, release
3636

3737
# prepare release image
3838
FROM alpine:3.15.3 AS app

config/config.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ config :logger, :console,
3131
# Use Jason for JSON parsing in Phoenix
3232
config :phoenix, :json_library, Jason
3333

34-
config :rollbax, enabled: false
35-
3634
# Import environment specific config. This must remain at the bottom
3735
# of this file so it overrides the configuration defined above.
3836
import_config "#{Mix.env()}.exs"

config/prod.exs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ config :diff,
2121

2222
config :sasl, sasl_error_logger: false
2323

24-
config :rollbax,
25-
environment: "prod",
26-
enabled: true,
27-
enable_crash_reports: true
24+
config :sentry,
25+
enable_source_code_context: true,
26+
root_source_code_paths: [File.cwd!()]
2827

2928
config :logger,
3029
level: :info,

config/releases.exs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ config :diff,
88

99
config :goth, json: System.fetch_env!("DIFF_GCP_CREDENTIALS")
1010

11-
config :rollbax, access_token: System.fetch_env!("DIFF_ROLLBAR_ACCESS_TOKEN")
11+
config :sentry,
12+
dsn: System.fetch_env!("DIFF_SENTRY_DSN"),
13+
environment_name: System.fetch_env!("DIFF_ENV")
1214

1315
config :kernel,
1416
inet_dist_listen_min: String.to_integer(System.fetch_env!("BEAM_PORT")),

lib/diff/application.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ defmodule Diff.Application do
66
use Application
77

88
def start(_type, _args) do
9+
:logger.add_handler(:sentry_handler, Sentry.LoggerHandler, %{})
10+
911
# List all child processes to be supervised
1012
children = [
1113
{Task.Supervisor, name: Diff.Tasks},

lib/diff_web/endpoint.ex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule DiffWeb.Endpoint do
2+
use Sentry.PlugCapture
23
use Phoenix.Endpoint, otp_app: :diff
34

45
socket "/live", Phoenix.LiveView.Socket
@@ -32,6 +33,7 @@ defmodule DiffWeb.Endpoint do
3233
pass: ["*/*"],
3334
json_decoder: Phoenix.json_library()
3435

36+
plug Sentry.PlugContext
3537
plug Plug.MethodOverride
3638
plug Plug.Head
3739

lib/diff_web/plugs/rollbax.ex

Lines changed: 0 additions & 42 deletions
This file was deleted.

lib/diff_web/router.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
defmodule DiffWeb.Router do
22
use DiffWeb, :router
33
use Plug.ErrorHandler
4-
use DiffWeb.Plugs.Rollbax
54

65
import Phoenix.LiveView.Router
76

mix.exs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,22 @@ defmodule Diff.MixProject do
3434
# Type `mix help deps` for examples and options.
3535
defp deps do
3636
[
37-
{:phoenix, "~> 1.6"},
38-
{:phoenix_pubsub, "~> 2.0"},
39-
{:phoenix_html, "~> 3.2"},
37+
{:floki, "~> 0.32.0"},
4038
{:gettext, "~> 0.11"},
39+
{:git_diff, github: "ericmj/git_diff", branch: "ericmj/fix-modes"},
4140
{:goth, "~> 1.0"},
42-
{:jason, "~> 1.0"},
43-
{:plug_cowboy, "~> 2.1"},
44-
{:phoenix_live_view, "~> 0.6"},
41+
{:hackney, "~> 1.15"},
4542
{:hex_core, "~> 0.8.0"},
46-
{:rollbax, "~> 0.11.0"},
43+
{:jason, "~> 1.0"},
4744
{:logster, "~> 1.0"},
48-
{:git_diff, github: "ericmj/git_diff", branch: "ericmj/fix-modes"},
49-
{:hackney, "~> 1.15"},
50-
{:floki, "~> 0.32.0"},
45+
{:mox, "~> 1.0.0", only: :test},
46+
{:phoenix_html, "~> 3.2"},
5147
{:phoenix_live_reload, "~> 1.2", only: :dev},
52-
{:mox, "~> 1.0.0", only: :test}
48+
{:phoenix_live_view, "~> 0.6"},
49+
{:phoenix_pubsub, "~> 2.0"},
50+
{:phoenix, "~> 1.6"},
51+
{:plug_cowboy, "~> 2.1"},
52+
{:sentry, "~> 10.2"}
5353
]
5454
end
5555

0 commit comments

Comments
 (0)