# Sends an error, a message and a cron check-in with the real sentry-elixir
# (from SENTRY_ELIXIR_PATH, the reference checkout) to SENTRY_DSN, waiting
# for each answer (`result: :sync`), and prints what the SDK got back. Run
# by VigilWeb.SdkConformanceTest; the install is cached by Mix after the
# first run. The DSN comes from the environment, not Mix.install's config,
# so a new DSN doesn't mean a new install.
Mix.install([
{:sentry, path: System.fetch_env!("SENTRY_ELIXIR_PATH")},
{:jason, "~> 1.4"},
{:finch, "~> 0.21"}
])
Application.put_env(:sentry, :dsn, System.fetch_env!("SENTRY_DSN"))
Application.put_env(:sentry, :environment_name, "test")
Application.put_env(:sentry, :release, "vigil-test@1.0")
report = fn label, result -> IO.puts("#{label}: #{inspect(result)}") end
exception =
try do
raise ArgumentError, "boom from elixir"
rescue
e -> e
end
report.("exception", Sentry.capture_exception(exception, result: :sync))
report.("message", Sentry.capture_message("hello from elixir", result: :sync))
report.(
"check_in",
Sentry.capture_check_in(
status: :ok,
monitor_slug: "vigil-nightly",
monitor_config: [schedule: [type: :crontab, value: "0 3 * * *"]]
)
)
# Check-ins (and logs) go through sentry-elixir's telemetry queue: the
# {:ok, check_in_id} above is the SDK's own, given before anything is sent.
# Flush it before exiting, or the check-in can be lost with the VM.
Sentry.flush(timeout: 10_000)
neiam
/vigil
public · Issues · Pulls · Labels · Forks · Compare · Actions queued · Badges · Packages
⭐
Log in to mark this repository.
1.4 KiB · text
History
1a4b866