Skip to content

search_events failed on issue counts #553

Open

Description

@dcramer
  1. it didnt know how to use search_events for this
  2. my at tempted fix still failed (couldnt it self-correct?)
➜  ~/s/sentry-mcp (issue-526) ✔ claude
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
│                                                   │
│   /help for help, /status for your current setup  │
│                                                   │
│   cwd: /Users/dcramer/src/sentry-mcp              │
╰───────────────────────────────────────────────────╯

> count the number of unique issues vs the the number of errors in the last 30 days

⏺ I'll help you count the unique issues versus the number of errors in the last 30 days. Let me use the search tools to query Sentry for this information.

⏺ Task(Search issues last 30 days)
  ⎿  Bash(ls -la /Users/dcramer/src/sentry-mcp/packages/mcp-server/src/tools/search-issues)
     Waiting…
     total 72
     drwxr-xr-x@  9 dcramer  staff   288 Aug 28 15:59 .
     drwxr-xr-x@ 42 dcramer  staff  1344 Aug 28 15:30 ..
     … +7 lines (ctrl+o to expand)
     +1 more tool use
  ⎿  Interrupted · What should Claude do instead?

⏺ Task(Search error events last 30 days)
  ⎿  Read(packages/mcp-server/src/tools/search-events/index.ts)
     Read 6 lines (ctrl+o to expand)
     +1 more tool use
  ⎿  Interrupted · What should Claude do instead?

> /mcp
  ⎿  (no content)

> count the number of unique issues vs the the number of errors in the last 30 days in sentry

⏺ I'll help you count the unique issues versus the number of errors in the last 30 days in Sentry. Let me use the Sentry MCP tools to get this information.

⏺ sentry - search_issues (MCP)(naturalLanguageQuery: "all issues from the last 30 days", limit: 100)

⏺ sentry - search_issues (MCP)(naturalLanguageQuery: "all issues from the last 30 days", limit: 100)

⏺ sentry - search_issues (MCP)(naturalLanguageQuery: "all issues from the last 30 days", limit: 100)
  ⎿  # Search Results for "all issues from the last 30 days"

     ⚠️ **IMPORTANT**: Display these issues as highlighted cards with status indicators, assignee info, and clickable Issue IDs.
     … +1178 lines (ctrl+o to expand)

⏺ sentry - search_events (MCP)(naturalLanguageQuery: "count of all errors from the last 30 days")
  ⎿  # Search Results for "count of all errors from the last 30 days"

     ⚠️ **IMPORTANT**: Display these aggregate results as a data table with proper column alignment and formatting.
     … +21 lines (ctrl+o to expand)

⏺ Based on my search of Sentry data for the last 30 days:

  Comparison Results
                                                                                                                                                                                                                        Unique Issues: 100+ (search returned 100 issues, likely more exist)
  Total Error Events: 402,762
  Key Insights

  - Error Volume: 402,762 total error events occurred in the past 30 days
  - Issue Grouping: These errors are grouped into 100+ unique issue types                                                                                                                                               - Ratio: Each unique issue represents an average of ~4,000 error events, showing significant error grouping efficiency
                                                                                                                                                                                                                        The high ratio of events to issues indicates that Sentry's grouping algorithm is effectively clustering similar errors together, with some issues like SEER-SY generating 25,970 events and SENTRY-414F
  generating 91,146 events from single root causes.

> Use the search_events query and just  do a group by issue to get a count?

⏺ sentry - search_events (MCP)(naturalLanguageQuery: "count of errors in the last 30 days grouped by issue")
  ⎿  # Search Results for "count of errors in the last 30 days grouped by issue"

     ⚠️ **IMPORTANT**: Display these aggregate results as a data table with proper column alignment and formatting.
     … +68 lines (ctrl+o to expand)

⏺ Perfect! Here's the breakdown of unique issues vs total error events in the last 30 days:

  Error Distribution by Issue

  | Issue ID       | Error Count | Percentage |
  |----------------|-------------|------------|
  | MCP-SERVER-EPT | 339,655     | 84.3%      |
  | MCP-SERVER-EJP | 35,636      | 8.8%       |
  | MCP-SERVER-EKN | 19,705      | 4.9%       |
  | MCP-SERVER-EP1 | 1,898       | 0.5%       |
  | MCP-SERVER-EJR | 1,764       | 0.4%       |
  | MCP-SERVER-DWS | 596         | 0.1%       |
  | MCP-SERVER-DR7 | 352         | 0.1%       |
  | MCP-SERVER-EH8 | 268         | 0.1%       |
  | MCP-SERVER-DY4 | 197         | <0.1%      |
  | MCP-SERVER-EN9 | 161         | <0.1%      |

  Total: 400,232 errors across 10+ unique issues

  Key Finding: MCP-SERVER-EPT dominates with 84% of all errors (339,655 events), indicating a critical issue that needs immediate attention.

> i want a unique(issue) query...

⏺ sentry - search_events (MCP)(naturalLanguageQuery: "count of unique issues in the last 30 days")
  ⎿  # Search Results for "count of unique issues in the last 30 days"

     ⚠️ **IMPORTANT**: Display these aggregate results as a data table with proper column alignment and formatting.
     … +58 lines (ctrl+o to expand)

⏺ Let me try a different approach to get the unique count of issues:

⏺ sentry - search_events (MCP)(naturalLanguageQuery: "uniq(issue) count of distinct issues in the last 30 days")
  ⎿  Error: **Input Error**

     There was an HTTP 400 error with your request to the Sentry API.

     API error (400): A single field cannot be used both inside and outside a function in the same query. To use issue.id you must first remove the function(s): count_unique(issue)

     You may be able to resolve the issue by addressing the concern and trying again.

⏺ sentry - search_events (MCP)(naturalLanguageQuery: "count_unique(issue) distinct issues in the last 30 days")
  ⎿  # Search Results for "count_unique(issue) distinct issues in the last 30 days"

     ⚠️ **IMPORTANT**: Display these aggregate results as a data table with proper column alignment and formatting.
     … +21 lines (ctrl+o to expand)

⏺ Perfect! Here's the final comparison:

  Unique Issues vs Total Errors (Last 30 Days)

  - Unique Issues: 203 distinct issues
  - Total Error Events: 400,232+ events
  - Average Events per Issue: ~1,970 events per unique issue

  This shows that Sentry's error grouping is effectively consolidating similar errors, with each unique issue representing approximately 2,000 error events on average.

Activity

  1. dcramer commented on Sep 22, 2025

    @dcramer
    MemberAuthor

    Another one that I'd want to work, as the above isnt what i wanted:

    "count new issues in the last 30 days"

    > count *new* issues in the last 30 days
    
    ⏺ sentry - search_events (MCP)(naturalLanguageQuery: "count_unique(issue) of new issues first seen in the last 30 days")
      ⎿  # Search Results for "count_unique(issue) of new issues first seen in the last 30 days"
    
         ⚠️ **IMPORTANT**: Display these aggregate results as a data table with proper column alignment and formatting.
         … +21 lines (ctrl+o to expand)
    
    ⏺ The result shows 0 new issues first seen in the last 30 days. This could indicate that either:
    
      1. All current issues are older than 30 days (pre-existing issues)
      2. The query might need adjustment for the specific project/organization
    
      Let me try a different approach to verify this result:
    
    ⏺ sentry - search_issues (MCP)(naturalLanguageQuery: "issues first seen in the last 30 days", limit: 10)
      ⎿  # Search Results for "issues first seen in the last 30 days"
    
         ⚠️ **IMPORTANT**: Display these issues as highlighted cards with status indicators, assignee info, and clickable Issue IDs.
         … +1158 lines (ctrl+o to expand)
    
    ⏺ Perfect! The search_issues tool shows there are actually 100+ new issues first seen in the last 30 days, while the search_events tool with the first_seen filter returned 0. This suggests the discrepancy was
      due to the different query approach between the two tools.
    
      New Issues in Last 30 Days: 100+
    
      The search shows many recent issues including:
      - CSP violations (content security policy blocks)
      - Database connection errors
      - Integration configuration errors
      - JavaScript hydration errors
      - API timeouts and failures
    
      This indicates active error detection and new issue creation, contrary to the earlier search_events result that showed 0 new issues.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions