Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jiren/rnotifier
Exceptions, Events, Alerts and Benchmarks catcher for ruby applications.
https://github.com/jiren/rnotifier
Last synced: about 2 months ago
JSON representation
Exceptions, Events, Alerts and Benchmarks catcher for ruby applications.
- Host: GitHub
- URL: https://github.com/jiren/rnotifier
- Owner: jiren
- License: mit
- Created: 2011-11-18T13:29:54.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2013-10-28T12:51:24.000Z (about 11 years ago)
- Last Synced: 2024-03-15T02:47:32.402Z (10 months ago)
- Language: Ruby
- Homepage: www.rnotifier.com
- Size: 320 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Rnotifier
Events and Exception catcher libraray.
[![Build Status](https://travis-ci.org/jiren/rnotifier.png?branch=master)](https://travis-ci.org/jiren/rnotifier)
[![Coverage Status](https://coveralls.io/repos/jiren/rnotifier/badge.png?branch=master)](https://coveralls.io/r/jiren/rnotifier?branch=master)
[![Code Climate](https://codeclimate.com/github/jiren/rnotifier.png)](https://codeclimate.com/github/jiren/rnotifier)## Installation
Add this line to your application's Gemfile:
gem 'rnotifier'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rnotifier
## Usage
rnotifier install 'API-KEY' # This will create 'config/rnotifier.yaml' file.
### Config file options
environments: development,test #default is production
capture_code: true #default false
ignore_exceptions: ActiveRecord::RecordNotFound,AbstractController::ActionNotFound,ActionController::RoutingError
ignore_bots: Googlebot### To test config
rnotifier test #this will send test exception to rnotifier.
### Send exception with request manually
For this ':request' params requireRnotifier.exception(exception, {:request => request, other_params => 'value'})
### Add context data to exception
Rnotifier.context({user_email: current_user.email})
### Send events and alerts
Rnotifier.event(:sign_up, {:username => 'Jiren', :email => '[email protected]', :using => 'facebook' })
Rnotifier.alert(:order_fail, {:user => 'Jiren', :product => 'PS3', :order_id => '321' })
You can also sends tags with 'event' and 'alert'
i.eRnotifier.event(
:sign_up,
{:username => 'Jiren', :email => '[email protected]', :using => 'facebook' },
{:tags => ['newsletter']}
)### Benchmarking
1. Code block benchamrking
```ruby
Rnotifier.benchmark('sum') do
(1..100).inject(0){|i, result| result = result + i; result }
end
```2. Method benchmarking
- For Instance object method
```ruby
Paragraph.new.benchmark({args: true}).word_count(text)
```
- For class method
```ruby
Paragraph.benchmark({args: true}).word_count(text)
```- Using helper function
```ruby
class Aggregatordef error_count(options = {})
# Code ...
end
# for instance method
benchmark_it :error_count, :time_condition => 0.5def self.errors_by_date_range(start_date, end_date)
# Code ...
end# For class method
benchmark_it :errors_by_date_range, :class_method => trueend
```
Options: time_condition and class_method
- For class method pass option ':class_method => true'3. Rails action
In controller add following filter.```ruby
rnotifier_benchmarking #
```
Above will capture benchamrk for all controller action.For particular action
```
rnotifier_benchmarking only: [:index, :show]# or
rnotifier_benchmarking except: [:destroy]
```
With time condition
```
rnotifier_benchmarking only: [:index, :show], time_condition: 0.8
```To capture page load benchmarking on client side add following tag to your view in the end of your view or in footer
```
rnotifier_tag
```## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull RequestLicense
-------
This is released under the MIT license.