Sha256: ad93761cce8ea916ee87d79bf7c2e2201efa9f64368066e0296a9ecbfb2fade5

Contents?: true

Size: 1.96 KB

Versions: 2

Compression:

Stored size: 1.96 KB

Contents

# Notable

Track notable requests and background jobs

See users affected by:

- errors
- slow requests, jobs, and timeouts
- 404s
- validation failures
- CSRF failures
- unpermitted parameters
- blocked and throttled requests

:tangerine: Battle-tested at [Instacart](https://www.instacart.com)

## Installation

Add this line to your application’s Gemfile:

```ruby
gem 'notable'
```

And run:

```sh
rails generate notable:requests
rails generate notable:jobs # optional
rake db:migrate
```

For a web interface, check out [Notable Web](https://github.com/ankane/notable_web).

## Requests

A `Notable::Request` is created for:

- errors
- slow requests and timeouts
- 404s
- validation failures
- CSRF failures
- unpermitted parameters
- blocked and throttled requests

## Jobs

A `Notable::Job` is created for:

- errors
- slow jobs

Currently works with Delayed Job and Sidekiq.

## Manual Tracking

```ruby
Notable.track(note_type, note)
```

## Customize

Disable tracking in certain environments

```ruby
Notable.enabled = Rails.env.production?
```

### Requests

Set slow threshold

```ruby
Notable.slow_request_threshold = 5 # seconds (default)
```

Custom user method

```ruby
Notable.user_method = proc do |env|
  env["warden"].try(:user) || env["action_controller.instance"].try(:current_visit)
end
```

Custom track method

```ruby
Notable.track_request_method = proc do |data, env|
  Notable::Request.create!(data)
end
```

### Jobs

Set slow threshold

```ruby
Notable.slow_job_threshold = 60 # seconds (default)
```

Custom track method

```ruby
Notable.track_job_method = proc do |data|
  Notable::Job.create!(data)
end
```

## TODO

- ability to disable features
- add indexes

## Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

- [Report bugs](https://github.com/ankane/notable/issues)
- Fix bugs and [submit pull requests](https://github.com/ankane/notable/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
notable-0.0.2 README.md
notable-0.0.1 README.md