Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Breadcrumb eviction in Scope.addBreadcrumb is reported as a discarded log_item (buffer_overflow)

Đã đóng Phù hợp với người mới
#24,510 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
76/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
nextjs, typescript
Lĩnh vực
observability

Hướng nghiên cứu

Bắt đầu trong packages/core/src/scope.ts tại Scope.addBreadcrumb và kiểm tra cách eviction gọi recordDroppedEvent. Tái hiện trường hợp có nhiều hơn maxBreadcrumbs entry, sau đó xác minh rằng việc eviction breadcrumb không còn xuất hiện dưới dạng buffer_overflow/log_item, sử dụng các test hiện có của repository cho hành vi của scope nếu có.

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

Mô tả

Client Reports Next.js Waiting for: Product Owner
Is there an existing issue for this?
How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

10.73.0

Framework Version

Next 16.3.4

Link to Sentry event

No response

Reproduction Example/SDK Setup

Any app that adds more than maxBreadcrumbs (default 100) breadcrumbs to a scope.

Steps to Reproduce
  1. Keep a scope alive long enough to add 101 breadcrumbs (a long-lived server scope, or a browser page with console/fetch/click breadcrumbs).
  2. Look at the client reports the SDK sends, or at Sentry → Stats → Outcomes for the project.
Expected Result

Breadcrumb eviction from the ring buffer is not a discarded log item. Either it is not reported as a client report at all (a breadcrumb is context, and 100 is the intended cap), or it is reported under a breadcrumb-shaped reason/category rather than log_item.

Actual Result

Scope.addBreadcrumb records a client report with reason buffer_overflow and category log_item every time the breadcrumb buffer evicts an entry:

// packages/core/src/scope.ts (develop), same in @sentry/core 10.73.0 build/cjs/scope.js:394
this._breadcrumbs.push(mergedBreadcrumb);
if (this._breadcrumbs.length > maxCrumbs) {
  this._breadcrumbs = this._breadcrumbs.slice(-maxCrumbs);
  this._client?.recordDroppedEvent('buffer_overflow', 'log_item');
}

In Sentry's Stats page this shows up as discarded log items, client_discard · buffer_overflow, and in our project it dwarfs accepted logs: 84,981,094 "discarded" against 1,692,344 accepted log items over 7 days. We spent an investigation working out that none of those were log lines: the logs buffer flushes at 100 items / 800 KB / 5 s and never discards for this reason, so the only source of buffer_overflow · log_item in the SDK is breadcrumb eviction. The mislabel makes the Stats page read as if 98% of logs are lost in-process, when nothing is.

Suggested fix: drop the recordDroppedEvent call in addBreadcrumb, or give it its own reason/category so it cannot be read as log loss.

Ngôn ngữ chính
TypeScript
Star
8.7k
Fork
1.9k
Merge trung bình
1 ngày 16 giờ
Pull request đã merge (30 ngày)
576

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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/sentry-javascript

Tất cả issue của getsentry/sentry-javascript

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.