app_perf_rpm 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/app_perf_rpm/configuration.rb +1 -0
- data/lib/app_perf_rpm/instruments/roda.rb +46 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3acd152efd84397682641dd381b931c8a005251
|
4
|
+
data.tar.gz: 3f6b8ee3b1bc73675323e7050791511b725a2360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d60c4242d0f5d71a614bffba15b140a3d05b9b98a8eef9b51d080786802a31ab8bb34cdf69549c03445ae9e6aeb033f7d55caf0f0781291ab79604309b9020ed
|
7
|
+
data.tar.gz: 13ca881a617b1af03acc08c3a579de2678c240c0a746c77e2633417ad8a42678422e5a5e56b8548e387298653078d06ce5c08c836bf5449ffa4c51ad1de2cc6e
|
@@ -33,6 +33,7 @@ module AppPerfRpm
|
|
33
33
|
self.ignore_paths ||= /\/assets/
|
34
34
|
self.instrumentation = {
|
35
35
|
:rack => { :enabled => true, :backtrace => :app, :source => true, :trace_middleware => false },
|
36
|
+
:roda => { :enabled => true, :backtrace => :app, :source => true },
|
36
37
|
:active_record => { :enabled => true, :backtrace => :app, :source => true },
|
37
38
|
:active_record_import => { :enabled => true, :backtrace => :app, :source => true },
|
38
39
|
:active_model_serializer => { :enabled => true, :backtrace => :app, :source => true },
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module AppPerf
|
2
|
+
module Instruments
|
3
|
+
module Roda
|
4
|
+
def call_with_trace(&block)
|
5
|
+
if AppPerfRpm::Tracer.tracing?
|
6
|
+
req = ::Rack::Request.new(env)
|
7
|
+
request_method = req.request_method.to_s.upcase
|
8
|
+
path = req.path
|
9
|
+
|
10
|
+
parts = path.to_s.rpartition("/")
|
11
|
+
action = parts.last
|
12
|
+
controller = parts.first.sub(/\A\//, '').split("/").collect {|w| w.capitalize }.join("::")
|
13
|
+
operation = "#{controller}##{action}"
|
14
|
+
|
15
|
+
span = AppPerfRpm.tracer.start_span(operation, tags: {
|
16
|
+
"component" => "Roda",
|
17
|
+
"http.url" => path,
|
18
|
+
"http.method" => request_method,
|
19
|
+
"params" => @_request.params
|
20
|
+
})
|
21
|
+
AppPerfRpm::Utils.log_source_and_backtrace(span, :roda)
|
22
|
+
end
|
23
|
+
|
24
|
+
call_without_trace(&block)
|
25
|
+
rescue Exception => e
|
26
|
+
if span
|
27
|
+
span.set_tag('error', true)
|
28
|
+
span.log_error(e)
|
29
|
+
end
|
30
|
+
raise
|
31
|
+
ensure
|
32
|
+
span.finish if span
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
if defined?(::Roda) && ::AppPerfRpm.config.instrumentation[:roda][:enabled]
|
39
|
+
::AppPerfRpm.logger.info "Initializing roda tracer."
|
40
|
+
|
41
|
+
::Roda::RodaPlugins::Base::InstanceMethods.send(:include, AppPerf::Instruments::Roda)
|
42
|
+
::Roda::RodaPlugins::Base::InstanceMethods.class_eval do
|
43
|
+
alias_method :call_without_trace, :call
|
44
|
+
alias_method :call, :call_with_trace
|
45
|
+
end
|
46
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_perf_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Randy Girard
|
@@ -173,6 +173,7 @@ files:
|
|
173
173
|
- lib/app_perf_rpm/instruments/net_http.rb
|
174
174
|
- lib/app_perf_rpm/instruments/rack.rb
|
175
175
|
- lib/app_perf_rpm/instruments/redis.rb
|
176
|
+
- lib/app_perf_rpm/instruments/roda.rb
|
176
177
|
- lib/app_perf_rpm/instruments/sequel.rb
|
177
178
|
- lib/app_perf_rpm/instruments/sidekiq.rb
|
178
179
|
- lib/app_perf_rpm/instruments/sinatra.rb
|