appflux_ruby 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/LICENSE.txt +1 -1
- data/README.md +12 -14
- data/lib/appflux_ruby/bugflux_config.rb +1 -1
- data/lib/appflux_ruby/bugflux_notifier.rb +17 -8
- data/lib/appflux_ruby/delayed/plugin.rb +0 -1
- data/lib/appflux_ruby/message_builders/bugflux.rb +2 -2
- data/lib/appflux_ruby/message_builders/sidekiq.rb +18 -0
- data/lib/appflux_ruby/rack/middleware.rb +0 -1
- data/lib/appflux_ruby/rails/active_record.rb +0 -1
- data/lib/appflux_ruby/rails/controller_methods.rb +5 -5
- data/lib/appflux_ruby/sidekiq/error_handler.rb +21 -0
- data/lib/appflux_ruby/version.rb +1 -1
- data/lib/generators/appflux_ruby/appflux.rb +23 -0
- data/lib/generators/appflux_ruby/install_generator.rb +1 -1
- metadata +6 -5
- data/lib/generators/appflux_ruby/bugflux.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 364f9ef0534d86572819348b1df7161b73bfa30f78f0e5e6dde105cf1e33f6b8
|
4
|
+
data.tar.gz: 8e12d5ab4484b714d3734efd8a8877466679dc48d3d975016aaec20afc5849ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da9f36f9cba80d190ba7c36f00fd1c68eddd8df1cd21c8b01ca4837e16ec59e87f0d33357928a89d92d950260ff58aa0fe3a85ecd939aaff9fc8cbc17b6aa7e0
|
7
|
+
data.tar.gz: 10c9f6eb057f2559aa2ccd2873dcbc42342a524c49ed3d3b7fb882505558b9c171dda22b9cd2d3382e62851dc59c620e046352d9a7a917120bbe473c4a41eace
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,43 +1,41 @@
|
|
1
1
|
# Appflux Ruby
|
2
|
-
|
3
2
|
---
|
3
|
+
[](https://codeclimate.com/github/appflux/appflux-ruby/maintainability) [](https://badge.fury.io/rb/appflux_ruby)
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
Appflux is an exception notification library for Rack/Rails application. It is extremely lightweight, easy to setup and always free. Signup on appflux.io, create a project and find your keys to setup your application. The exceptions are delivered to your email as well as can be seen on the dashboard. Appflux also offers a simple and classic messaging platform.
|
7
6
|
|
8
|
-
|
7
|
+
## Why do we need another exception notification library?
|
8
|
+
1. While [exception_notification](https://github.com/smartinez87/exception_notification) is a good open source library, it is really painful to setup. The notification messages are very verbose and often spam the inbox. And... it does not come with a GUI. Appflux offers a decent simplistic dashboard that most open source solutions lack.
|
9
|
+
2. There are a lot of very good commercial exception notification softwares out there. But they are more focussed on managers, not developers.
|
9
10
|
|
10
|
-
## Features
|
11
|
+
## Some Features
|
11
12
|
1. Automatically reports unhandled exceptions.
|
12
13
|
2. Reports handled exceptions.
|
13
14
|
3. Automagically supports Delayed Job and Sidekiq.
|
14
|
-
4. Figures out common information used to debug a Rails application.
|
15
|
+
4. Figures out common information (from commonly used gems) used to debug a Rails application.
|
15
16
|
5. Send custom diagnostic information.
|
16
|
-
6. Nicely integrates with
|
17
|
-
|
17
|
+
6. Nicely integrates with Appflux.io dashboard.
|
18
18
|
|
19
19
|
## Requirements
|
20
20
|
1. Ruby 1.9.3 or greater
|
21
21
|
2. Rails 3.0 or greater, Grape, Sinatra or any other Rack application.
|
22
22
|
|
23
|
-
|
24
23
|
## Setup
|
25
|
-
>
|
24
|
+
> If you have more than one project, you should first create an organization.
|
26
25
|
1. Sign up on appflux.io.
|
27
26
|
2. Confirm your account and create a project.
|
28
27
|
3. Follow the instructions on the setup page.
|
29
28
|
|
30
29
|
## What's more ?
|
31
30
|
Appflux offers an integrated platform to monitor, analyze and discuss your ruby application. You can:
|
32
|
-
1. Get notified of exceptions
|
33
|
-
2. Post messages and discuss issues with other collaborators.
|
34
|
-
3.
|
31
|
+
1. Get notified of exceptions.
|
32
|
+
2. Post messages and discuss issues with other collaborators and clients.
|
33
|
+
3. Keeps all project related files.
|
35
34
|
|
36
35
|
## What's cookin' ?
|
37
36
|
1. Support for out-of-the-box user behavior analysis for Rails applications.
|
38
37
|
2. Cohort analysis for Rails applications.
|
39
38
|
|
40
|
-
|
41
39
|
## Help
|
42
40
|
1. hi@appflux.io
|
43
41
|
2. [@_guptashubham](https://twitter.com/_guptashubham)
|
@@ -10,7 +10,7 @@ module AppfluxRuby
|
|
10
10
|
##
|
11
11
|
# @return [ID] Identify the application where to send the notification.
|
12
12
|
# This value *must* be set.
|
13
|
-
attr_accessor :app_id
|
13
|
+
attr_accessor :app_id, :ignored_environments
|
14
14
|
|
15
15
|
##
|
16
16
|
# @return [Logger] the default logger used for debug output
|
@@ -12,19 +12,24 @@ module AppfluxRuby
|
|
12
12
|
class << self
|
13
13
|
|
14
14
|
def notify exception, environment = Hash.new
|
15
|
-
|
16
|
-
|
15
|
+
if should_report_exception?
|
16
|
+
::Rails.logger.info('Notifying Appflux of this exception.')
|
17
|
+
request = build_request(exception, environment)
|
18
|
+
response = request.run
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
unless response.code == 200
|
21
|
+
if defined?(::Rails)
|
22
|
+
::Rails.logger.fatal("[Appflux-Failed] Failed to notify Appflux, please check with your configuration in config/initializers/appflux.rb. Error Code: #{ response.code }")
|
23
|
+
else
|
24
|
+
puts "[Appflux-Failed] Failed to notify Appflux, please check with your configuration in config/initializers/appflux.rb. Error Code: #{ response.code }"
|
25
|
+
end
|
23
26
|
end
|
27
|
+
else
|
28
|
+
::Rails.logger.info("[Appflux] Skipping to notify Appflux for #{ ::Rails.env } environment.")
|
24
29
|
end
|
25
30
|
end
|
26
31
|
|
27
|
-
def build_request exception, environment
|
32
|
+
private def build_request exception, environment
|
28
33
|
notice = ::AppfluxRuby::MessageBuilders::Bugflux.new(exception, environment).build
|
29
34
|
request = ::Typhoeus::Request.new(
|
30
35
|
::AppfluxRuby::Bugflux.config.host,
|
@@ -33,6 +38,10 @@ module AppfluxRuby
|
|
33
38
|
headers: { Accept: "application/json" }
|
34
39
|
)
|
35
40
|
end
|
41
|
+
|
42
|
+
private def should_report_exception?
|
43
|
+
!AppfluxRuby::Bugflux.config.ignored_environments.include?(::Rails.env)
|
44
|
+
end
|
36
45
|
end
|
37
46
|
end
|
38
47
|
end
|
@@ -16,7 +16,6 @@ module AppfluxRuby
|
|
16
16
|
if job.payload_object.respond_to?(:job_data)
|
17
17
|
params[:active_job] = job.payload_object.job_data
|
18
18
|
end
|
19
|
-
puts 'Sending exception notification to bugflux.'
|
20
19
|
::AppfluxRuby::BugfluxNotifier.notify(exception, params)
|
21
20
|
raise exception
|
22
21
|
end
|
@@ -44,7 +44,7 @@ module AppfluxRuby
|
|
44
44
|
|
45
45
|
ENV_EXCEPTION_METHODS = %i( backtrace message cause class )
|
46
46
|
|
47
|
-
SUPPORTED_BACKGROUND_JOB_PROCESSORS = %w(delayed_job)
|
47
|
+
SUPPORTED_BACKGROUND_JOB_PROCESSORS = %w(delayed_job sidekiq)
|
48
48
|
|
49
49
|
def initialize exception, rack_env
|
50
50
|
super(exception, rack_env)
|
@@ -130,7 +130,7 @@ module AppfluxRuby
|
|
130
130
|
## Adds background processor information as a dedicated tab on the UI.
|
131
131
|
def add_background_job_info
|
132
132
|
if @rack_env[:component].in?(SUPPORTED_BACKGROUND_JOB_PROCESSORS)
|
133
|
-
builder_klass_string = @rack_env[:component].classify
|
133
|
+
builder_klass_string = @rack_env[:component].classify
|
134
134
|
builder_klass = "::AppfluxRuby::MessageBuilders::#{ builder_klass_string }".constantize
|
135
135
|
|
136
136
|
@bugflux_notice[:custom_tabs] ||= Hash.new
|
@@ -10,7 +10,6 @@ module AppfluxRuby
|
|
10
10
|
module ClassMethods
|
11
11
|
def before_bugflux_notify(*methods)
|
12
12
|
run_bugflux_callbacks(methods) do
|
13
|
-
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
@@ -34,9 +33,7 @@ module AppfluxRuby
|
|
34
33
|
end
|
35
34
|
end
|
36
35
|
end
|
37
|
-
|
38
36
|
end
|
39
|
-
|
40
37
|
end
|
41
38
|
|
42
39
|
module InstanceMethods
|
@@ -44,8 +41,11 @@ module AppfluxRuby
|
|
44
41
|
def __send_user_info_to_bugflux__ notifier_object
|
45
42
|
if respond_to?(:current_user) && current_user
|
46
43
|
notifier_object.add_tab('User',
|
47
|
-
{
|
48
|
-
|
44
|
+
{
|
45
|
+
id: current_user.id,
|
46
|
+
type: current_user.class.name,
|
47
|
+
name: current_user.try(:name),
|
48
|
+
email: current_user.try(:email)
|
49
49
|
}
|
50
50
|
)
|
51
51
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module AppfluxRuby
|
2
|
+
module Sidekiq
|
3
|
+
class ErrorHandler
|
4
|
+
def call(_worker, context, _queue)
|
5
|
+
yield
|
6
|
+
rescue Exception => exception
|
7
|
+
::AppfluxRuby::Bugflux.initialize_additional_data
|
8
|
+
params = {
|
9
|
+
component: 'sidekiq',
|
10
|
+
args: context['args'],
|
11
|
+
queue: context['queue'],
|
12
|
+
message: context['error_message'],
|
13
|
+
options: context.except('args', 'queue', 'error_message')
|
14
|
+
}
|
15
|
+
|
16
|
+
::AppfluxRuby::BugfluxNotifier.notify(exception, params)
|
17
|
+
raise exception
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/appflux_ruby/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
AppfluxRuby::Bugflux.configure do |config|
|
2
|
+
config.app_id = '<your-app-id>'
|
3
|
+
config.ignored_environments = %w( test development )
|
4
|
+
end
|
5
|
+
|
6
|
+
if defined?(::Delayed)
|
7
|
+
require 'appflux_ruby/delayed/plugin'
|
8
|
+
require 'appflux_ruby/message_builders/delayed_job'
|
9
|
+
|
10
|
+
Delayed::Worker.plugins << ::AppfluxRuby::Delayed::Plugin
|
11
|
+
end
|
12
|
+
|
13
|
+
if defined?(::Sidekiq)
|
14
|
+
require 'appflux_ruby/sidekiq/error_handler'
|
15
|
+
require 'appflux_ruby/message_builders/sidekiq'
|
16
|
+
|
17
|
+
Sidekiq.configure_server do |config|
|
18
|
+
config.server_middleware do |chain|
|
19
|
+
chain.add(AppfluxRuby::Sidekiq::ErrorHandler)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appflux_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shubham Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -71,12 +71,14 @@ files:
|
|
71
71
|
- lib/appflux_ruby/message_builders/bugflux.rb
|
72
72
|
- lib/appflux_ruby/message_builders/custom_message.rb
|
73
73
|
- lib/appflux_ruby/message_builders/delayed_job.rb
|
74
|
+
- lib/appflux_ruby/message_builders/sidekiq.rb
|
74
75
|
- lib/appflux_ruby/rack/middleware.rb
|
75
76
|
- lib/appflux_ruby/rails/active_record.rb
|
76
77
|
- lib/appflux_ruby/rails/controller_methods.rb
|
77
78
|
- lib/appflux_ruby/rails/railtie.rb
|
79
|
+
- lib/appflux_ruby/sidekiq/error_handler.rb
|
78
80
|
- lib/appflux_ruby/version.rb
|
79
|
-
- lib/generators/appflux_ruby/
|
81
|
+
- lib/generators/appflux_ruby/appflux.rb
|
80
82
|
- lib/generators/appflux_ruby/install_generator.rb
|
81
83
|
- test/appflux-ruby_test.rb
|
82
84
|
- test/test_helper.rb
|
@@ -99,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
101
|
- !ruby/object:Gem::Version
|
100
102
|
version: '0'
|
101
103
|
requirements: []
|
102
|
-
|
103
|
-
rubygems_version: 2.2.2
|
104
|
+
rubygems_version: 3.0.3
|
104
105
|
signing_key:
|
105
106
|
specification_version: 4
|
106
107
|
summary: Ruby library for integration with http://appflux.io
|
@@ -1,10 +0,0 @@
|
|
1
|
-
AppfluxRuby::Bugflux.configure do |config|
|
2
|
-
config.app_id = '<your-app-id>'
|
3
|
-
end
|
4
|
-
|
5
|
-
if defined?(::Delayed)
|
6
|
-
require 'appflux_ruby/delayed/plugin'
|
7
|
-
require 'appflux_ruby/message_builders/delayed_job'
|
8
|
-
|
9
|
-
Delayed::Worker.plugins << ::AppfluxRuby::Delayed::Plugin
|
10
|
-
end
|