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

+1-5
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

+1-1
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

-2
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

+3-4
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

+3-1
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

+2
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

+2
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

-42
This file was deleted.

lib/diff_web/router.ex

-1
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

+11-11
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

mix.lock

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
"mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"},
2222
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
2323
"mox": {:hex, :mox, "1.0.1", "b651bf0113265cda0ba3a827fcb691f848b683c373b77e7d7439910a8d754d6e", [:mix], [], "hexpm", "35bc0dea5499d18db4ef7fe4360067a59b06c74376eb6ab3bd67e6295b133469"},
24+
"nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"},
25+
"nimble_ownership": {:hex, :nimble_ownership, "0.3.2", "d4fa4056ade0ae33b5a9eb64554a1b3779689282e37513260125d2d6b32e4874", [:mix], [], "hexpm", "28b9a9f4094fda1aa8ca72f732ff3223eb54aa3eda4fed9022254de2c152b138"},
2426
"parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"},
2527
"phoenix": {:hex, :phoenix, "1.6.7", "f1de32418bbbcd471f4fe74d3860ee9c8e8c6c36a0ec173be8ff468a5d72ac90", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b354a4f11d9a2f3a380fb731042dae064f22d7aed8c7e7c024a2459f12994aad"},
2628
"phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"},
@@ -32,7 +34,7 @@
3234
"plug_cowboy": {:hex, :plug_cowboy, "2.5.2", "62894ccd601cf9597e2c23911ff12798a8a18d237e9739f58a6b04e4988899fe", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.7", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "ea6e87f774c8608d60c8d34022a7d073bd7680a0a013f049fc62bf35efea1044"},
3335
"plug_crypto": {:hex, :plug_crypto, "1.2.2", "05654514ac717ff3a1843204b424477d9e60c143406aa94daf2274fdd280794d", [:mix], [], "hexpm", "87631c7ad914a5a445f0a3809f99b079113ae4ed4b867348dd9eec288cecb6db"},
3436
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
35-
"rollbax": {:hex, :rollbax, "0.11.0", "9557935d09d154c8775fa4efc709bfacbb73f20c58a3ced31dea2a74dd6e25de", [:mix], [{:hackney, "~> 1.1", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "a74318b175aae4bdddcc1ecfdf38755df3d8143c9902b1bfd19507ac9901062d"},
37+
"sentry": {:hex, :sentry, "10.4.0", "d8ffe8ce15b4b53f5e879299c3c222324c289a47a507c0b251c4f91ce7bae9ff", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_options, "~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_ownership, "~> 0.3.0", [hex: :nimble_ownership, repo: "hexpm", optional: false]}, {:plug, "~> 1.6", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "e5f98892152879dc87363b1b7f774eeddb8cf7dddfa7355e40eba188b2cae58a"},
3638
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"},
3739
"telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"},
3840
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},

0 commit comments

Comments
 (0)