with_child_span drops spans when blocks exit via break, return, or throw
Los mantenedores suelen responder en 2 días
@itsrayeedscodespace ya está trabajando en esto.
Desde el 14/11/2026.
- #3207 de @itsrayeedscodespace — abierto
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- ruby
- Área
- observability
Línea de trabajo
Start in the SDK's Span#with_child_span, where finish runs after yield and in the rescue branch, and in the public wrapper on the Sentry module that delegates to it. Read the existing specs around span finishing and the transaction event's span filtering to confirm an unfinished span is dropped. The fix is to finish the child span in an ensure while keeping the StandardError handling and the direct return value, then run the span specs plus the four reproduction cases (break, nonlocal return, catch/throw, custom Exception).
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Issue Description
Sentry.with_child_span silently loses its child span when the block exits via break, a nonlocal return, or throw. The same happens when the block raises an exception outside StandardError.
The underlying Span#with_child_span calls finish after yield and in its rescue branch. None of those paths run for nonlocal control flow. The hub restores the parent scope in ensure, but the child still has a nil timestamp, so TransactionEvent filters it out of the captured transaction.
Reproduction Steps
On current master (314eacad), with Ruby 3.4.12:
require "sentry-ruby"
Sentry.init do |config|
config.dsn = "http://public@localhost/1"
config.transport.transport_class = Sentry::DummyTransport
config.background_worker_threads = 0
config.traces_sample_rate = 1.0
end
transaction = Sentry.start_transaction(name: "repro", sampled: true)
Sentry.get_current_scope.set_span(transaction)
result = Sentry.with_child_span(op: "work") { break :done }
transaction.finish
p result # :done
p Sentry.get_current_client.transport.events.last.spans # []
A method returning from inside the span block, catch/throw, and a raised custom Exception subclass all produce the same missing span. Four public-API regression specs reproduce this on unchanged master.
Expected Behavior
The child span is finished and included in the transaction regardless of how control leaves the block. Return values and exception propagation remain unchanged.
Actual Behavior
The child span is unfinished and silently excluded from the captured transaction.
Proposed Fix
Finish the child span in an ensure block around the yield. Keep the existing StandardError handling and direct Span#with_child_span return value.
- 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
-
Events dropped client-side for size are only logged at debug level and not recorded as lostPosiblemente ocupada @sentry-junior la tomó hoy. AbiertoBug Junior: repro Ruby
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
getsentry/sentry-ruby#3209 · 2 comentarios · 1 reacción ·
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