Events dropped client-side for size are only logged at debug level and not recorded as lost
Maintainer thường phản hồi trong vòng 2 ngà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
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- ruby
- Lĩnh vực
- backend, observability
Hướng nghiên cứu
Bắt đầu tại sentry-ruby/lib/sentry/transport.rb, gần Transport#serialize_envelope, và so sánh đường xử lý loại bỏ mục quá lớn với phần xử lý 413 được thêm trong #2885. Kiểm tra cách các sự kiện bị mất và thống kê sự kiện bị loại bỏ được ghi nhận, rồi bổ sung khả năng quan sát tương đương cho lần loại bỏ này. Hoàn tất khi một mục quá lớn được ghi log ở mức warn và được ghi nhận là bị mất; hãy xác minh rằng quá trình tái hiện báo cáo kết quả sự kiện bị loại bỏ không rỗng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Issue Description
When an envelope item is still larger than MAX_SERIALIZED_PAYLOAD_SIZE after Envelope::Item#serialize has removed breadcrumbs and reduced the stacktrace, Transport#serialize_envelope skips it with a log_debug and nothing else:
https://github.com/getsentry/sentry-ruby/blob/master/sentry-ruby/lib/sentry/transport.rb#L77-L82
Since the event is never sent, Relay never sees it, so it doesn't show up in the invalid payload stats either. And unlike the 413 path added in #2885, no client report is recorded. With the SDK logger at the usual info level, the event is lost without any trace.
The size reduction doesn't touch extra or contexts, so a large custom payload is enough to hit this. In our case, a scheduled job reported a list of record ids in extra - the list was about 3 MB, and the event never arrived. We only noticed because we knew a report should arrive, and were confused why none did arrive.
#2381 asked for truncation of custom contexts and was declined in favor of server-side handling, with a pointer to the invalid payload stats. That makes sense for truncation, but these events never reach the server, so the stats can't show them. This issue is only about making the drop visible.
Reproduction Steps
require "logger"
gem "sentry-ruby", "7.2.0"
require "sentry-ruby"
Sentry.init do |config|
config.dsn = "http://[email protected]:9/1" # nothing listens here; the event is dropped before any request
config.background_worker_threads = 0
config.sdk_logger = Logger.new($stdout, level: ENV.fetch("LOG_LEVEL", "info"))
end
Sentry.capture_message("Found records", extra: { ids: (1..200_000).to_a })
puts "discarded events: #{Sentry.get_current_client.transport.instance_variable_get(:@discarded_events).inspect}"
Expected Behavior
- The drop is logged at
warnlevel, like the 413 response. - A lost event is recorded (e.g.
record_lost_event(:send_error, item.data_category, num: item.item_count, num_bytes: item.lost_event_byte_size), as in the 413 path), so it shows up in the org's stats.
Actual Behavior
With LOG_LEVEL=info, the script prints only:
discarded events: {}
With LOG_LEVEL=debug, the drop is logged, but still no lost event is recorded:
DEBUG -- sentry: Envelope item [event] is still oversized after size reduction: {event_id: 34, level: 7, timestamp: 22, environment: 13, server_name: 19, modules: 13408, message: 15, user: 2, tags: 2, contexts: 525, extra: 1288904, fingerprint: 2, platform: 6, sdk: 40, type: 7, threads: 1654}
discarded events: {}
Ruby Version
4.0.9
SDK Version
7.2.0
Integration and Its Version
Reproducible with plain sentry-ruby; we noticed it in Rails 8.1 with sentry-rails and sentry-sidekiq 7.2.0.
Sentry Config
No response
- Ngôn ngữ chính
- Ruby
- Star
- 990
- Fork
- 552
- Merge trung bình
- 2 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 29
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của getsentry/sentry-ruby
-
Bug Ruby
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
getsentry/sentry-ruby#3211 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
with_child_span drops spans when blocks exit via break, return, or throwCó thể đã có người làm @itsrayeedscodespace đã nhận 1 ngày trước. Đang mởBug Ruby Traces Waiting for: Product Owner
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
getsentry/sentry-ruby#3206 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Let apps choose how the client IP on events is determinedCó thể đã có người làm @sl0thentr0py đã nhận 11 ngày trước. Đang mởImprovement Ruby
getsentry/sentry-ruby#3180 · 2 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Remove `sentry-ruby-core` gemĐang mởbreaking change Next Major
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
getsentry/sentry-ruby#3176 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
With `register_error_subscriber`, view errors are reported twice: the wrapper by the middleware, and its cause by the error subscriberCó thể đã có người làm @sl0thentr0py đã nhận 13 ngày trước. Đang mởBug Ruby
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 57/100
getsentry/sentry-ruby#3166 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của getsentry/sentry-ruby
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
internetee/registry#2984 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
ecosyste-ms/issues#862 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Redis Lua error `@user_script:52: ERR value is not an integer or out of range` when `window_size` is configuredCó thể đã có người làm @mimosa đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
riscv/riscv-unified-db#2829 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
⛓️ Security Difficulty: Easy Good First Issue Help Wanted ruby Type: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
rubyforgood/casa#7404 ·
Maintainer thường phản hồi trong vòng 1 ngày