Skip to content

Commit f902cf5

Browse files
committed
Replace rollbar with sentry
1 parent 2ad2d56 commit f902cf5

File tree

11 files changed

+14
-59
lines changed

11 files changed

+14
-59
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-
- main
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
@@ -36,7 +36,7 @@ RUN mix compile
3636

3737
# build release
3838
COPY rel rel
39-
RUN mix release
39+
RUN mix do sentry.package_source_code, release
4040

4141
# prepare release image
4242
FROM alpine:${ALPINE_VERSION} AS app

config/config.exs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ config :logger, :default_formatter, format: "$metadata[$level] $message\n"
3737
# Use Jason for JSON parsing in Phoenix
3838
config :phoenix, :json_library, Jason
3939

40-
config :rollbax, enabled: false
41-
4240
# Import environment specific config. This must remain at the bottom
4341
# of this file so it overrides the configuration defined above.
4442
import_config "#{Mix.env()}.exs"

config/prod.exs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ config :logger, :default_formatter, metadata: [:request_id]
2626

2727
config :sasl, sasl_error_logger: false
2828

29-
config :rollbax,
30-
environment: "prod",
31-
enabled: true,
32-
enable_crash_reports: true
29+
config :sentry,
30+
enable_source_code_context: true,
31+
root_source_code_paths: [File.cwd!()]
3332

3433
config :phoenix, :serve_endpoints, true
3534

config/runtime.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ if config_env() == :prod do
2828
access_key_id: System.fetch_env!("PREVIEW_AWS_ACCESS_KEY_ID"),
2929
secret_access_key: System.fetch_env!("PREVIEW_AWS_ACCESS_KEY_SECRET")
3030

31-
config :rollbax,
32-
access_token: System.fetch_env!("PREVIEW_ROLLBAR_ACCESS_TOKEN")
31+
config :sentry,
32+
dsn: System.fetch_env!("PREVIEW_SENTRY_DSN"),
33+
environment_name: System.fetch_env!("PREVIEW_ENV")
3334

3435
beam_port = String.to_integer(System.fetch_env!("BEAM_PORT"))
3536

lib/preview/application.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ defmodule Preview.Application do
66
use Application
77

88
def start(_type, _args) do
9+
:logger.add_handler(:my_sentry_handler, Sentry.LoggerHandler, %{})
910
setup_tmp_dir()
1011

1112
children = [

lib/preview_web/endpoint.ex

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

45
# The session will be stored in the cookie and signed,
@@ -48,6 +49,7 @@ defmodule PreviewWeb.Endpoint do
4849
pass: ["*/*"],
4950
json_decoder: Phoenix.json_library()
5051

52+
plug Sentry.PlugContext
5153
plug Plug.MethodOverride
5254
plug Plug.Head
5355
plug Plug.Session, @session_options

lib/preview_web/plugs/rollbax.ex

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

lib/preview_web/router.ex

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

65
pipeline :browser do
76
plug :accepts, ["html"]

mix.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ defmodule Preview.MixProject do
3333
{:finch, "~> 0.19.0"},
3434
{:gettext, "~> 0.11"},
3535
{:goth, "~> 1.4"},
36+
{:hackney, "~> 1.20"},
3637
{:hex_core, "~> 0.8"},
3738
{:jason, "~> 1.0"},
3839
{:logster, "~> 1.0.0"},
@@ -49,7 +50,7 @@ defmodule Preview.MixProject do
4950
{:phoenix_view, "~> 2.0"},
5051
{:phoenix, "~> 1.7"},
5152
{:plug_cowboy, "~> 2.0"},
52-
{:rollbax, "~> 0.11.0"},
53+
{:sentry, "~> 10.8"},
5354
{:sweet_xml, "~> 0.7.0"},
5455
{:telemetry_metrics, "~> 1.0"},
5556
{:telemetry_poller, "~> 1.0"},

0 commit comments

Comments
 (0)