
sentry-elixir-sdk
Full Sentry SDK setup for Elixir. Use when asked to "add Sentry to Elixir", "install sentry for Elixir", or configure error monitoring, tracing, logging, or crons for Elixir, Phoenix, or Plug applications. Supports Phoenix, Plug, LiveView, Oban, and Quantum.
- Installs
- 2K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-elixir-sdk- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads sentry-elixir-sdk automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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
sentryhex 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:
| Signal | Impact |
|---|---|
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
- ✅ Logging —
Sentry.LoggerHandlerforwards 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:
| Feature | Recommend when... |
|---|---|
| Error Monitoring | Always — non-negotiable baseline |
| Logging | Always — LoggerHandler captures crashes that aren't explicit capture_exception calls |
| Tracing | Phoenix, Plug, Ecto, or OpenTelemetry imports detected |
| Crons | Oban, Quantum, or periodic GenServer/Task patterns detected |
| Sentry Logs | sentry 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:
mix igniter.install sentryAvailable since sentry v11.0.0. It auto-configures
config/config.exs,config/prod.exs,config/runtime.exs, andlib/my_app/application.ex.Once it finishes, come back and skip to 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.PlugCaptureis only needed for the Cowboy adapter. Phoenix 1.7+ defaults to Bandit, wherePlugCaptureis harmless but unnecessary.Sentry.PlugContextis 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:
| Feature | Reference file | Load when... |
|---|---|---|
| Error Monitoring | ${SKILL_ROOT}/references/error-monitoring.md | Always (baseline) |
| Tracing | ${SKILL_ROOT}/references/tracing.md | Phoenix / Ecto / OpenTelemetry detected |
| Logging | ${SKILL_ROOT}/references/logging.md | LoggerHandler or Sentry Logs setup |
| Crons | ${SKILL_ROOT}/references/crons.md | Oban, 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
| Option | Type | Default | Purpose |
|---|---|---|---|
:dsn | string | nil | nil | SDK disabled if nil; env: SENTRY_DSN |
:environment_name | atom | string | "production" | e.g., :prod; env: SENTRY_ENVIRONMENT |
:release | string | nil | nil | e.g., "my-app@1.0.0"; env: SENTRY_RELEASE |
:sample_rate | float | 1.0 | Error event sample rate (0.0–1.0) |
:enable_source_code_context | boolean | false | Include 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} | nil | Hook to mutate or drop error events |
:after_send_event | (event, result -> any) | {m, f} | nil | Hook called after event is sent |
:filter | module | Sentry.DefaultEventFilter | Module implementing Sentry.EventFilter |
:max_breadcrumbs | integer | 100 | Max breadcrumbs per process |
:max_stacktrace_arg_length | integer | 10000 | Max length (in graphemes) of each inspected function argument in stacktrace vars (v13.2.0+) |
:dedup_events | boolean | true | Deduplicate identical events within ~30 seconds |
:tags | map | %{} | Global tags sent with every event |
:traces_sample_rate | float | nil | nil | Non-nil enables tracing (requires OTel setup) |
:traces_sampler | fn | {m, f} | nil | nil | Custom per-transaction sampling |
:enable_logs | boolean | false | Enable Sentry Logs Protocol (v12.0.0+) |
:scrubber | keyword | [] | Scrubber config (v13.1.1+); keys: :conn_private_allow_list (list of atoms kept from Plug.Conn.private) |
:test_mode | boolean | false | Capture 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
| Variable | Maps to | Purpose |
|---|---|---|
SENTRY_DSN | :dsn | Data Source Name |
SENTRY_RELEASE | :release | App version (e.g., my-app@1.0.0) |
SENTRY_ENVIRONMENT | :environment_name | Deployment 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:
- Set
config :sentry, log_level: :debugfor verbose SDK output - Verify
SENTRY_DSNis set and the project exists - Confirm
:environment_nameis 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 detected | Suggest skill |
|---|---|
| React / Next.js | sentry-react-sdk or sentry-nextjs-sdk |
| Svelte / SvelteKit | sentry-svelte-sdk |
| Vue | See docs.sentry.io/platforms/javascript/guides/vue/ |
| Other JS/TS | sentry-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
| Issue | Solution |
|---|---|
| Events not appearing | Verify SENTRY_DSN is set; run mix sentry.send_test_event; set log_level: :debug |
| Missing stack traces on captured exceptions | Pass stacktrace: __STACKTRACE__ in the rescue block: Sentry.capture_exception(e, stacktrace: __STACKTRACE__) |
PlugCapture not working on Bandit | Sentry.PlugCapture is Cowboy-only; with Bandit errors surface via LoggerHandler |
| Source code context missing in production | Run mix sentry.package_source_code before building your OTP release |
| Context not appearing on async events | Sentry.Context.* is process-scoped; pass values explicitly or propagate Logger metadata across processes |
| Oban integration not reporting crons | Requires Oban v2.17.6+ or Oban Pro; cron jobs must have "cron" => true in job meta |
| Duplicate events from Cowboy/Bandit crashes | Set excluded_domains: [:cowboy, :bandit] in LoggerHandler config (both excluded by default as of v13.1.0) |
finch not starting | Ensure {:finch, "~> 0.21"} is in deps; Finch is the default HTTP client since v12.0.0 |
| JSON encoding error | Add {:jason, "~> 1.4"} and set json_library: Jason for Elixir < 1.18 |
FAQ
What does the sentry-elixir-sdk skill do?
Full Sentry SDK setup for Elixir. Use when asked to "add Sentry to Elixir", "install sentry for Elixir", or configure error monitoring, tracing, logging, or crons for Elixir, Phoenix, or Plug applications. Supports Phoenix, Plug, LiveView, Oban, and Quantum.
How do I install sentry-elixir-sdk?
Run npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-elixir-sdk in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/sentry-elixir-sdk/ (personal) or .claude/skills/sentry-elixir-sdk/ (project).
Which AI agents can use sentry-elixir-sdk?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is sentry-elixir-sdk safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains sentry-elixir-sdk?
It is published by getsentry in getsentry/sentry-for-ai, and it is an official skill from the maker of the technology it covers. It has 2,034 recorded installs.
More from getsentry/sentry-for-ai
sentry-fix-issues
getsentry/sentry-for-ai
Find and fix issues from Sentry using MCP. Use when asked to fix Sentry errors, debug production issues, investigate exceptions, or resolve bugs reported in Sentry. Methodically analyzes stack traces, breadcrumbs, traces, and context to identify root causes.
sentry-react-native-sdk
getsentry/sentry-for-ai
Full Sentry SDK setup for React Native and Expo. Use when asked to "add Sentry to React Native", "install @sentry/react-native", "setup Sentry in Expo", or configure error monitoring, tracing, profiling, session replay, or logging for React Native applications. Supports Expo managed, Expo bare, and vanilla React Native.
sentry-create-alert
getsentry/sentry-for-ai
Create Sentry alerts using the workflow engine API. Use when asked to create alerts, set up notifications, configure issue priority alerts, or build workflow automations. Supports email, Slack, PagerDuty, Discord, and other notification actions.
sentry-nextjs-sdk
getsentry/sentry-for-ai
Full Sentry SDK setup for Next.js. Use when asked to "add Sentry to Next.js", "install @sentry/nextjs", or configure error monitoring, tracing, session replay, logging, profiling, AI monitoring, or crons for Next.js applications. Supports Next.js 13+ with App Router and Pages Router.
sentry-sdk-setup
getsentry/sentry-for-ai
Set up Sentry in any language or framework. Detects the user's platform and loads the right SDK skill. Use when asked to add Sentry, install an SDK, or set up error monitoring in a project.
sentry-workflow
getsentry/sentry-for-ai
Keep Sentry SDKs up to date. Use when asked to upgrade the Sentry SDK across major versions, migrate SDK versions, or fix deprecated APIs.
Popular devops & cloud skills
microsoft-foundry
microsoft/azure-skills
Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure
azure-diagnostics
microsoft/azure-skills
Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.
azure-prepare
microsoft/azure-skills
Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.
azure-ai
microsoft/azure-skills
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.
azure-deploy
microsoft/azure-skills
Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.
azure-validate
microsoft/azure-skills
Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.