Skip to content

Commit

Permalink
Replace rollbax with sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmj committed Dec 15, 2024
1 parent 6485b9d commit 9ed2687
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 74 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM hexpm/elixir:1.17.3-erlang-27.1.2-alpine-3.20.3 as build
FROM hexpm/elixir:1.17.3-erlang-27.1.2-alpine-3.20.3 AS build

# install build dependencies
RUN apk add --no-cache --update git
Expand Down Expand Up @@ -27,7 +27,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:3.20.3 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 :hexdocs, :docs_private_bucket, name: "hexdocs-private-staging"

config :hexdocs, :docs_public_bucket, name: "hexdocs-public-staging"

config :rollbax, enabled: false

config :logger, :console, format: "[$level] $metadata$message\n"

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 @@ -17,10 +17,9 @@ config :hexdocs, :docs_public_bucket, implementation: Hexdocs.Store.GS
config :ex_aws,
json_codec: Jason

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

config :sasl, sasl_error_logger: false

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

config :rollbax,
access_token: System.fetch_env!("HEXDOCS_ROLLBAR_ACCESS_TOKEN")
config :sentry,
dsn: System.fetch_env!("HEXDOCS_SENTRY_DSN"),
environment_name: System.fetch_env!("HEXDOCS_ENV")

config :kernel,
inet_dist_listen_min: String.to_integer(System.fetch_env!("BEAM_PORT")),
Expand Down
1 change: 1 addition & 0 deletions lib/hexdocs/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ defmodule Hexdocs.Application do

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

port = String.to_integer(Application.get_env(:hexdocs, :port))
cowboy_options = [port: port]
Expand Down
5 changes: 4 additions & 1 deletion lib/hexdocs/plug.ex
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
defmodule Hexdocs.Plug do
use Plug.Builder
use Plug.ErrorHandler
use Hexdocs.Plug.Rollbax
require Logger

@key_html_fresh_time 60
@key_asset_fresh_time 120
@key_lifetime 60 * 60 * 24 * 29

use Sentry.PlugCapture

if Mix.env() == :dev do
use Plug.Debugger, otp_app: :my_app
end
Expand All @@ -28,6 +29,8 @@ defmodule Hexdocs.Plug do
plug(Logster.Plugs.Logger, excludes: [:params])
end

plug(Sentry.PlugContext)

plug(Plug.Head)

if Mix.env() == :prod do
Expand Down
42 changes: 0 additions & 42 deletions lib/hexdocs/plug/rollbax.ex

This file was deleted.

2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ defmodule Hexdocs.MixProject do
{:jason, "~> 1.1"},
{:logster, "~> 1.0"},
{:plug_cowboy, "~> 2.0"},
{:rollbax, "~> 0.11.0"},
{:sentry, "~> 10.0"},
{:ssl_verify_fun, "~> 1.1", manager: :rebar3, override: true},
{:sweet_xml, "~> 0.7.0"},
{:hex_core, "~> 0.9.0", only: [:dev, :test]},
Expand Down
36 changes: 16 additions & 20 deletions mix.lock

Large diffs are not rendered by default.

0 comments on commit 9ed2687

Please sign in to comment.