-
-
Notifications
You must be signed in to change notification settings - Fork 239
feat: add debugging/triage CLI commands #3087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add IssueDetails, IssueLatestEvent, IssueTagValues, TraceMeta, TraceSpan, and EventAttachment structs for the new debugging CLI commands.
Add get_issue_details, get_issue_latest_event, list_issue_events, and get_issue_tag_values methods to AuthenticatedApi.
Add get_trace_meta, get_trace, list_event_attachments, and download_event_attachment methods to AuthenticatedApi.
Add 'sentry-cli issues info <issue-id>' command to get detailed information about a specific issue including the latest event.
Add 'sentry-cli issues events <issue-id>' command to list events within a specific issue with filtering options.
Add 'sentry-cli issues tags <issue-id> --key <tag>' command to get tag value distribution for a specific issue.
Add 'sentry-cli traces info <trace-id>' command to get trace details including span tree and error information.
Add 'sentry-cli events attachment <event-id> [attachment-id]' command to list or download event attachments.
Contributor
|
Member
Author
|
We gonna close this - it was a POC how much it takes to get this running but we want to focus on making our MCP to be the interface agents interface with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add 5 new debugging/triage commands to sentry-cli that mirror the functionality of sentry-mcp tools. These commands expose Sentry's issue investigation capabilities directly from the CLI.
New Commands
sentry-cli issues info <id>sentry-cli issues events <id>sentry-cli issues tags <id> --key <key>sentry-cli traces info <id>sentry-cli events attachment <id> [att-id]Example Usage
API Endpoints Used
All commands use standard Sentry REST API endpoints:
/organizations/{org}/issues/{id}//organizations/{org}/issues/{id}/events//organizations/{org}/issues/{id}/events/latest//organizations/{org}/issues/{id}/tags/{key}//organizations/{org}/events-trace-meta/{id}//organizations/{org}/events-trace/{id}//projects/{org}/{project}/events/{id}/attachments/Files Changed
src/api/mod.rs- Added 7 data types + 8 API methodssrc/commands/issues/info.rs- NEWsrc/commands/issues/events.rs- NEWsrc/commands/issues/tags.rs- NEWsrc/commands/traces/mod.rs- NEWsrc/commands/events/attachment.rs- NEWsrc/commands/mod.rs- Registered traces commandTest plan
cargo buildsucceedscargo clippypasses--helpcommands display correctlyDesign
Sentry CLI Debugging/Triage Commands Design
Overview
Add debugging and triage commands to sentry-cli that mirror the functionality of sentry-mcp tools. These commands expose Sentry's issue investigation capabilities directly from the CLI, primarily for agent consumption.
Goal
Surface 5 MCP-equivalent debugging tools in sentry-cli:
get_issue_details→sentry-cli issues infolist_issue_events→sentry-cli issues eventsget_issue_tag_values→sentry-cli issues tagsget_trace_details→sentry-cli traces infoget_event_attachment→sentry-cli events attachmentCommands
sentry-cli issues info <issue-id>Get detailed information about a specific issue including the latest event.
Arguments:
issue_id(required) - Issue ID (e.g., PROJ-123 or full UUID)--org- Organization slug (or from config)Output:
sentry-cli issues events <issue-id>List events within a specific issue.
Arguments:
issue_id(required) - Issue ID--org- Organization slug--limit- Max events to return (default 50)--sort- Sort field (default "-timestamp")--period- Time period (default "14d")Output:
sentry-cli issues tags <issue-id> --key <tag-key>Get tag value distribution for an issue.
Arguments:
issue_id(required) - Issue ID--org- Organization slug--key(required) - Tag key to get values forOutput:
sentry-cli traces info <trace-id>Get trace details including span tree and statistics.
Arguments:
trace_id(required) - Trace ID--org- Organization slugOutput:
sentry-cli events attachment <event-id> [attachment-id]List or download event attachments.
Arguments:
event_id(required) - Event IDattachment_id(optional) - Attachment ID to download--org- Organization slug--project- Project slug (required)--output- Output file path (for download mode)Output (list mode):
Output (download mode):
API Endpoints
All commands use standard Sentry REST API endpoints (same as sentry-mcp):
issues infoGET /api/0/organizations/{org}/issues/{id}/GET /api/0/organizations/{org}/issues/{id}/events/latest/issues eventsGET /api/0/organizations/{org}/issues/{id}/events/issues tagsGET /api/0/organizations/{org}/issues/{id}/tags/{key}/traces infoGET /api/0/organizations/{org}/trace-meta/{id}/GET /api/0/organizations/{org}/trace/{id}/events attachmentGET /api/0/projects/{org}/{proj}/events/{id}/attachments/GET /api/0/projects/{org}/{proj}/events/{id}/attachments/{aid}/?download=1Implementation
Files to Modify/Create
Data Types
API Methods
Estimate
~650-700 lines of Rust code total.
Follow-up Tasks
--jsonflag - For agent/scripting consumption (output as JSON)create_project,update_project,find_teams,create_teamfind_dsns,create_dsnNotes
Implementation Plan
Sentry CLI Debugging Commands Implementation Plan
Goal: Add 5 debugging/triage commands to sentry-cli that mirror sentry-mcp functionality.
Architecture: Extend existing
issuesandeventscommands, add newtracescommand. All commands use sentry-cli's existing HTTP/auth infrastructure. API methods added toAuthenticatedApi, data types toapi/mod.rs.Tech Stack: Rust, clap (CLI args), serde (JSON), curl (HTTP), prettytable (output formatting)
Task 1: Add IssueDetails Data Types
Files:
src/api/mod.rs(add after line ~1683, after existingIssuestruct)Step 1: Add the data types
Add after the existing
Issuestruct (around line 1683):Step 2: Verify it compiles
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo checkExpected: Compiles without errors
Step 3: Format code
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo fmtStep 4: Commit
Task 2: Add API Methods for Issues
Files:
src/api/mod.rs(add methods toAuthenticatedApiimpl block, around line 942)Step 1: Add API methods
Add these methods inside
impl AuthenticatedApi<'_>(afterlist_organization_project_issues):Step 2: Verify it compiles
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo checkExpected: Compiles without errors
Step 3: Format and commit
Task 3: Add API Methods for Traces and Attachments
Files:
src/api/mod.rs(continue adding toAuthenticatedApiimpl)Step 1: Add trace and attachment API methods
Add these methods inside
impl AuthenticatedApi<'_>:Step 2: Verify it compiles
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo checkExpected: Compiles without errors
Step 3: Format and commit
Task 4: Create issues info Command
Files:
src/commands/issues/info.rssrc/commands/issues/mod.rsStep 1: Create the info command file
Create
src/commands/issues/info.rs:Step 2: Register the command in mod.rs
Modify
src/commands/issues/mod.rs:Add to the module declarations (after line 9):
Update the
each_subcommand!macro (around line 11-17) to includeinfo:Step 3: Verify it compiles
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo checkExpected: Compiles without errors
Step 4: Format and commit
Task 5: Create issues events Command
Files:
src/commands/issues/events.rssrc/commands/issues/mod.rsStep 1: Create the events command file
Create
src/commands/issues/events.rs:Step 2: Register the command in mod.rs
Modify
src/commands/issues/mod.rs- add to module declarations:Update the
each_subcommand!macro:Step 3: Verify it compiles
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo checkExpected: Compiles without errors
Step 4: Format and commit
Task 6: Create issues tags Command
Files:
src/commands/issues/tags.rssrc/commands/issues/mod.rsStep 1: Create the tags command file
Create
src/commands/issues/tags.rs:Step 2: Register the command in mod.rs
Modify
src/commands/issues/mod.rs- add to module declarations:Update the
each_subcommand!macro:Step 3: Verify it compiles
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo checkExpected: Compiles without errors
Step 4: Format and commit
Task 7: Create traces Command
Files:
src/commands/traces/mod.rssrc/commands/mod.rsStep 1: Create the traces command directory and file
Create
src/commands/traces/mod.rs:Step 2: Register traces in main commands mod.rs
Modify
src/commands/mod.rs:Add to module declarations (around line 31, alphabetically near other modules):
Update the
each_subcommand!macro to includetraces(around line 50-78):Step 3: Verify it compiles
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo checkExpected: Compiles without errors
Step 4: Format and commit
Task 8: Create events attachment Command
Files:
src/commands/events/attachment.rssrc/commands/events/mod.rsStep 1: Create the attachment command file
Create
src/commands/events/attachment.rs:Step 2: Register the command in mod.rs
Modify
src/commands/events/mod.rs:Add to module declarations:
Update the
each_subcommand!macro:Step 3: Verify it compiles
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo checkExpected: Compiles without errors
Step 4: Format and commit
Task 9: Test All Commands
Step 1: Build the CLI
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo buildExpected: Build succeeds
Step 2: Test help output for each command
Run these commands and verify help text appears:
cd /Users/haza/Projects/climcp/sentry-cli ./target/debug/sentry-cli issues info --help ./target/debug/sentry-cli issues events --help ./target/debug/sentry-cli issues tags --help ./target/debug/sentry-cli traces info --help ./target/debug/sentry-cli events attachment --helpExpected: Each command shows its help text with arguments and options
Step 3: Run clippy
Run:
cd /Users/haza/Projects/climcp/sentry-cli && cargo clippyExpected: No warnings (fix any that appear)
Step 4: Final commit if any fixes
If clippy required fixes:
Summary
After completing all tasks, the following commands will be available:
sentry-cli issues info <id>sentry-cli issues events <id>sentry-cli issues tags <id> --key <key>sentry-cli traces info <id>sentry-cli events attachment <id> [att-id]Total files created: 5
Total files modified: 3
Estimated lines of code: ~650