By sergical
Sentry AI Agent Monitoring for Claude Code — traces sessions and tool calls as OpenTelemetry spans in Sentry.
Sentry AI Agent Monitoring plugin for Claude Code. Traces sessions and tool calls as OpenTelemetry spans in Sentry.
Each Claude Code session becomes a root invoke_agent span with child execute_tool spans for every tool call. See your sessions in the Sentry AI Agents dashboard.
Quick start (load for one session):
claude --plugin-dir /path/to/claude-code-sentry-monitor
Permanent install (inside Claude Code):
/plugin marketplace add sergical/claude-code-sentry-monitor
/plugin install claude-code-sentry-monitor
Dependencies auto-install on first hook invocation.
Inside Claude Code, run the setup wizard skill:
"Set up Sentry monitoring"
Or create the config manually:
mkdir -p ~/.config/claude-code
cat > ~/.config/claude-code/sentry-monitor.json << 'EOF'
{
"dsn": "https://[email protected]/456",
"tags": {
"developer": "your-name"
}
}
EOF
This is a developer-level tool — config is global (per-machine), not per-project.
Config is loaded from the first file found (in order):
CLAUDE_SENTRY_CONFIG env var (explicit path)~/.config/claude-code/sentry-monitor.json (main config)~/.config/sentry-claude/config (legacy KEY=VALUE format, for migration)| Field | Default | Description |
|---|---|---|
dsn | required | Sentry DSN from Project Settings → Client Keys |
tracesSampleRate | 1 | Fraction of sessions to trace (0-1) |
recordInputs | true | Record tool inputs as span attributes |
recordOutputs | true | Record tool outputs as span attributes |
maxAttributeLength | 12000 | Max characters per span attribute |
enableMetrics | false | Emit Sentry metrics for token usage |
environment | — | Environment tag on spans |
tags | {} | Custom key-value tags on every span |
mode | batch | batch (process at session end) or realtime (local HTTP server) |
Each setting can be overridden via env var:
| Env var | Overrides |
|---|---|
CLAUDE_SENTRY_DSN / SENTRY_DSN | dsn |
CLAUDE_SENTRY_TRACES_SAMPLE_RATE | tracesSampleRate |
CLAUDE_SENTRY_RECORD_INPUTS | recordInputs |
CLAUDE_SENTRY_RECORD_OUTPUTS | recordOutputs |
CLAUDE_SENTRY_MAX_ATTRIBUTE_LENGTH | maxAttributeLength |
CLAUDE_SENTRY_ENABLE_METRICS | enableMetrics |
CLAUDE_SENTRY_TAGS | tags (format: key1:val1,key2:val2) |
CLAUDE_SENTRY_MODE | mode |
SENTRY_ENVIRONMENT | environment |
SENTRY_RELEASE | release |
The plugin registers four hooks:
invoke_agent spanexecute_tool spanIn batch mode (default), events are written to a JSONL file and processed at session end. In realtime mode, events are POSTed to a local HTTP collector server.
api_key, token, secret, password, authorization, cookie, session, bearer) are automatically redacted from tool inputs/outputsmaxAttributeLength (default 12000 chars)recordInputs: false and recordOutputs: false to suppress all tool data# Install dev dependencies
npm install
# Type-check
npm run typecheck
# Build (compiles src/ → scripts/)
npm run build
MIT
Matches all tools
Hooks run on every tool call, not just specific ones
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub sergical/claude-code-sentry-monitor --plugin claude-code-sentry-monitorAutomatic tracing of Claude Code sessions to Arize AX or Phoenix with OpenInference spans. Supports 9 hooks for comprehensive observability.
Claude Code skill pack for Sentry (30 skills)
Send Claude Code session telemetry to Grafana Sigil
Observability hooks for Claude Code: comprehensive event logging, performance metrics, and session diagnostics. Provides full audit trail of all Claude Code interactions without modifying behavior.
Traces Claude Code conversations to LangSmith, including subagent and tool executions
OTel + Hooks analytics for Claude Code. Run /init-claudalytics to configure telemetry and hooks capture for this project.