find_dropped_events doesn't say that buckets snap to whole intervals

Đang mở Phù hợp với người mới
#2,276 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
documentation, tooling

Hướng nghiên cứu

Bắt đầu trong packages/mcp-core/src/tools/catalog/find-dropped-events.ts: văn bản gợi ý của interval nằm khoảng dòng 83-84 và 128-137, và ánh xạ phản hồi bỏ qua meta.start/meta.end nằm ở dòng 212-217. Lần theo cách công cụ xây dựng kết quả của nó để có thể thêm một ghi chú có điều kiện khi start/end rơi ra ngoài ranh giới khoảng, sau đó chạy các bài kiểm tra của công cụ để xác nhận rằng gợi ý và ghi chú mới xuất hiện.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

MCP mcp-feedback-pattern

Pattern: find_dropped_events with start/end and a coarse interval returns full-interval volumes for the first and last buckets, not volumes for the requested window. Nothing in the tool output or the description says so. Callers that sum the buckets for a fixed window overcount.

Reports: 1 (Sentry MCP user feedback MCP-SERVER-GQD, python caller, server 0.42.0). The caller worked around it with interval=1h and told its user about the alignment limit.

What happens

  1. The caller passes start=<…T18:01Z>, end=<…T06:01Z>, interval=1d. The tool forwards them unchanged to GET /organizations/{org}/events-dropped/ (sampled span for this caller's call).
  2. Sentry builds the outcomes query through QueryDefinition → get_constrained_date_range (getsentry/sentry src/sentry/snuba/sessions_v2.py:451-487), which calls to_intervals (src/sentry/snuba/metrics/utils.py:414-449). That floors start to the interval and rounds end up to the next boundary. With 1d, the range becomes <day>T00:00Z to <last day + 1>T00:00Z. So the first and last buckets hold whole-day totals.
  3. The endpoint's meta.start / meta.end report the requested range, not the aligned one (src/sentry/api/endpoints/organization_events_dropped.py:233-234). The MCP tool doesn't return meta.start/meta.end at all (packages/mcp-core/src/tools/catalog/find-dropped-events.ts:212-217). Only each bucket's own start/end gives this away.
  4. The description (find-dropped-events.ts:83-84, :128-137) tells callers to "use '1d' and sum the buckets" for longer ranges, without saying that the first and last buckets can cover time outside the window.

Suggested fix (MCP side)

  • When start/end don't fall on interval boundaries, add a note that gives the aligned range that was counted and says the edge buckets are whole intervals. Suggest a finer interval (for example 1h) for exact windows.
  • Add one line to the interval hint saying buckets align to whole intervals in UTC.

Possible Sentry API follow-up (not filed): meta.start/meta.end could report the aligned range that was actually queried. Owner: whoever owns organization_events_dropped.py. The MCP note above doesn't depend on that change.

Not this issue: the same report's search_errors time-range problem is getsentry/toolkit#2146, and its explanation mismatch is getsentry/toolkit#2147.

via automation evt_905b9c478746fd9deeb853f85ad7441b · Run ID dispatch_ebd17b42670133526c625ae4ebab5254.

--

View Session [Sentry]

Ngôn ngữ chính
TypeScript
Star
961
Fork
179
Merge trung bình
15 giờ 33 phút
Pull request đã merge (30 ngày)
476

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của getsentry/toolkit

Tất cả issue của getsentry/toolkit

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.