Better Sentry tracking

This commit is contained in:
Uku Taht 2021-04-23 11:56:41 +03:00
parent fbe6ab9b61
commit 7982c236c1
6 changed files with 11 additions and 6 deletions

View File

@ -41,7 +41,9 @@ COPY lib ./lib
RUN npm run deploy --prefix ./assets && \
npm run deploy --prefix ./tracker && \
mix phx.digest priv/static && \
mix download_country_database
mix download_country_database && \
# https://hexdocs.pm/sentry/Sentry.Sources.html#module-source-code-storage
mix sentry_recompile
WORKDIR /app
COPY rel rel

View File

@ -112,7 +112,9 @@ config :sentry,
environment_name: env,
included_environments: ["prod", "staging"],
release: app_version,
tags: %{app_version: app_version}
tags: %{app_version: app_version},
enable_source_code_context: true,
root_source_code_path: [File.cwd!()]
config :plausible, :paddle, vendor_auth_code: paddle_auth_code

View File

@ -21,7 +21,7 @@ defmodule Plausible.Application do
]
opts = [strategy: :one_for_one, name: Plausible.Supervisor]
{:ok, _} = Logger.add_backend(Sentry.LoggerBackend)
Logger.add_backend(Sentry.LoggerBackend)
setup_cache_stats()
Application.put_env(:plausible, :server_start, Timex.now())
Supervisor.start_link(children, opts)

View File

@ -1,6 +1,6 @@
defmodule PlausibleWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :plausible
use Sentry.PlugCapture
use Phoenix.Endpoint, otp_app: :plausible
# Serve at "/" the static files from "priv/static" directory.
#

View File

@ -20,7 +20,7 @@ defmodule PlausibleWeb.AuthPlug do
)
if user do
Sentry.Context.set_user_context(%{id: user.id, name: user.name})
Sentry.Context.set_user_context(%{id: user.id, name: user.name, email: user.email})
assign(conn, :current_user, user)
else
conn

View File

@ -102,7 +102,8 @@ defmodule Plausible.MixProject do
[
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
"ecto.reset": ["ecto.drop", "ecto.setup"],
test: ["ecto.create --quiet", "ecto.migrate", "test", "clean_clickhouse"]
test: ["ecto.create --quiet", "ecto.migrate", "test", "clean_clickhouse"],
sentry_recompile: ["compile", "deps.compile sentry --force"]
]
end
end