# Requests performance monitoring

How to measure any section of code, and configure RoRvsWild to ignore some requests.


## Measure any section of code

RoRvsWild measures a lot of events such as SQL queries and views rendering.
But it might not be enough for you.
There is a solution to measure any section of code to help you find the most hidden bottlenecks:

```ruby
# Measure a code given as a string
RorVsWild.measure("bubble_sort(array)")

# Measure a code given as a block
RorVsWild.measure { bubble_sort(array) }

# Measure a code given as a block with an optional description
RorVsWild.measure("Optional description") { bubble_sort(array) }
```

For each custom measure, a section is added with the file name and line number where it has been called.

## Ignore controllers and actions

Sometimes, you just don't want to know.
You can either exclude endpoints with their controller and action names or with a regex to exclude many endpoints at once:


```yaml
# config/rorvswild.yml
production:
  api_key: YOUR_API_KEY
    ignore_requests:
      - SecretController#index
      - !ruby/regexp /AnotherSecretController/ # Skip the entire controller
```

## Sample requests

If your application handles a lot of trafic, you can sample requests to lower your monitoring bill. (version >= 1.7.0)

```yaml
  # config/rorvswild.yml
  production:
    api_key: API_KEY
    job_sampling_rate: 0.5 # 50% of jobs are sent
    request_sampling_rate: 0.25 # 25% of requests are sent
```
