getsentry / getsentry/sentry-ruby

Add AR query time to breadcrumbs

Đang mở
#2,283 4 bình luận 0 reaction 1 người được giao Được @sl0thentr0py nhận Xem trên GitHub
Feature Ruby sentry-rails Spans
Ngôn ngữ chính
Ruby
Star
987
Fork
541
Merge trung bình
17 giờ 40 phút
Pull request đã merge (30 ngày)
19

Mô tả

**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
)
```

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

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

Đánh giá

Issue này chưa được đánh giá.

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.