getsentry / getsentry/sentry-ruby

Add AR query time to breadcrumbs

Abierto
#2,283 4 comentarios 0 reacciones 1 asignado Reclamado por @sl0thentr0py Ver en GitHub
Feature Ruby sentry-rails Spans
Lenguaje dominante
Ruby
Estrellas
987
Forks
541
Merge medio
17 h 40 min
PR fusionados (30 d)
19

Descripción

**Describe the idea**

We have breadcrumbs with the query like:

```js
{
name: Employee Pluck,
sql: SELECT DISTINCT "employees"."person_id" FROM "employees" WHERE "employees"."company_id" IN ('x', 'y', 'z'),
statement_name: null
}
```

Would be helpful to have the timing of that query together with the breadcrumb:

```js
{
name: Employee Pluck,
sql: SELECT DISTINCT "employees"."person_id" FROM "employees" WHERE "employees"."company_id" IN ('x', 'y', 'z'),
statement_name: null,
duration: 5.1234 // ms
}
```

**Why do you think it's beneficial to most of the users**

That will help with exceptions that might be caused due to slow endpoints such as graphql timeout middleware, rack-timeout and etc.

**Possible implementation**

https://github.com/getsentry/sentry-ruby/blob/master/sentry-rails/lib/sentry/rails/breadcrumb/active_support_logger.rb#L14-L18

Could be something like:

```ruby
crumb = Sentry::Breadcrumb.new(
data: data,
category: name,
timestamp: started.to_i,
duration: started - finished
)
```

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.