Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvCW committed Sep 23, 2023
1 parent 6283a63 commit b108c5b
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ The preferred type of notifications can be configured with:
* `Prosopite.stderr_logger = true`: Send warnings to STDERR
* `Prosopite.backtrace_cleaner = my_custom_backtrace_cleaner`: use a different [ActiveSupport::BacktraceCleaner](https://api.rubyonrails.org/classes/ActiveSupport/BacktraceCleaner.html). Defaults to `Rails.backtrace_cleaner`.
* `Prosopite.custom_logger = my_custom_logger`:
* `Prosopite.enabled = true`: Enables or disables the gem. Defaults to `true`.

### Custom Logging Configuration

Expand Down Expand Up @@ -203,6 +204,47 @@ end

WARNING: scan/finish should run before/after **each** test and NOT before/after the whole suite.

## Middleware

### Rack

Instead of using an `around_action` hook in a Rails Controller, you can also use the rack middleware instead
implementing auto detect for all controllers.

Add the following line into your `config/initializers/prosopite.rb` file.

```ruby
unless Rails.production?
require 'prosopite/middleware/rack'
Rails.configuration.middleware.use(Prosopite::Middleware::Rack)
end
```

Since this is a rack middleware it can also be used with any other rack application (including grape)

for example in `config.ru`
```ruby
require 'prosopite/middleware/rack'

use Prosopite::Middleware::Rack
run MyApp
```

### Sidekiq
We also provide a middleware for sidekiq so that you can auto detect n+1 queries that may occur in a sidekiq job.
You just need to add the following to your sidekiq initializer.

```ruby
Sidekiq.configure_server do |config|
unless Rails.production?
config.server_middleware do |chain|
require 'prosopite/middleware/sidekiq'
chain.add(Prosopite::Middleware::Sidekiq)
end
end
end
```

## Allow list

Ignore notifications for call stacks containing one or more substrings / regex:
Expand Down

0 comments on commit b108c5b

Please sign in to comment.