Skip to content

Instantly share code, notes, and snippets.

@mitchellhenke
Last active September 2, 2019 15:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchellhenke/4ab6dd8d0ebeaaf9821fb625e0037a4d to your computer and use it in GitHub Desktop.
Save mitchellhenke/4ab6dd8d0ebeaaf9821fb625e0037a4d to your computer and use it in GitHub Desktop.
Sentry 6.x to 7.x Upgrade Guide

Bump your sentry dep

def deps do
  [
    {:sentry, "~> 7.0"},
  ]
end

Configure JSON library

Sentry 7.x allows configuring which JSON library you use, and does not install a JSON library by default. Sentry will attempt to fall back to using Jason by default, but will error if it isn't available. If you already have Jason in your dependencies, you don't have to change anything. If you are using Poison or another JSON library and would like to continue using it, Sentry must be configured to use it:

config :sentry,
  # ...
  json_library: Poison

Then run mix deps.get to get the new version of Sentry!

Replacing Sentry.Logger

If you are using Sentry.Logger, replace it with Sentry.LoggerBackend:

# application.ex
     opts = [strategy: :one_for_one, name: MyApp.Supervisor]
-    :ok = :error_logger.add_report_handler(Sentry.Logger)
+    {:ok, _} = Logger.add_backend(Sentry.LoggerBackend)
     Supervisor.start_link(children, opts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment