Skip to content

Commit

Permalink
Replace rollbar with sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmj committed Dec 16, 2024
1 parent 2ad2d56 commit f902cf5
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 59 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: CI

on:
pull_request:
push:
branches:
- main
on: [push, pull_request]

jobs:
test:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ RUN mix compile

# build release
COPY rel rel
RUN mix release
RUN mix do sentry.package_source_code, release

# prepare release image
FROM alpine:${ALPINE_VERSION} AS app
Expand Down
2 changes: 0 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ config :logger, :default_formatter, format: "$metadata[$level] $message\n"
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason

config :rollbax, enabled: false

# 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"
7 changes: 3 additions & 4 deletions config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ config :logger, :default_formatter, metadata: [:request_id]

config :sasl, sasl_error_logger: false

config :rollbax,
environment: "prod",
enabled: true,
enable_crash_reports: true
config :sentry,
enable_source_code_context: true,
root_source_code_paths: [File.cwd!()]

config :phoenix, :serve_endpoints, true

Expand Down
5 changes: 3 additions & 2 deletions config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ if config_env() == :prod do
access_key_id: System.fetch_env!("PREVIEW_AWS_ACCESS_KEY_ID"),
secret_access_key: System.fetch_env!("PREVIEW_AWS_ACCESS_KEY_SECRET")

config :rollbax,
access_token: System.fetch_env!("PREVIEW_ROLLBAR_ACCESS_TOKEN")
config :sentry,
dsn: System.fetch_env!("PREVIEW_SENTRY_DSN"),
environment_name: System.fetch_env!("PREVIEW_ENV")

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

Expand Down
1 change: 1 addition & 0 deletions lib/preview/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ defmodule Preview.Application do
use Application

def start(_type, _args) do
:logger.add_handler(:my_sentry_handler, Sentry.LoggerHandler, %{})
setup_tmp_dir()

children = [
Expand Down
2 changes: 2 additions & 0 deletions lib/preview_web/endpoint.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule PreviewWeb.Endpoint do
use Sentry.PlugCapture
use Phoenix.Endpoint, otp_app: :preview

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

plug Sentry.PlugContext
plug Plug.MethodOverride
plug Plug.Head
plug Plug.Session, @session_options
Expand Down
42 changes: 0 additions & 42 deletions lib/preview_web/plugs/rollbax.ex

This file was deleted.

1 change: 0 additions & 1 deletion lib/preview_web/router.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
defmodule PreviewWeb.Router do
use PreviewWeb, :router
use Plug.ErrorHandler
use PreviewWeb.Plugs.Rollbax

pipeline :browser do
plug :accepts, ["html"]
Expand Down
3 changes: 2 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ defmodule Preview.MixProject do
{:finch, "~> 0.19.0"},
{:gettext, "~> 0.11"},
{:goth, "~> 1.4"},
{:hackney, "~> 1.20"},
{:hex_core, "~> 0.8"},
{:jason, "~> 1.0"},
{:logster, "~> 1.0.0"},
Expand All @@ -49,7 +50,7 @@ defmodule Preview.MixProject do
{:phoenix_view, "~> 2.0"},
{:phoenix, "~> 1.7"},
{:plug_cowboy, "~> 2.0"},
{:rollbax, "~> 0.11.0"},
{:sentry, "~> 10.8"},
{:sweet_xml, "~> 0.7.0"},
{:telemetry_metrics, "~> 1.0"},
{:telemetry_poller, "~> 1.0"},
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"plug_cowboy": {:hex, :plug_cowboy, "2.7.2", "fdadb973799ae691bf9ecad99125b16625b1c6039999da5fe544d99218e662e4", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "245d8a11ee2306094840c000e8816f0cbed69a23fc0ac2bcf8d7835ae019bb2f"},
"plug_crypto": {:hex, :plug_crypto, "2.1.0", "f44309c2b06d249c27c8d3f65cfe08158ade08418cf540fd4f72d4d6863abb7b", [:mix], [], "hexpm", "131216a4b030b8f8ce0f26038bc4421ae60e4bb95c5cf5395e1421437824c4fa"},
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
"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"},
"saxy": {:hex, :saxy, "1.6.0", "02cb4e9bd045f25ac0c70fae8164754878327ee393c338a090288210b02317ee", [:mix], [], "hexpm", "ef42eb4ac983ca77d650fbdb68368b26570f6cc5895f0faa04d34a6f384abad3"},
"sentry": {:hex, :sentry, "10.8.1", "aa45309785e1521416225adb16e0b4d8b957578804527f3c7babb6fefbc5e456", [: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 or ~> 1.0", [hex: :nimble_ownership, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.6", [hex: :phoenix, repo: "hexpm", optional: true]}, {:phoenix_live_view, "~> 0.20 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.6", [hex: :plug, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "495b3cdadad90ba72eef973aa3dec39b3b8b2a362fe87e2f4ef32133ac3b4097"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"},
"sweet_xml": {:hex, :sweet_xml, "0.7.4", "a8b7e1ce7ecd775c7e8a65d501bc2cd933bff3a9c41ab763f5105688ef485d08", [:mix], [], "hexpm", "e7c4b0bdbf460c928234951def54fe87edf1a170f6896675443279e2dbeba167"},
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
Expand Down

0 comments on commit f902cf5

Please sign in to comment.