traxor 0.1.17 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +0 -14
- data/.rubocop.yml +12 -2
- data/.travis.yml +9 -2
- data/Appraisals +13 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +39 -25
- data/Guardfile +72 -0
- data/README.md +157 -5
- data/Rakefile +2 -0
- data/bin/_guard-core +29 -0
- data/bin/appraisal +29 -0
- data/bin/code_climate_reek +1 -1
- data/bin/console +1 -0
- data/bin/{lois → guard} +3 -3
- data/bin/rake +1 -1
- data/bin/reek +1 -1
- data/bin/rspec +1 -1
- data/bin/rubocop +1 -1
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/active_support_5_0.gemfile +7 -0
- data/gemfiles/active_support_5_0.gemfile.lock +252 -0
- data/gemfiles/active_support_5_1.gemfile +7 -0
- data/gemfiles/active_support_5_1.gemfile.lock +252 -0
- data/gemfiles/active_support_5_2.gemfile +7 -0
- data/gemfiles/active_support_5_2.gemfile.lock +252 -0
- data/lib/traxor/faraday.rb +21 -8
- data/lib/traxor/metric.rb +11 -5
- data/lib/traxor/rack/middleware/post.rb +2 -0
- data/lib/traxor/rack/middleware/pre.rb +36 -12
- data/lib/traxor/rack/middleware/queue_time.rb +6 -10
- data/lib/traxor/rack/middleware.rb +3 -0
- data/lib/traxor/rack.rb +2 -0
- data/lib/traxor/rails/action_controller.rb +44 -21
- data/lib/traxor/rails/action_mailer.rb +17 -4
- data/lib/traxor/rails/active_record.rb +42 -19
- data/lib/traxor/rails/engine.rb +40 -0
- data/lib/traxor/rails.rb +2 -33
- data/lib/traxor/sidekiq.rb +13 -11
- data/lib/traxor/tags.rb +3 -1
- data/lib/traxor/version.rb +3 -1
- data/lib/traxor.rb +6 -2
- data/traxor.gemspec +6 -6
- metadata +22 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba90b5e65121c02ec1a419a5e945c43802be46121fec69315c38a0bb327e01f5
|
4
|
+
data.tar.gz: 4ab56d1a501ce39e962f0108b745f758e3597a152d10d92122ea26e6605863ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31548d74364f241fe3286c46b79018eb0b1e948922cb13f6e8f77db3493d0f17c809d0e19c2bfb4b1adb3fff14b8da302367285eee3f796ef0e649955739571c
|
7
|
+
data.tar.gz: 77f30d4b35fc7f4f29ebe2243a903d7f7876f393013fe25d274c0d6ecd97549238e4ef38bd981e39c965474930856113bd2f9f8f195c4d32af35469cd6ebfcce
|
data/.circleci/config.yml
CHANGED
@@ -26,18 +26,6 @@ jobs:
|
|
26
26
|
- ./vendor/bundle
|
27
27
|
key: v1-dependencies-{{ checksum "Gemfile.lock" }}
|
28
28
|
|
29
|
-
- run:
|
30
|
-
name: Bundler-Audit
|
31
|
-
command: bin/lois bundler-audit -g $GITHUB_CREDENTIALS
|
32
|
-
|
33
|
-
- run:
|
34
|
-
name: Rubocop
|
35
|
-
command: bin/lois rubocop -g $GITHUB_CREDENTIALS
|
36
|
-
|
37
|
-
- run:
|
38
|
-
name: Reek
|
39
|
-
command: bin/lois reek -g $GITHUB_CREDENTIALS
|
40
|
-
|
41
29
|
- run:
|
42
30
|
name: Setup Code Climate test-reporter
|
43
31
|
command: |
|
@@ -56,7 +44,5 @@ jobs:
|
|
56
44
|
path: results
|
57
45
|
- store_artifacts:
|
58
46
|
path: results
|
59
|
-
- store_artifacts:
|
60
|
-
path: lois
|
61
47
|
- store_artifacts:
|
62
48
|
path: coverage
|
data/.rubocop.yml
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
require: rubocop-rspec
|
2
|
-
|
3
1
|
AllCops:
|
4
2
|
DisplayCopNames: true
|
3
|
+
TargetRubyVersion: 2.4
|
5
4
|
|
6
5
|
Rails:
|
7
6
|
Enabled: true
|
@@ -11,3 +10,14 @@ Style/Documentation:
|
|
11
10
|
|
12
11
|
Metrics/LineLength:
|
13
12
|
Max: 100
|
13
|
+
|
14
|
+
Metrics/BlockLength:
|
15
|
+
Exclude:
|
16
|
+
- '**/spec/**/*'
|
17
|
+
- 'traxor.gemspec'
|
18
|
+
- 'Guardfile'
|
19
|
+
|
20
|
+
Style/StringLiterals:
|
21
|
+
Exclude:
|
22
|
+
- 'bin/*'
|
23
|
+
- 'gemfiles/*'
|
data/.travis.yml
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
|
+
cache: bundler
|
3
4
|
rvm:
|
4
|
-
- 2.5
|
5
|
-
|
5
|
+
- 2.5
|
6
|
+
- 2.4
|
7
|
+
gemfile:
|
8
|
+
- gemfiles/active_support_5_0.gemfile
|
9
|
+
- gemfiles/active_support_5_1.gemfile
|
10
|
+
- gemfiles/active_support_5_2.gemfile
|
11
|
+
before_install: gem install bundler
|
12
|
+
script: "bin/rspec"
|
data/Appraisals
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
appraise 'active_support_5_0' do
|
4
|
+
gem 'activesupport', '~> 5.0'
|
5
|
+
end
|
6
|
+
|
7
|
+
appraise 'active_support_5_1' do
|
8
|
+
gem 'activesupport', '~> 5.1'
|
9
|
+
end
|
10
|
+
|
11
|
+
appraise 'active_support_5_2' do
|
12
|
+
gem 'activesupport', '~> 5.2'
|
13
|
+
end
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
traxor (0.1.
|
5
|
-
activesupport
|
6
|
-
rails (>= 4.2)
|
4
|
+
traxor (0.1.18)
|
5
|
+
activesupport (>= 5.0)
|
7
6
|
|
8
7
|
GEM
|
9
8
|
remote: https://rubygems.org/
|
@@ -49,17 +48,17 @@ GEM
|
|
49
48
|
i18n (>= 0.7, < 2)
|
50
49
|
minitest (~> 5.1)
|
51
50
|
tzinfo (~> 1.1)
|
51
|
+
appraisal (2.2.0)
|
52
|
+
bundler
|
53
|
+
rake
|
54
|
+
thor (>= 0.14.0)
|
52
55
|
arel (9.0.0)
|
53
56
|
ast (2.4.0)
|
54
57
|
axiom-types (0.1.1)
|
55
58
|
descendants_tracker (~> 0.0.4)
|
56
59
|
ice_nine (~> 0.11.0)
|
57
60
|
thread_safe (~> 0.3, >= 0.3.1)
|
58
|
-
brakeman (4.2.1)
|
59
61
|
builder (3.2.3)
|
60
|
-
bundler-audit (0.6.0)
|
61
|
-
bundler (~> 1.2)
|
62
|
-
thor (~> 0.18)
|
63
62
|
byebug (10.0.2)
|
64
63
|
codeclimate-engine-rb (0.4.1)
|
65
64
|
virtus (~> 1.0)
|
@@ -77,26 +76,36 @@ GEM
|
|
77
76
|
erubi (1.7.1)
|
78
77
|
faraday (0.15.0)
|
79
78
|
multipart-post (>= 1.2, < 3)
|
79
|
+
ffi (1.9.23)
|
80
|
+
formatador (0.2.5)
|
80
81
|
globalid (0.4.1)
|
81
82
|
activesupport (>= 4.2.0)
|
82
|
-
|
83
|
-
|
83
|
+
guard (2.14.2)
|
84
|
+
formatador (>= 0.2.4)
|
85
|
+
listen (>= 2.7, < 4.0)
|
86
|
+
lumberjack (>= 1.0.12, < 2.0)
|
87
|
+
nenv (~> 0.1)
|
88
|
+
notiffany (~> 0.0)
|
89
|
+
pry (>= 0.9.12)
|
90
|
+
shellany (~> 0.0)
|
91
|
+
thor (>= 0.18.1)
|
92
|
+
guard-compat (1.2.1)
|
93
|
+
guard-rspec (4.7.3)
|
94
|
+
guard (~> 2.1)
|
95
|
+
guard-compat (~> 1.1)
|
96
|
+
rspec (>= 2.99.0, < 4.0)
|
84
97
|
i18n (1.0.1)
|
85
98
|
concurrent-ruby (~> 1.0)
|
86
99
|
ice_nine (0.11.2)
|
87
100
|
json (2.1.0)
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
httparty
|
93
|
-
reek
|
94
|
-
rubocop
|
95
|
-
simplecov
|
96
|
-
thor
|
101
|
+
listen (3.1.5)
|
102
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
103
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
104
|
+
ruby_dep (~> 1.2)
|
97
105
|
loofah (2.2.2)
|
98
106
|
crass (~> 1.0.2)
|
99
107
|
nokogiri (>= 1.5.9)
|
108
|
+
lumberjack (1.0.13)
|
100
109
|
mail (2.7.0)
|
101
110
|
mini_mime (>= 0.1.1)
|
102
111
|
marcel (0.3.2)
|
@@ -106,11 +115,14 @@ GEM
|
|
106
115
|
mini_mime (1.0.0)
|
107
116
|
mini_portile2 (2.3.0)
|
108
117
|
minitest (5.11.3)
|
109
|
-
multi_xml (0.6.0)
|
110
118
|
multipart-post (2.0.0)
|
111
|
-
|
119
|
+
nenv (0.3.0)
|
120
|
+
nio4r (2.3.1)
|
112
121
|
nokogiri (1.8.2)
|
113
122
|
mini_portile2 (~> 2.3.0)
|
123
|
+
notiffany (0.1.1)
|
124
|
+
nenv (~> 0.1)
|
125
|
+
shellany (~> 0.0)
|
114
126
|
parallel (1.12.1)
|
115
127
|
parser (2.5.1.0)
|
116
128
|
ast (~> 2.4.0)
|
@@ -152,6 +164,9 @@ GEM
|
|
152
164
|
thor (>= 0.18.1, < 2.0)
|
153
165
|
rainbow (3.0.0)
|
154
166
|
rake (12.3.1)
|
167
|
+
rb-fsevent (0.10.3)
|
168
|
+
rb-inotify (0.9.10)
|
169
|
+
ffi (>= 0.5.0, < 2)
|
155
170
|
redis (4.0.1)
|
156
171
|
reek (4.8.1)
|
157
172
|
codeclimate-engine-rb (~> 0.4.0)
|
@@ -179,9 +194,9 @@ GEM
|
|
179
194
|
rainbow (>= 2.2.2, < 4.0)
|
180
195
|
ruby-progressbar (~> 1.7)
|
181
196
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
182
|
-
rubocop-rspec (1.25.1)
|
183
|
-
rubocop (>= 0.53.0)
|
184
197
|
ruby-progressbar (1.9.0)
|
198
|
+
ruby_dep (1.5.0)
|
199
|
+
shellany (0.0.1)
|
185
200
|
sidekiq (5.1.3)
|
186
201
|
concurrent-ruby (~> 1.0)
|
187
202
|
connection_pool (~> 2.2, >= 2.2.0)
|
@@ -217,10 +232,10 @@ PLATFORMS
|
|
217
232
|
ruby
|
218
233
|
|
219
234
|
DEPENDENCIES
|
235
|
+
appraisal
|
220
236
|
bundler
|
221
237
|
faraday
|
222
|
-
|
223
|
-
pry
|
238
|
+
guard-rspec
|
224
239
|
pry-byebug
|
225
240
|
rails
|
226
241
|
rake
|
@@ -228,7 +243,6 @@ DEPENDENCIES
|
|
228
243
|
rspec
|
229
244
|
rspec_junit_formatter
|
230
245
|
rubocop
|
231
|
-
rubocop-rspec
|
232
246
|
sidekiq
|
233
247
|
simplecov
|
234
248
|
traxor!
|
data/Guardfile
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# A sample Guardfile
|
4
|
+
# More info at https://github.com/guard/guard#readme
|
5
|
+
|
6
|
+
## Uncomment and set this to only include directories you want to watch
|
7
|
+
# directories %w(app lib config test spec features) \
|
8
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
9
|
+
|
10
|
+
## Note: if you are using the `directories` clause above and you are not
|
11
|
+
## watching the project directory ('.'), then you will want to move
|
12
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
13
|
+
#
|
14
|
+
# $ mkdir config
|
15
|
+
# $ mv Guardfile config/
|
16
|
+
# $ ln -s config/Guardfile .
|
17
|
+
#
|
18
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
19
|
+
|
20
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
21
|
+
# rspec may be run, below are examples of the most common uses.
|
22
|
+
# * bundler: 'bundle exec rspec'
|
23
|
+
# * bundler binstubs: 'bin/rspec'
|
24
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
25
|
+
# installed the spring binstubs per the docs)
|
26
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
27
|
+
# * 'just' rspec: 'rspec'
|
28
|
+
|
29
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
30
|
+
require 'guard/rspec/dsl'
|
31
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
32
|
+
|
33
|
+
# Feel free to open issues for suggestions and improvements
|
34
|
+
|
35
|
+
# RSpec files
|
36
|
+
rspec = dsl.rspec
|
37
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
38
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
39
|
+
watch(rspec.spec_files)
|
40
|
+
|
41
|
+
# Ruby files
|
42
|
+
ruby = dsl.ruby
|
43
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
44
|
+
|
45
|
+
# Rails files
|
46
|
+
rails = dsl.rails(view_extensions: %w[erb haml slim])
|
47
|
+
dsl.watch_spec_files_for(rails.app_files)
|
48
|
+
dsl.watch_spec_files_for(rails.views)
|
49
|
+
|
50
|
+
watch(rails.controllers) do |m|
|
51
|
+
[
|
52
|
+
rspec.spec.call("routing/#{m[1]}_routing"),
|
53
|
+
rspec.spec.call("controllers/#{m[1]}_controller"),
|
54
|
+
rspec.spec.call("acceptance/#{m[1]}")
|
55
|
+
]
|
56
|
+
end
|
57
|
+
|
58
|
+
# Rails config changes
|
59
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
60
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
61
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
62
|
+
|
63
|
+
# Capybara features specs
|
64
|
+
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
65
|
+
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
66
|
+
|
67
|
+
# Turnip features and steps
|
68
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
69
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
70
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance'
|
71
|
+
end
|
72
|
+
end
|
data/README.md
CHANGED
@@ -1,8 +1,28 @@
|
|
1
|
-
# Traxor [![CircleCI](https://circleci.com/gh/ketiko/traxor.svg?style=svg&circle-token=fd1e0d401eda8de60d31ca3dbb5fb066a71a9b9f)](https://circleci.com/gh/ketiko/traxor) [![Maintainability](https://api.codeclimate.com/v1/badges/d812a63d184fb6c88dbd/maintainability)](https://codeclimate.com/github/ketiko/traxor/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/d812a63d184fb6c88dbd/test_coverage)](https://codeclimate.com/github/ketiko/traxor/test_coverage)
|
1
|
+
# Traxor [![CircleCI](https://circleci.com/gh/ketiko/traxor.svg?style=svg&circle-token=fd1e0d401eda8de60d31ca3dbb5fb066a71a9b9f)](https://circleci.com/gh/ketiko/traxor) [![Build Status](https://travis-ci.org/ketiko/traxor.svg?branch=master)](https://travis-ci.org/ketiko/traxor) [![Maintainability](https://api.codeclimate.com/v1/badges/d812a63d184fb6c88dbd/maintainability)](https://codeclimate.com/github/ketiko/traxor/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/d812a63d184fb6c88dbd/test_coverage)](https://codeclimate.com/github/ketiko/traxor/test_coverage) [![Gem Version](https://badge.fury.io/rb/traxor.svg)](https://badge.fury.io/rb/traxor)
|
2
2
|
|
3
|
-
|
3
|
+
A tool for logging ruby application performance metrics to the [Akkeris](https://github.com/akkeris) platform.
|
4
4
|
|
5
|
-
|
5
|
+
Supported Gems:
|
6
|
+
|
7
|
+
- Rack
|
8
|
+
- Sidekiq
|
9
|
+
- Faraday
|
10
|
+
- ActionController
|
11
|
+
- ActionMailer
|
12
|
+
- ActiveRecord
|
13
|
+
- Rails
|
14
|
+
|
15
|
+
How does this help me?
|
16
|
+
|
17
|
+
It logs things that help you troubleshoot performance issues. Just some of the things it can help with:
|
18
|
+
|
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)
|
21
|
+
- How many ActiveRecord models are loaded in a request?
|
22
|
+
- Which sidekiq jobs are the slowest?
|
23
|
+
- How much time is being spent in calls to external services?
|
24
|
+
- How much time is being spent in garbage collection?
|
25
|
+
- How many objects are being loaded into memory on a request?
|
6
26
|
|
7
27
|
## Installation
|
8
28
|
|
@@ -22,7 +42,139 @@ Or install it yourself as:
|
|
22
42
|
|
23
43
|
## Usage
|
24
44
|
|
25
|
-
|
45
|
+
If you are running a rails application, just include the gem and nothing else is required.
|
46
|
+
It will automagically set everything up. Including the gem wires up a Rails initializer to setup Traxor for you.
|
47
|
+
|
48
|
+
Akkeris records metrics by reading them from the logs on `STDOUT`. This can get verbose in development, so when the rails
|
49
|
+
env is development or test, they are written to `./log/traxor.log`.
|
50
|
+
|
51
|
+
To record your own metrics you can use:
|
52
|
+
|
53
|
+
```
|
54
|
+
tags = { company: 'Company Name' }
|
55
|
+
Traxor::Metric.measure('duration', '10ms', tags)
|
56
|
+
Traxor::Metric.sample('memory', 500, tags)
|
57
|
+
Traxor::Metric.count('requests', 20, tags)
|
58
|
+
```
|
59
|
+
|
60
|
+
Traxor also supports recording tags for your metrics as the final argument.
|
61
|
+
|
62
|
+
We recommend using a leading prefix for all your metrics so they don't collide with others.
|
63
|
+
|
64
|
+
Metric names we be lower cased and underscored. Namespaces in class names will be replaced with a period.
|
65
|
+
|
66
|
+
IE:
|
67
|
+
|
68
|
+
```
|
69
|
+
module Animals
|
70
|
+
module FlyingBird; end
|
71
|
+
end
|
72
|
+
|
73
|
+
Traxor::Metric.count(Animals::FlyingBird, 1)
|
74
|
+
|
75
|
+
Ouputs:
|
76
|
+
|
77
|
+
'count#animals.flying_bird=1'
|
78
|
+
```
|
79
|
+
|
80
|
+
### Metrics Recorded:
|
81
|
+
|
82
|
+
All measure metrics are recorded in milliseconds. All count metrics are whole numbers.
|
83
|
+
|
84
|
+
#### Rails
|
85
|
+
|
86
|
+
Traxor records a number of metrics using [Rails instrumentation](http://guides.rubyonrails.org/active_support_instrumentation.html).
|
87
|
+
It will also insert a rack middleware at the start of the request and another at the end right before your application code is run.
|
88
|
+
This allows us to calculate how much time was spent in the rack middleware outside of your ActionController action.
|
89
|
+
|
90
|
+
Tags:
|
91
|
+
|
92
|
+
Traxor will track and log the controller name, action, and http method as tags on each request for you:
|
93
|
+
|
94
|
+
```
|
95
|
+
tags = { controller_name: 'MyController', controller_action: 'index', controller_method: :GET }
|
96
|
+
```
|
97
|
+
|
98
|
+
These tags will be applied to any metrics recorded during that request. So ActiveRecord metrics will
|
99
|
+
also have these tags if it occurs during the request.
|
100
|
+
|
101
|
+
Rails request:
|
102
|
+
|
103
|
+
```
|
104
|
+
count#rails.action_controller.count <- increment request count of controller action
|
105
|
+
measure#rails.action_controller.total_duration <- total duration of request inside controller action
|
106
|
+
measure#rails.action_controller.ruby.duration <- duration of time not spent in the view or db in the controller action
|
107
|
+
measure#rails.action_controller.db.duration <- duration of time spend in the db
|
108
|
+
measure#rails.action_controller.view.duration <- duration of time spend in the view layer
|
109
|
+
count#rails.action_controller.exception.count <- increment exceptions count
|
110
|
+
```
|
111
|
+
|
112
|
+
Rack request:
|
113
|
+
|
114
|
+
```
|
115
|
+
measure#rack.request.middleware.duration <- time spent in middleware outside of your rack application
|
116
|
+
measure#rack.request.duration <- total duration of the request
|
117
|
+
measure#rack.request.queue.duration <- duration of time spent from when your router received the request before your application started to process it
|
118
|
+
measure#count.rack.request.count <- increment rack request count
|
119
|
+
```
|
120
|
+
|
121
|
+
Note that the request queue time will read the `X-Request-Start` header in the request and calculate the number.
|
122
|
+
This is optional and does not have to be set. See [request queue server configuration examples](https://docs.newrelic.com/docs/apm/applications-menu/features/request-queue-server-configuration-examples)
|
123
|
+
for examples of how to configure this in your router.
|
124
|
+
|
125
|
+
GC During a Rack request:
|
126
|
+
|
127
|
+
```
|
128
|
+
measure#ruby.gc.duration <- total time spent in garage collection in a rack request
|
129
|
+
count#ruby.gc.count <- total number of gc runs during a rack request
|
130
|
+
count#ruby.gc.major.count <- total major gc runs during a rack request
|
131
|
+
count#ruby.gc.minor.count <- total minor gc runs during a rack request
|
132
|
+
count#ruby.gc.allocated_objects.count <- total number of new objects loaded into memory during a rack request
|
133
|
+
```
|
134
|
+
|
135
|
+
Note that the GC metrics are recorded by taking a sample before and after the request then calculating the delata.
|
136
|
+
As GC stats are per process, it is not a completely accurate way of recording things strictly during that request.
|
137
|
+
Other requests are also happening and throwing off these numbers. But it should help to give you an idea.
|
138
|
+
|
139
|
+
We also enable the `GC::Profiler` which does have a performance cost. In the future we could make this configurable.
|
140
|
+
|
141
|
+
ActiveRecord:
|
142
|
+
|
143
|
+
```
|
144
|
+
count#rails.active_record.statements.count tag#active_record_class_name=user <- total number of sql statements run tagged by active_record_class_name
|
145
|
+
count#rails.active_record.statements.select.count tag#active_record_class_name=user <- total number of select statements run tagged by active_record_class_name
|
146
|
+
count#rails.active_record.statements.insert.count tag#active_record_class_name=user <- total number of insert statements run tagged by active_record_class_name
|
147
|
+
count#rails.active_record.statements.update.count tag#active_record_class_name=user <- total number of update statements run tagged by active_record_class_name
|
148
|
+
count#rails.active_record.statements.delete.count tag#active_record_class_name=user <- total number of delete statements run tagged by active_record_class_name
|
149
|
+
count#rails.active_record.instantiation.count tag#active_record_class_name=user <- total number of ActiveRecord objects loaded from the db tagged by active_record_class_name
|
150
|
+
```
|
151
|
+
|
152
|
+
Note that these metrics will automatically be tagged with ActionController or Sidekiq tags if run during a request or worker.
|
153
|
+
|
154
|
+
ActionMailer:
|
155
|
+
|
156
|
+
```
|
157
|
+
count#rails.action_mailer.sent.count tag#mailer=user_mailer <- number of emails sent tagged by mailer name
|
158
|
+
```
|
159
|
+
|
160
|
+
Faraday:
|
161
|
+
|
162
|
+
To instrument requests to other sites include the [instrumentation middleware](https://github.com/lostisland/faraday_middleware/wiki/Instrumentation).
|
163
|
+
|
164
|
+
```
|
165
|
+
count#faraday.request.count tag#faraday_host=www.google.com tag#farday_method=get <- increment the request count tagged with host and method
|
166
|
+
measure#faraday.request.duration tag#faraday_host=www.google.com tag#farday_method=get <- duration of request tagged with host and method
|
167
|
+
```
|
168
|
+
|
169
|
+
Sidekiq:
|
170
|
+
|
171
|
+
```
|
172
|
+
measure#sidekiq.worker.duration tag#sidekiq_worker=my_worker tag#sidekiq_queue=default <- duration worker ran for tagged by sidekiq_worker and sidekiq_queue
|
173
|
+
count#sidekiq.worker.cout tag#sidekiq_worker=my_worker tag#sidekiq_queue=default <- increment worker count tagged by sidekiq_worker and sidekiq_queue
|
174
|
+
count#sidekiq.worker.exception.count tag#sidekiq_worker=my_worker tag#sidekiq_queue=default <- increment exception count tagged by sidekiq_worker and sidekiq_queue
|
175
|
+
```
|
176
|
+
|
177
|
+
Just like the controller tags, the Sidekiq tags will apply to any other metric recorded during a worker.
|
26
178
|
|
27
179
|
## Development
|
28
180
|
|
@@ -32,4 +184,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
184
|
|
33
185
|
## Contributing
|
34
186
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
187
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ketiko/traxor.
|
data/Rakefile
CHANGED
data/bin/_guard-core
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application '_guard-core' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
|
+
|
29
|
+
load Gem.bin_path('guard', '_guard-core')
|
data/bin/appraisal
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'appraisal' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
|
+
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
|
+
|
17
|
+
if File.file?(bundle_binstub)
|
18
|
+
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
|
19
|
+
load(bundle_binstub)
|
20
|
+
else
|
21
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
22
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
|
+
|
29
|
+
load Gem.bin_path('appraisal', 'appraisal')
|
data/bin/code_climate_reek
CHANGED
@@ -15,7 +15,7 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
|
15
15
|
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
|
-
if
|
18
|
+
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
|
19
19
|
load(bundle_binstub)
|
20
20
|
else
|
21
21
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
data/bin/console
CHANGED
data/bin/{lois → guard}
RENAMED
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# This file was generated by Bundler.
|
6
6
|
#
|
7
|
-
# The application '
|
7
|
+
# The application 'guard' is installed as part of a gem, and
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
@@ -15,7 +15,7 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
|
15
15
|
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
|
-
if
|
18
|
+
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
|
19
19
|
load(bundle_binstub)
|
20
20
|
else
|
21
21
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
@@ -26,4 +26,4 @@ end
|
|
26
26
|
require 'rubygems'
|
27
27
|
require 'bundler/setup'
|
28
28
|
|
29
|
-
load Gem.bin_path('
|
29
|
+
load Gem.bin_path('guard', 'guard')
|
data/bin/rake
CHANGED
@@ -15,7 +15,7 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
|
15
15
|
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
|
-
if
|
18
|
+
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
|
19
19
|
load(bundle_binstub)
|
20
20
|
else
|
21
21
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
data/bin/reek
CHANGED
@@ -15,7 +15,7 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
|
15
15
|
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
|
-
if
|
18
|
+
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
|
19
19
|
load(bundle_binstub)
|
20
20
|
else
|
21
21
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
data/bin/rspec
CHANGED
@@ -15,7 +15,7 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
|
15
15
|
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
|
-
if
|
18
|
+
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
|
19
19
|
load(bundle_binstub)
|
20
20
|
else
|
21
21
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
data/bin/rubocop
CHANGED
@@ -15,7 +15,7 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
|
15
15
|
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
|
-
if
|
18
|
+
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 150))
|
19
19
|
load(bundle_binstub)
|
20
20
|
else
|
21
21
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|