Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
getsentry avatar

Sentry Elixir Sdk

  • 1.6k installs
  • 243 repo stars
  • Updated July 27, 2026
  • getsentry/sentry-for-ai

Complete Sentry SDK setup for Elixir: error monitoring, logging, tracing, crons. Detects project deps, recommends baseline + optional features, guides Igniter installer or manual config, verifies with test event.

About

The Sentry Elixir SDK is an opinionated installer and configuration guide for complete error monitoring in Elixir, Phoenix, and Plug applications. Developers use it to capture unhandled exceptions, forward crash reports via LoggerHandler, trace HTTP requests and database queries through OpenTelemetry, and detect silent failures in scheduled jobs (Oban, Quantum, GenServer). The skill detects existing dependencies, recommends baseline (error monitoring + logging) and optional features (tracing, crons, Sentry Logs), and walks through either the Igniter interactive installer or manual setup in mix.exs, config/config.exs, and lib/my_app/application.ex. Includes Phoenix endpoint and LiveView hooks, runtime config for DSN/release, and verification via mix sentry.send_test_event.

  • Detect Elixir version, Phoenix, LiveView, Oban, Quantum, and OpenTelemetry in mix.exs; skip install if Sentry already pr
  • Always recommend error monitoring + logging; propose tracing (if Phoenix/Ecto/OTel detected) and crons (if Oban/Quantum
  • Igniter installer (sentry v11.0.0+) auto-configures config/ files and Application.start/2; manual setup in 5 steps if sk
  • Add Sentry.PlugCapture (Cowboy only) and Sentry.PlugContext to endpoint; add Sentry.LiveViewHook to live_view macro for
  • Verify with mix sentry.send_test_event; cross-link to React/Next.js/Svelte SDK if frontend directory detected for distri

Sentry Elixir Sdk by the numbers

  • 1,601 all-time installs (skills.sh)
  • +41 installs in the week ending Jul 28, 2026 (Skillselion tracking)
  • Ranked #298 of 4,386 Backend & APIs skills by installs in the Skillselion catalog
  • Security screen: MEDIUM risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

sentry-elixir-sdk capabilities & compatibility

Sentry free tier; pay-as-you-grow after 10k events/month

Capabilities
detect elixir project dependencies and versions · guide igniter installer or manual sdk setup · configure error monitoring, logging, tracing, cr · generate config/config.exs and runtime.exs snipp · add phoenix plugs and liveview hooks · verify sdk with test event · cross link frontend sdks for distributed tracing · troubleshoot missing events, stack traces, conte
Works with
sentry
Use cases
debugging
Platforms
macOS · Windows · Linux · WSL
Runs
Remote server
Pricing
Free
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-elixir-sdk

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1.6k
repo stars243
Security audit3 / 3 scanners passed
Last updatedJuly 27, 2026
Repositorygetsentry/sentry-for-ai

What it does

Configure error monitoring, tracing, logging, and cron tracking in Elixir and Phoenix applications via Sentry SDK.

Who is it for?

Teams running Phoenix/Plug applications who need centralized error monitoring, request tracing, and scheduled job observability.

Skip if: Pure command-line CLI tools; serverless functions (use platform-specific SDKs); applications without HTTP or job scheduling.

When should I use this skill?

User asks to 'add Sentry to Elixir', 'set up Sentry', 'install sentry hex package', or configure error monitoring/tracing/logging/crons in Elixir or Phoenix.

What you get

Error events and logs stream to Sentry dashboard; tracing shows HTTP-to-database request flow; cron failures surface with stack traces; distributed tracing connects Phoenix backend to JavaScript frontend.

  • Sentry dependency in mix.exs
  • config/config.exs with dsn, environment_name, in_app_otp_apps
  • config/runtime.exs with SENTRY_DSN and release

By the numbers

  • Sentry Elixir SDK v13.2.0 requires Elixir ~> 1.13
  • Igniter installer available since sentry v11.0.0
  • Default max_breadcrumbs is 100 per process

Files

SKILL.mdMarkdownGitHub ↗
All Skills > SDK Setup > Elixir SDK

Sentry Elixir SDK

Opinionated wizard that scans your Elixir project and guides you through complete Sentry setup.

Invoke This Skill When

  • User asks to "add Sentry to Elixir" or "set up Sentry" in an Elixir or Phoenix app
  • User wants error monitoring, tracing, logging, or crons in Elixir or Phoenix
  • User mentions sentry hex package, getsentry/sentry-elixir, or Elixir Sentry SDK
  • User wants to monitor exceptions, Plug errors, LiveView errors, or scheduled jobs
Note: SDK versions and APIs below reflect Sentry docs at time of writing (sentry v13.2.0, requires Elixir ~> 1.13).
Always verify against docs.sentry.io/platforms/elixir/ before implementing.

---

Phase 1: Detect

Run these commands to understand the project before making any recommendations:

# Check existing Sentry dependency
grep -i sentry mix.exs 2>/dev/null

# Detect Elixir version
cat .tool-versions 2>/dev/null | grep elixir
grep "elixir:" mix.exs 2>/dev/null

# Detect Phoenix or Plug
grep -E '"phoenix"|"plug"' mix.exs 2>/dev/null

# Detect Phoenix LiveView
grep "phoenix_live_view" mix.exs 2>/dev/null

# Detect Oban (job queue / crons)
grep "oban" mix.exs 2>/dev/null

# Detect Quantum (cron scheduler)
grep "quantum" mix.exs 2>/dev/null

# Detect OpenTelemetry usage
grep "opentelemetry" mix.exs 2>/dev/null

# Check for companion frontend
ls assets/ frontend/ web/ client/ 2>/dev/null

What to note:

SignalImpact
sentry already in mix.exs?Skip install; go to Phase 2 (configure features)
Phoenix detected?Add Sentry.PlugCapture, Sentry.PlugContext, optionally Sentry.LiveViewHook
LiveView detected?Add Sentry.LiveViewHook to the live_view macro in my_app_web.ex
Oban detected?Recommend Crons + error capture via Oban integration
Quantum detected?Recommend Crons via Quantum integration
OpenTelemetry already present?Tracing setup only needs Sentry.OpenTelemetry.* config
Frontend directory found?Trigger Phase 4 cross-link suggestion

---

Phase 2: Recommend

Based on what you found, present a concrete recommendation. Don't ask open-ended questions — lead with a proposal:

Recommended (core coverage):

  • Error Monitoring — always; captures exceptions and crash reports
  • LoggingSentry.LoggerHandler forwards crash reports and error logs to Sentry
  • Tracing — if Phoenix, Plug, or Ecto detected (via OpenTelemetry)

Optional (enhanced observability):

  • Crons — detect silent failures in scheduled jobs (Oban, Quantum, or manual GenServer)
  • Sentry Logs — forward structured logs to Sentry Logs Protocol (sentry v12.0.0+)

Recommendation logic:

FeatureRecommend when...
Error MonitoringAlways — non-negotiable baseline
LoggingAlwaysLoggerHandler captures crashes that aren't explicit capture_exception calls
TracingPhoenix, Plug, Ecto, or OpenTelemetry imports detected
CronsOban, Quantum, or periodic GenServer/Task patterns detected
Sentry Logssentry v12.0.0+ in use and structured log search is needed

Propose: "I recommend setting up Error Monitoring + Logging [+ Tracing if Phoenix/Ecto detected]. Want me to also add Crons or Sentry Logs?"

---

Phase 3: Guide

Option 1: Igniter Installer (Recommended)

You need to run this yourself — the Igniter installer requires interactive terminal input that the agent can't handle. Copy-paste into your terminal:

>

```bash
mix igniter.install sentry
```

>

Available since sentry v11.0.0. It auto-configures config/config.exs, config/prod.exs, config/runtime.exs, and lib/my_app/application.ex.

>

Once it finishes, come back and skip to [Verification](#verification).

If the user skips the Igniter installer, proceed with Option 2 (Manual Setup) below.

---

Option 2: Manual Setup

Install

Add to mix.exs dependencies:

# mix.exs
defp deps do
  [
    {:sentry, "~> 13.0"},
    {:finch, "~> 0.21"}
    # Add jason if using Elixir < 1.18:
    # {:jason, "~> 1.4"},
  ]
end
mix deps.get
Configure
# config/config.exs
config :sentry,
  dsn: System.get_env("SENTRY_DSN"),
  environment_name: config_env(),
  enable_source_code_context: true,
  root_source_code_paths: [File.cwd!()],
  in_app_otp_apps: [:my_app]

For runtime configuration (recommended for DSN and release):

# config/runtime.exs
import Config

config :sentry,
  dsn: System.fetch_env!("SENTRY_DSN"),
  release: System.get_env("SENTRY_RELEASE", "my-app@#{Application.spec(:my_app, :vsn)}")
Quick Start — Recommended Init Config

This config enables the most features with sensible defaults:

# config/config.exs
config :sentry,
  dsn: System.get_env("SENTRY_DSN"),
  environment_name: config_env(),
  enable_source_code_context: true,
  root_source_code_paths: [File.cwd!()],
  in_app_otp_apps: [:my_app],
  # Logger handler config — captures crash reports
  logger: [
    {:handler, :sentry_handler, Sentry.LoggerHandler, %{
      config: %{
        metadata: [:request_id],
        capture_log_messages: true,
        level: :error
      }
    }}
  ]
Activate Logger Handler

Add Logger.add_handlers/1 in Application.start/2:

# lib/my_app/application.ex
def start(_type, _args) do
  Logger.add_handlers(:my_app)   # activates the :sentry_handler configured above

  children = [
    MyAppWeb.Endpoint
    # ... other children
  ]

  Supervisor.start_link(children, strategy: :one_for_one)
end
Phoenix Integration

`lib/my_app_web/endpoint.ex`

defmodule MyAppWeb.Endpoint do
  use Sentry.PlugCapture          # Add ABOVE use Phoenix.Endpoint (Cowboy adapter only)
  use Phoenix.Endpoint, otp_app: :my_app

  # ...

  plug Plug.Parsers,
    parsers: [:urlencoded, :multipart, :json],
    pass: ["*/*"],
    json_decoder: Phoenix.json_library()

  plug Sentry.PlugContext          # Add BELOW Plug.Parsers
  # ...
end
Note: Sentry.PlugCapture is only needed for the Cowboy adapter. Phoenix 1.7+ defaults to Bandit, where PlugCapture is harmless but unnecessary. Sentry.PlugContext is always recommended — it enriches events with HTTP request data.

LiveView errors — `lib/my_app_web.ex`

def live_view do
  quote do
    use Phoenix.LiveView

    on_mount Sentry.LiveViewHook   # captures errors in mount/handle_event/handle_info
  end
end
Plain Plug Application
defmodule MyApp.Router do
  use Plug.Router
  use Sentry.PlugCapture          # Cowboy only

  plug Plug.Parsers, parsers: [:urlencoded, :multipart]
  plug Sentry.PlugContext
  # ...
end

For Each Agreed Feature

Walk through features one at a time. Load the reference file for each, follow its steps, and verify before moving to the next:

FeatureReference fileLoad when...
Error Monitoring${SKILL_ROOT}/references/error-monitoring.mdAlways (baseline)
Tracing${SKILL_ROOT}/references/tracing.mdPhoenix / Ecto / OpenTelemetry detected
Logging${SKILL_ROOT}/references/logging.mdLoggerHandler or Sentry Logs setup
Crons${SKILL_ROOT}/references/crons.mdOban, Quantum, or periodic jobs detected

For each feature: Read ${SKILL_ROOT}/references/<feature>.md, follow steps exactly, verify it works.

---

Configuration Reference

Key Config Options

OptionTypeDefaultPurpose
:dsn`string \nil`nil
:environment_name`atom \string`"production"
:release`string \nil`nil
:sample_ratefloat1.0Error event sample rate (0.0–1.0)
:enable_source_code_contextbooleanfalseInclude source lines around errors
:root_source_code_paths[path][]Required when source context is enabled
:in_app_otp_apps[atom][]OTP apps whose modules are "in-app" in stacktraces
:before_send`(event -> event \nil) \{m, f}`
:after_send_event`(event, result -> any) \{m, f}`nil
:filtermoduleSentry.DefaultEventFilterModule implementing Sentry.EventFilter
:max_breadcrumbsinteger100Max breadcrumbs per process
:max_stacktrace_arg_lengthinteger10000Max length (in graphemes) of each inspected function argument in stacktrace vars (v13.2.0+)
:dedup_eventsbooleantrueDeduplicate identical events within ~30 seconds
:tagsmap%{}Global tags sent with every event
:traces_sample_rate`float \nil`nil
:traces_sampler`fn \{m, f} \nil`
:enable_logsbooleanfalseEnable Sentry Logs Protocol (v12.0.0+)
:scrubberkeyword[]Scrubber config (v13.1.1+); keys: :conn_private_allow_list (list of atoms kept from Plug.Conn.private)
:test_modebooleanfalseCapture events in-memory for testing

Default PII Guidance

Most Sentry SDKs expose a send-default-PII option. As of sentry v12, the Elixir SDK does not expose a send_default_pii config option in its documented option list or current config schema, so do not add a non-existent option. For richer user context, use Sentry.PlugContext and explicitly set allowed fields with Sentry.Context.set_user_context/1, then scrub with :before_send if needed. If a future Elixir SDK release adds send_default_pii, recommend setting it.

Automatic PII Scrubbing: As of v13.1.0, stacktrace frame variables and FunctionClauseError/Phoenix.ActionClauseError arguments are automatically scrubbed for sensitive data using the same scrubber rules as HTTP request data. Use :scrubber config to customize which Plug.Conn.private keys are retained.

Environment Variables

VariableMaps toPurpose
SENTRY_DSN:dsnData Source Name
SENTRY_RELEASE:releaseApp version (e.g., my-app@1.0.0)
SENTRY_ENVIRONMENT:environment_nameDeployment environment

---

Verification

Test that Sentry is receiving events:

# Send a test event from your project
MIX_ENV=dev mix sentry.send_test_event

Or add a temporary call in a controller action:

# Temporary test — remove after confirming
def index(conn, _params) do
  Sentry.capture_message("Sentry Elixir SDK test event")
  text(conn, "sent")
end

Check the Sentry dashboard within a few seconds. If nothing appears: 1. Set config :sentry, log_level: :debug for verbose SDK output 2. Verify SENTRY_DSN is set and the project exists 3. Confirm :environment_name is not set to a value Sentry filters in your alert rules

---

Phase 4: Cross-Link

After completing Elixir setup, check for a companion frontend missing Sentry coverage:

ls assets/ frontend/ web/ client/ ui/ 2>/dev/null
cat assets/package.json frontend/package.json 2>/dev/null | grep -E '"react"|"svelte"|"vue"|"next"'

If a frontend directory exists without Sentry configured, suggest the matching skill:

Frontend detectedSuggest skill
React / Next.jssentry-react-sdk or sentry-nextjs-sdk
Svelte / SvelteKitsentry-svelte-sdk
VueSee docs.sentry.io/platforms/javascript/guides/vue/
Other JS/TSsentry-browser-sdk

Connecting Phoenix backend and JavaScript frontend with linked Sentry projects enables distributed tracing — stack traces that span the browser, Phoenix HTTP server, and downstream services in a single trace view.

---

Troubleshooting

IssueSolution
Events not appearingVerify SENTRY_DSN is set; run mix sentry.send_test_event; set log_level: :debug
Missing stack traces on captured exceptionsPass stacktrace: __STACKTRACE__ in the rescue block: Sentry.capture_exception(e, stacktrace: __STACKTRACE__)
PlugCapture not working on BanditSentry.PlugCapture is Cowboy-only; with Bandit errors surface via LoggerHandler
Source code context missing in productionRun mix sentry.package_source_code before building your OTP release
Context not appearing on async eventsSentry.Context.* is process-scoped; pass values explicitly or propagate Logger metadata across processes
Oban integration not reporting cronsRequires Oban v2.17.6+ or Oban Pro; cron jobs must have "cron" => true in job meta
Duplicate events from Cowboy/Bandit crashesSet excluded_domains: [:cowboy, :bandit] in LoggerHandler config (both excluded by default as of v13.1.0)
finch not startingEnsure {:finch, "~> 0.21"} is in deps; Finch is the default HTTP client since v12.0.0
JSON encoding errorAdd {:jason, "~> 1.4"} and set json_library: Jason for Elixir < 1.18

Related skills

How it compares

Pick sentry-elixir-sdk over generic Sentry error setup when scheduled Elixir jobs fail silently without exceptions.

FAQ

Do I need the Igniter installer or can I set up Sentry manually?

Igniter (sentry v11.0.0+) is recommended — it auto-configures config/ and Application.start/2 interactively. If you prefer manual setup, follow the 5-step guide: add to mix.exs, configure DSN/env, activate LoggerHandler in application.ex, add PlugCapture/PlugContext to endpoint,

What is LoggerHandler and when is it activated?

LoggerHandler is Sentry.LoggerHandler configured in config/config.exs and activated with Logger.add_handlers(:my_app) in Application.start/2. It forwards crash reports and error-level logs to Sentry, capturing exceptions that aren't explicit Sentry.capture_exception/2 calls.

How do I enable tracing and what are the prerequisites?

Set :traces_sample_rate to a float > 0.0 in config.exs, ensure OpenTelemetry is detected in mix.exs, and load references/tracing.md for Ecto/HTTP adapter setup. Tracing connects HTTP requests to database queries and downstream services in a single trace view.

Is Sentry Elixir Sdk safe to install?

skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.

Backend & APIsmonitoringinfra

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.