traxor 0.1.18 → 0.1.19
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 +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +2 -2
- data/gemfiles/active_support_5_0.gemfile.lock +2 -2
- data/gemfiles/active_support_5_1.gemfile.lock +2 -2
- data/gemfiles/active_support_5_2.gemfile.lock +2 -2
- data/lib/traxor/faraday.rb +5 -3
- data/lib/traxor/metric.rb +2 -0
- data/lib/traxor/rails/action_controller.rb +9 -7
- data/lib/traxor/rails/action_mailer.rb +5 -3
- data/lib/traxor/rails/active_record.rb +9 -7
- data/lib/traxor/rails/engine.rb +22 -16
- data/lib/traxor/version.rb +1 -1
- data/lib/traxor.rb +24 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 351b5aa13db42137c948cfb5b917b2ba74362cd6963c00f53670050c9c062ca9
|
4
|
+
data.tar.gz: 5a8c4de34ba013e1d18332c9deaa3bfa064297ea98eec68783fbab8de3fbd8c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d95fdaf39f628c8d4a4fc0247589e92a971d0a70d8f0d406a800997a51ca5f6612d263a5904dd33197e8a6bfca6af40a8a059823ad1ff7e38a57ce28939c2219
|
7
|
+
data.tar.gz: 350f0c8ecdea1bf76449e6f3c51b2c43f9447f619e8e4c16653eb3201dbd3fa9fda5853624e3ec80ec39b31508efa72688bc881582f867a2bf8ee8fe15ee3a51
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A tool for logging ruby application performance metrics to the [Akkeris](https://github.com/akkeris) platform.
|
4
4
|
|
5
|
-
Supported
|
5
|
+
Supported Frameworks:
|
6
6
|
|
7
7
|
- Rack
|
8
8
|
- Sidekiq
|
@@ -17,7 +17,7 @@ How does this help me?
|
|
17
17
|
It logs things that help you troubleshoot performance issues. Just some of the things it can help with:
|
18
18
|
|
19
19
|
- How much time is spent in rack middleware?
|
20
|
-
- Are requests getting backed up in the [queue](https://devcenter.heroku.com/articles/http-routing#heroku-headers)
|
20
|
+
- Are requests getting backed up in the [queue](https://devcenter.heroku.com/articles/http-routing#heroku-headers)?
|
21
21
|
- How many ActiveRecord models are loaded in a request?
|
22
22
|
- Which sidekiq jobs are the slowest?
|
23
23
|
- How much time is being spent in calls to external services?
|
data/lib/traxor/faraday.rb
CHANGED
@@ -18,7 +18,9 @@ module Traxor
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
if Traxor.enabled? && Traxor.scopes.include?(:faraday)
|
22
|
+
ActiveSupport::Notifications.subscribe('request.faraday') do |*args|
|
23
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
24
|
+
Traxor::Faraday.record(event)
|
25
|
+
end
|
24
26
|
end
|
data/lib/traxor/metric.rb
CHANGED
@@ -38,12 +38,14 @@ module Traxor
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
if Traxor.enabled? && Traxor.scopes.include?(:action_controller)
|
42
|
+
ActiveSupport::Notifications.subscribe 'start_processing.action_controller' do |*args|
|
43
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
44
|
+
Traxor::Rails::ActionController.set_controller_tags(event)
|
45
|
+
end
|
45
46
|
|
46
|
-
ActiveSupport::Notifications.subscribe 'process_action.action_controller' do |*args|
|
47
|
-
|
48
|
-
|
47
|
+
ActiveSupport::Notifications.subscribe 'process_action.action_controller' do |*args|
|
48
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
49
|
+
Traxor::Rails::ActionController.record(event)
|
50
|
+
end
|
49
51
|
end
|
@@ -15,7 +15,9 @@ module Traxor
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
if Traxor.enabled? && Traxor.scopes.include?(:action_mailer)
|
19
|
+
ActiveSupport::Notifications.subscribe 'deliver.action_mailer' do |*args|
|
20
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
21
|
+
Traxor::Rails::ActionMailer.record(event)
|
22
|
+
end
|
21
23
|
end
|
@@ -36,12 +36,14 @@ module Traxor
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
39
|
+
if Traxor.enabled? && Traxor.scopes.include?(:active_record)
|
40
|
+
ActiveSupport::Notifications.subscribe 'sql.active_record' do |*args|
|
41
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
42
|
+
Traxor::Rails::ActiveRecord.record(event)
|
43
|
+
end
|
43
44
|
|
44
|
-
ActiveSupport::Notifications.subscribe 'instantiation.active_record' do |*args|
|
45
|
-
|
46
|
-
|
45
|
+
ActiveSupport::Notifications.subscribe 'instantiation.active_record' do |*args|
|
46
|
+
event = ActiveSupport::Notifications::Event.new(*args)
|
47
|
+
Traxor::Rails::ActiveRecord.record_instantiations(event)
|
48
|
+
end
|
47
49
|
end
|
data/lib/traxor/rails/engine.rb
CHANGED
@@ -10,28 +10,34 @@ module Traxor
|
|
10
10
|
Traxor.initialize_logger(::Rails.root.join('log', 'traxor.log'))
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
if Traxor.enabled?
|
14
|
+
if Traxor.scopes.include?(:rack)
|
15
|
+
require 'traxor/rack'
|
16
|
+
app.config.middleware.insert 0, Traxor::Rack::Middleware::Pre
|
17
|
+
app.config.middleware.use Traxor::Rack::Middleware::Post
|
18
|
+
end
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
ActiveSupport.on_load :action_controller do
|
21
|
+
require 'traxor/rails/action_controller'
|
22
|
+
end
|
23
|
+
ActiveSupport.on_load :active_record do
|
24
|
+
require 'traxor/rails/active_record'
|
25
|
+
end
|
26
|
+
ActiveSupport.on_load :action_mailer do
|
27
|
+
require 'traxor/rails/action_mailer'
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
27
31
|
|
28
32
|
config.before_configuration do
|
29
|
-
|
33
|
+
if Traxor.enabled?
|
34
|
+
require 'traxor/faraday' if defined?(Faraday)
|
30
35
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
36
|
+
if defined?(Sidekiq) && Traxor.scopes.include?(:sidekiq)
|
37
|
+
require 'traxor/sidekiq'
|
38
|
+
::Sidekiq.server_middleware do |chain|
|
39
|
+
chain.add Traxor::Sidekiq
|
40
|
+
end
|
35
41
|
end
|
36
42
|
end
|
37
43
|
end
|
data/lib/traxor/version.rb
CHANGED
data/lib/traxor.rb
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'logger'
|
4
|
-
require '
|
5
|
-
require 'traxor/metric'
|
6
|
-
require 'traxor/rack' if defined?(Rack)
|
7
|
-
require 'traxor/rails' if defined?(Rails::Engine)
|
8
|
-
require 'traxor/sidekiq' if defined?(Sidekiq)
|
9
|
-
require 'traxor/tags'
|
10
|
-
require 'traxor/version'
|
4
|
+
require 'active_support/core_ext/object/blank'
|
11
5
|
|
12
6
|
module Traxor
|
7
|
+
DEFAULT_SCOPES = 'rack,action_controller,action_mailer,active_record,faraday,sidekiq'
|
8
|
+
|
13
9
|
def self.logger
|
14
10
|
defined?(@logger) ? @logger : initialize_logger
|
15
11
|
end
|
@@ -21,4 +17,25 @@ module Traxor
|
|
21
17
|
end
|
22
18
|
@logger
|
23
19
|
end
|
20
|
+
|
21
|
+
def self.enabled?
|
22
|
+
@enabled ||= ENV.fetch('TRAXOR_ENABLED', true).present?
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.scopes
|
26
|
+
@scopes ||= ENV
|
27
|
+
.fetch('TRAXOR_SCOPES', DEFAULT_SCOPES)
|
28
|
+
.to_s
|
29
|
+
.downcase
|
30
|
+
.split(',')
|
31
|
+
.map(&:to_sym)
|
32
|
+
end
|
24
33
|
end
|
34
|
+
|
35
|
+
require 'traxor/faraday' if defined?(Faraday)
|
36
|
+
require 'traxor/metric'
|
37
|
+
require 'traxor/rack' if defined?(Rack)
|
38
|
+
require 'traxor/rails' if defined?(Rails::Engine)
|
39
|
+
require 'traxor/sidekiq' if defined?(Sidekiq)
|
40
|
+
require 'traxor/tags'
|
41
|
+
require 'traxor/version'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traxor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Hansen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -278,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
278
278
|
version: '0'
|
279
279
|
requirements: []
|
280
280
|
rubyforge_project:
|
281
|
-
rubygems_version: 2.7.
|
281
|
+
rubygems_version: 2.7.7
|
282
282
|
signing_key:
|
283
283
|
specification_version: 4
|
284
284
|
summary: Log metrics to akkeris platform
|