Events dropped client-side for size are only logged at debug level and not recorded as lost
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- ruby
- Área
- backend, observability
Línea de trabajo
Empieza en sentry-ruby/lib/sentry/transport.rb, cerca de Transport#serialize_envelope, y compara la ruta que descarta elementos demasiado grandes con el manejo de 413 añadido en #2885. Comprueba cómo se registran los eventos perdidos y las estadísticas de eventos descartados; luego añade una visibilidad equivalente para este descarte. Se considera terminado cuando un elemento demasiado grande se registra con nivel warn y se registra como perdido; verifica que la reproducción informe de un resultado no vacío de eventos descartados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Ruby
- Estrellas
- 990
- Forks
- 552
- Merge medio
- 2 d 16 h
- PR fusionados (30 d)
- 29
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/sentry-ruby
-
Bug Ruby
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
getsentry/sentry-ruby#3211 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
with_child_span drops spans when blocks exit via break, return, or throwPosiblemente ocupada @itsrayeedscodespace la tomó hace 1 día. AbiertoBug Ruby Traces Waiting for: Product Owner
Dificultad 2/5 1-3 horas Aptitud para principiantes 38/100
getsentry/sentry-ruby#3206 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Let apps choose how the client IP on events is determinedPosiblemente ocupada @sl0thentr0py la tomó hace 11 días. AbiertoImprovement Ruby
getsentry/sentry-ruby#3180 · 2 comentarios · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Remove `sentry-ruby-core` gemAbiertobreaking change Next Major
Dificultad 2/5 1-3 horas Aptitud para principiantes 58/100
getsentry/sentry-ruby#3176 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
With `register_error_subscriber`, view errors are reported twice: the wrapper by the middleware, and its cause by the error subscriberPosiblemente ocupada @sl0thentr0py la tomó hace 13 días. AbiertoBug Ruby
Dificultad 4/5 1-2 días Aptitud para principiantes 57/100
getsentry/sentry-ruby#3166 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 2 días
Todos los issues de getsentry/sentry-ruby
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
internetee/registry#2984 ·
Los mantenedores suelen responder en 6 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
ecosyste-ms/issues#862 ·
Los mantenedores suelen responder en 1 día
-
Redis Lua error `@user_script:52: ERR value is not an integer or out of range` when `window_size` is configuredPosiblemente ocupada @mimosa la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
riscv/riscv-unified-db#2829 ·
Los mantenedores suelen responder en 1 día
-
⛓️ Security Difficulty: Easy Good First Issue Help Wanted ruby Type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
rubyforgood/casa#7404 ·
Los mantenedores suelen responder en 1 día