Module: AppPerfRpm
- Defined in:
- lib/app_perf_rpm.rb,
lib/app_perf_rpm/span.rb,
lib/app_perf_rpm/utils.rb,
lib/app_perf_rpm/logger.rb,
lib/app_perf_rpm/tracer.rb,
lib/app_perf_rpm/worker.rb,
lib/app_perf_rpm/railtie.rb,
lib/app_perf_rpm/backtrace.rb,
lib/app_perf_rpm/aggregator.rb,
lib/app_perf_rpm/dispatcher.rb,
lib/app_perf_rpm/middleware.rb,
lib/app_perf_rpm/introspector.rb,
lib/app_perf_rpm/configuration.rb,
lib/app_perf_rpm/instrumentation.rb,
lib/app_perf_rpm/instruments/rack.rb,
lib/app_perf_rpm/instruments/sequel.rb,
lib/app_perf_rpm/instruments/faraday.rb,
lib/app_perf_rpm/instruments/sidekiq.rb,
lib/app_perf_rpm/instruments/sinatra.rb,
lib/app_perf_rpm/instruments/typhoeus.rb,
lib/app_perf_rpm/instruments/active_record.rb,
lib/app_perf_rpm/instruments/emque_consuming.rb,
lib/app_perf_rpm/instruments/rack_middleware.rb,
lib/app_perf_rpm/instruments/action_controller.rb,
lib/app_perf_rpm/instruments/activerecord_import.rb,
lib/app_perf_rpm/instruments/active_record/adapters/mysql2.rb,
lib/app_perf_rpm/instruments/active_record/adapters/sqlite3.rb,
lib/app_perf_rpm/instruments/active_record/adapters/postgresql.rb
Defined Under Namespace
Modules: Instruments, Utils
Classes: Aggregator, Backtrace, Configuration, Dispatcher, Instrumentation, Introspector, Logger, Middleware, Railtie, SidekiqClient, SidekiqServer, Span, Tracer, Worker
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
21
22
23
|
# File 'lib/app_perf_rpm.rb', line 21
def configuration
@configuration ||= Configuration.new
end
|
.logger ⇒ Object
Returns the value of attribute logger.
5
6
7
|
# File 'lib/app_perf_rpm/logger.rb', line 5
def logger
@logger
end
|
Class Method Details
25
26
27
|
# File 'lib/app_perf_rpm.rb', line 25
def configure
yield(configuration)
end
|
.disable_agent? ⇒ Boolean
113
114
115
116
117
118
119
120
121
|
# File 'lib/app_perf_rpm.rb', line 113
def disable_agent?
if configuration.agent_disabled
true
elsif Introspector.agentable?
false
else
true
end
end
|
.floor_time(t, sec = 1) ⇒ Object
109
110
111
|
# File 'lib/app_perf_rpm.rb', line 109
def floor_time(t, sec = 1)
Time.at((t.to_f / sec).floor * sec)
end
|
.host ⇒ Object
89
90
91
|
# File 'lib/app_perf_rpm.rb', line 89
def host
@host ||= Socket.gethostname
end
|
.mutex ⇒ Object
46
47
48
|
# File 'lib/app_perf_rpm.rb', line 46
def mutex
@mutex ||= Mutex.new
end
|
.round_time(t, sec = 1) ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/app_perf_rpm.rb', line 93
def round_time(t, sec = 1)
t = Time.parse(t.to_s)
down = t - (t.to_i % sec)
up = down + sec
difference_down = t - down
difference_up = up - t
if (difference_down < difference_up)
return down
else
return up
end
end
|
.store(event) ⇒ Object
50
51
52
53
54
55
|
# File 'lib/app_perf_rpm.rb', line 50
def store(event)
if @worker_running && tracing?
@worker.save(event)
end
event
end
|
.tracing? ⇒ Boolean
75
76
77
|
# File 'lib/app_perf_rpm.rb', line 75
def tracing?
@tracing
end
|
.tracing_off ⇒ Object
68
69
70
71
72
73
|
# File 'lib/app_perf_rpm.rb', line 68
def tracing_off
mutex.synchronize do
AppPerfRpm.logger.debug "Disabling tracing."
@tracing = false
end
end
|
.tracing_on ⇒ Object
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/app_perf_rpm.rb', line 57
def tracing_on
if @without_tracing_enabled
AppPerfRpm.logger.debug "Not turning tracing on due to without tracing mode."
return
end
mutex.synchronize do
AppPerfRpm.logger.debug "Enabling tracing."
@tracing = true
end
end
|
.without_tracing ⇒ Object
.worker ⇒ Object
42
43
44
|
# File 'lib/app_perf_rpm.rb', line 42
def worker
@worker
end
|