Skip to content

fix(mcp): Clamp find_dropped_events interval to what Sentry accepts - #1831

Open
sentry-junior[bot] wants to merge 2 commits into
mainfrom
fix/mcp-dropped-events-interval
Open

sentry-junior[bot] wants to merge 2 commits into
mainfrom
fix/mcp-dropped-events-interval

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

find_dropped_events passed interval straight through. In the last 7 days in sentry/mcp-server, about 1.3K calls (~360 direct, ~920 through execute_sentry_tool) failed with "The interval has to be less than one day". The most common values were 7d, 30d, 14d and 1w, usually the same value as statsPeriod. A smaller tail failed with "should divide one day" (e.g. 23h, 13h) and "too many results" (e.g. 1h over 90d).

I checked these limits against Sentry source. organization_events_dropped runs an outcomes query, and that goes through sessions_v2.get_constrained_date_range at one-minute resolution. The interval has to be a whole number of minutes, at most 1 day, divide 1 day evenly, and give at most 1000 buckets across the range.

What changed:

  • An interval that meets those rules is sent unchanged.
  • Any other interval is replaced with the smallest standard interval (1m to 1d) that is at least as large and fits the range. The result gets an intervalNote saying what was used instead of what. A value that isn't a duration at all (e.g. hourly) is dropped with a note, and Sentry picks the interval.
  • The bucket-count check only runs when the range is known from statsPeriod or start/end. With no range, the tool doesn't guess Sentry's default window.
  • The interval description now says the range is '1m' to '1d'.

via @BYK.

--

View Session [Sentry]

The events-dropped endpoint rejects intervals longer than a day, ones
that do not divide a day, and ones that create more than 1000 buckets.
Keep accepted intervals, otherwise use the smallest valid interval that
is at least as large and report the change in intervalNote.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Nov 3, 2026 11:03am UTC

Request Review

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 3, 2026
Move the stats period unit table, parser, and the minute interval ladder
into @sentry/toolkit-core so find_dropped_events and the CLI use one
implementation, per review feedback.

This branch was successfully deployed

1 active and 1 inactive deployments
Actions — 0f94d6c6 Deployed Nov 3, 2026 by sentry-junior[bot] via eval #1513
Preview — 0f94d6c6 Deployed Nov 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant