Requests performances 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:
# 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.
Ignoring 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:
# config/rorvswild.yml
production:
api_key: YOUR_API_KEY
ignore_requests:
- SecretController#index
- !ruby/regexp /AnotherSecretController/ # Skip the entire controller
Sampling requests (version >= 1.7.0)
If your application handles a lot of trafic, you can sample requests to lower your monitoring bill.
# 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