traxor 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/traxor/faraday.rb +2 -2
- data/lib/traxor/rails/action_controller.rb +8 -8
- data/lib/traxor/rails/active_record.rb +2 -2
- data/lib/traxor/sidekiq.rb +1 -1
- data/lib/traxor/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f653d55d85f92371818f8b7b54b042b2f3f5a22ff0132c79bd188b6394275e3f
|
4
|
+
data.tar.gz: 59b6e815cdba3b93aa754e5bceefd992a7f38c6112615ea9c0cf1ff9dcb0fcaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cdda8a4bd223a5eed22fc3069db8669c492e36f8d45a18ff85a1ded44a3c5db8d855b2b4c6ab3e13dfa9deb8b75f2ba90f14292858eed6a0efcae3530bac901
|
7
|
+
data.tar.gz: 92c9a20fac4f19a625659b2e74b6b4a9b6096d4d562897130aef16f2843b7214cb5df907a1a27839511af1b9bc881c3dbeaf94213cd44a02b14555914a58bccc
|
data/Gemfile.lock
CHANGED
data/lib/traxor/faraday.rb
CHANGED
@@ -2,10 +2,10 @@ module Traxor
|
|
2
2
|
ActiveSupport::Notifications.subscribe('request.faraday'.freeze) do |*args|
|
3
3
|
event = ActiveSupport::Notifications::Event.new(*args)
|
4
4
|
url = event.payload[:url]
|
5
|
-
duration = event.duration || 0.0
|
5
|
+
duration = (event.duration || 0.0).to_f
|
6
6
|
tags = { faraday_host: url.host, faraday_method: event.payload[:method] }
|
7
7
|
|
8
8
|
Metric.count 'faraday.request.count'.freeze, 1, tags
|
9
|
-
Metric.measure 'faraday.request.duration'.freeze, "#{duration.
|
9
|
+
Metric.measure 'faraday.request.duration'.freeze, "#{duration.round(2)}ms", tags if duration.positive?
|
10
10
|
end
|
11
11
|
end
|
@@ -11,16 +11,16 @@ module Traxor
|
|
11
11
|
ActiveSupport::Notifications.subscribe 'process_action.action_controller'.freeze do |*args|
|
12
12
|
event = ActiveSupport::Notifications::Event.new(*args)
|
13
13
|
exception = event.payload[:exception]
|
14
|
-
duration = event.duration || 0.0
|
15
|
-
db_runtime = event.payload[:db_runtime] || 0.0
|
16
|
-
view_runtime = event.payload[:view_runtime] || 0.0
|
17
|
-
ruby_runtime = duration
|
14
|
+
duration = (event.duration || 0.0).to_f
|
15
|
+
db_runtime = (event.payload[:db_runtime] || 0.0).to_f
|
16
|
+
view_runtime = (event.payload[:view_runtime] || 0.0).to_f
|
17
|
+
ruby_runtime = duration - db_runtime - view_runtime
|
18
18
|
|
19
19
|
Metric.count 'rails.action_controller.count'.freeze, 1
|
20
|
-
Metric.measure 'rails.action_controller.total.duration'.freeze, "#{duration.
|
21
|
-
Metric.measure 'rails.action_controller.ruby.duration'.freeze, "#{ruby_runtime.
|
22
|
-
Metric.measure 'rails.action_controller.db.duration'.freeze, "#{db_runtime.
|
23
|
-
Metric.measure 'rails.action_controller.view.duration'.freeze, "#{view_runtime.
|
20
|
+
Metric.measure 'rails.action_controller.total.duration'.freeze, "#{duration.round(2)}ms" if duration.positive?
|
21
|
+
Metric.measure 'rails.action_controller.ruby.duration'.freeze, "#{ruby_runtime.round(2)}ms" if ruby_runtime.positive?
|
22
|
+
Metric.measure 'rails.action_controller.db.duration'.freeze, "#{db_runtime.round(2)}ms" if db_runtime.positive?
|
23
|
+
Metric.measure 'rails.action_controller.view.duration'.freeze, "#{view_runtime.round(2)}ms" if view_runtime.positive?
|
24
24
|
Metric.count 'rails.action_controller.exception.count'.freeze, 1 if exception
|
25
25
|
end
|
26
26
|
end
|
@@ -16,9 +16,9 @@ module Traxor
|
|
16
16
|
|
17
17
|
ActiveSupport::Notifications.subscribe 'instantiation.active_record'.freeze do |*args|
|
18
18
|
event = ActiveSupport::Notifications::Event.new(*args)
|
19
|
-
record_count = event.payload[:record_count]
|
19
|
+
record_count = event.payload[:record_count].to_i
|
20
20
|
tags = { active_record_class_name: event.payload[:class_name] }
|
21
21
|
|
22
|
-
Metric.count 'rails.active_record.instantiation.count'.freeze, record_count, tags
|
22
|
+
Metric.count 'rails.active_record.instantiation.count'.freeze, record_count, tags if record_count.positive?
|
23
23
|
end
|
24
24
|
end
|
data/lib/traxor/sidekiq.rb
CHANGED
@@ -11,7 +11,7 @@ module Traxor
|
|
11
11
|
time = Benchmark.ms do
|
12
12
|
yield
|
13
13
|
end
|
14
|
-
Metric.measure 'sidekiq.worker.duration'.freeze, "#{time.round(2)}ms", tags
|
14
|
+
Metric.measure 'sidekiq.worker.duration'.freeze, "#{time.round(2)}ms", tags if time.positive?
|
15
15
|
Metric.count 'sidekiq.worker.count'.freeze, 1, tags
|
16
16
|
rescue StandardError
|
17
17
|
Metric.count 'sidekiq.worker.exception.count'.freeze, 1, tags
|
data/lib/traxor/version.rb
CHANGED