appsignal 4.8.6-java → 4.9.0-java
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/CHANGELOG.md +49 -0
- data/appsignal.gemspec +2 -2
- data/build_matrix.yml +25 -0
- data/ext/base.rb +3 -7
- data/ext/extconf.rb +1 -1
- data/lib/appsignal/check_in/event.rb +5 -4
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/cli/helpers.rb +2 -2
- data/lib/appsignal/cli/install.rb +3 -3
- data/lib/appsignal/config.rb +44 -1
- data/lib/appsignal/environment.rb +1 -0
- data/lib/appsignal/extension/jruby.rb +6 -5
- data/lib/appsignal/extension.rb +1 -1
- data/lib/appsignal/helpers/instrumentation.rb +12 -12
- data/lib/appsignal/hooks/action_cable.rb +2 -2
- data/lib/appsignal/hooks/active_job.rb +42 -3
- data/lib/appsignal/hooks/delayed_job.rb +2 -1
- data/lib/appsignal/hooks/excon.rb +1 -1
- data/lib/appsignal/hooks/faraday.rb +21 -0
- data/lib/appsignal/hooks/http.rb +9 -0
- data/lib/appsignal/hooks/mongo_ruby_driver.rb +2 -1
- data/lib/appsignal/hooks/que.rb +7 -1
- data/lib/appsignal/hooks/resque.rb +5 -1
- data/lib/appsignal/hooks/shoryuken.rb +15 -1
- data/lib/appsignal/hooks/sidekiq.rb +14 -1
- data/lib/appsignal/hooks.rb +1 -0
- data/lib/appsignal/integrations/action_cable.rb +1 -1
- data/lib/appsignal/integrations/active_support_notifications.rb +19 -6
- data/lib/appsignal/integrations/delayed_job_plugin.rb +38 -1
- data/lib/appsignal/integrations/excon.rb +8 -0
- data/lib/appsignal/integrations/faraday.rb +51 -0
- data/lib/appsignal/integrations/http.rb +9 -0
- data/lib/appsignal/integrations/mongo_ruby_driver.rb +4 -2
- data/lib/appsignal/integrations/net_http.rb +7 -0
- data/lib/appsignal/integrations/object.rb +3 -3
- data/lib/appsignal/integrations/que.rb +68 -1
- data/lib/appsignal/integrations/rake.rb +1 -1
- data/lib/appsignal/integrations/resque.rb +20 -1
- data/lib/appsignal/integrations/shoryuken.rb +33 -1
- data/lib/appsignal/integrations/sidekiq.rb +73 -36
- data/lib/appsignal/integrations/webmachine.rb +1 -1
- data/lib/appsignal/logger.rb +4 -1
- data/lib/appsignal/rack/abstract_middleware.rb +1 -1
- data/lib/appsignal/rack/body_wrapper.rb +5 -5
- data/lib/appsignal/rack/hanami_middleware.rb +1 -0
- data/lib/appsignal/sample_data.rb +1 -0
- data/lib/appsignal/transaction.rb +59 -11
- data/lib/appsignal/utils/query_params_sanitizer.rb +2 -0
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +2 -2
- data/lib/puma/plugin/appsignal.rb +1 -1
- data/sig/appsignal.rbi +41 -1
- data/sig/appsignal.rbs +30 -0
- metadata +7 -6
- data/lib/appsignal/event_formatter/faraday/request_formatter.rb +0 -24
|
@@ -49,6 +49,76 @@ module Appsignal
|
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
+
# Resolves the name of a Sidekiq job. That's normally the job class, but
|
|
53
|
+
# the Sidekiq delayed extensions encode the real target and method as YAML
|
|
54
|
+
# in the job's first argument, so those are decoded into a `Target.method`
|
|
55
|
+
# (class) or `Target#method` (instance) name.
|
|
56
|
+
#
|
|
57
|
+
# Shared between the client middleware, which titles the enqueue event with
|
|
58
|
+
# it, and the server middleware, which names the perform transaction with
|
|
59
|
+
# it. The same job then reads the same name on both sides.
|
|
60
|
+
#
|
|
61
|
+
# @!visibility private
|
|
62
|
+
module SidekiqActionName
|
|
63
|
+
module_function
|
|
64
|
+
|
|
65
|
+
# Based on: https://github.com/mperham/sidekiq/blob/63ee43353bd3b753beb0233f64865e658abeb1c3/lib/sidekiq/api.rb#L316-L334
|
|
66
|
+
def parse_action_name(job)
|
|
67
|
+
args = job.fetch("args", [])
|
|
68
|
+
job_class = job["class"]
|
|
69
|
+
case job_class
|
|
70
|
+
when "Sidekiq::Extensions::DelayedModel"
|
|
71
|
+
safe_load(args[0], job_class) do |target, method, _|
|
|
72
|
+
"#{target.class}##{method}"
|
|
73
|
+
end
|
|
74
|
+
when /\ASidekiq::Extensions::Delayed/
|
|
75
|
+
safe_load(args[0], job_class) do |target, method, _|
|
|
76
|
+
"#{target}.#{method}"
|
|
77
|
+
end
|
|
78
|
+
else
|
|
79
|
+
job_class
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Based on: https://github.com/mperham/sidekiq/blob/63ee43353bd3b753beb0233f64865e658abeb1c3/lib/sidekiq/api.rb#L403-L412
|
|
84
|
+
def safe_load(content, default)
|
|
85
|
+
if Gem::Version.new(YAML::VERSION) >= Gem::Version.new("4.0.0")
|
|
86
|
+
yield(*YAML.unsafe_load(content))
|
|
87
|
+
else
|
|
88
|
+
yield(*YAML.load(content)) # rubocop:disable Security/YAMLLoad
|
|
89
|
+
end
|
|
90
|
+
rescue => error
|
|
91
|
+
# Sidekiq issue #1761: in dev mode, it's possible to have jobs enqueued
|
|
92
|
+
# which haven't been loaded into memory yet so the YAML can't be
|
|
93
|
+
# loaded.
|
|
94
|
+
Appsignal.internal_logger.warn(
|
|
95
|
+
"Unable to load YAML from Sidekiq delayed extension job: #{error.message}"
|
|
96
|
+
)
|
|
97
|
+
default
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Sidekiq client middleware that runs on enqueue. Records an
|
|
102
|
+
# `enqueue.sidekiq` event so the enqueue shows up under the active
|
|
103
|
+
# transaction.
|
|
104
|
+
#
|
|
105
|
+
# Like all AppSignal events, this only records when there's an active
|
|
106
|
+
# transaction (e.g. enqueuing from within a web request or another job). An
|
|
107
|
+
# enqueue with no transaction is a transparent pass-through.
|
|
108
|
+
#
|
|
109
|
+
# @!visibility private
|
|
110
|
+
class SidekiqClientMiddleware
|
|
111
|
+
def call(_worker_class, job, _queue, _redis_pool, &block)
|
|
112
|
+
# Under Active Job the enqueue is already recorded as an
|
|
113
|
+
# `enqueue.active_job` event, so skip recording it again here.
|
|
114
|
+
return yield if Appsignal::Transaction.current? &&
|
|
115
|
+
Appsignal::Transaction.current.job_enqueue_events_suppressed?
|
|
116
|
+
|
|
117
|
+
title = "enqueue #{SidekiqActionName.parse_action_name(job)} job"
|
|
118
|
+
Appsignal.instrument("enqueue.sidekiq", title, &block)
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
52
122
|
# @!visibility private
|
|
53
123
|
class SidekiqMiddleware
|
|
54
124
|
include Appsignal::Hooks::Helpers
|
|
@@ -77,7 +147,7 @@ module Appsignal
|
|
|
77
147
|
|
|
78
148
|
begin
|
|
79
149
|
Appsignal.instrument "perform_job.sidekiq", &block
|
|
80
|
-
rescue Exception => exception
|
|
150
|
+
rescue Exception => exception
|
|
81
151
|
job_status = :failed
|
|
82
152
|
raise exception
|
|
83
153
|
ensure
|
|
@@ -124,7 +194,7 @@ module Appsignal
|
|
|
124
194
|
end
|
|
125
195
|
|
|
126
196
|
def formatted_action_name(job)
|
|
127
|
-
sidekiq_action_name = parse_action_name(job)
|
|
197
|
+
sidekiq_action_name = SidekiqActionName.parse_action_name(job)
|
|
128
198
|
return unless sidekiq_action_name
|
|
129
199
|
|
|
130
200
|
complete_action = sidekiq_action_name =~ /\.|#/
|
|
@@ -143,30 +213,12 @@ module Appsignal
|
|
|
143
213
|
end
|
|
144
214
|
end
|
|
145
215
|
|
|
146
|
-
# Based on: https://github.com/mperham/sidekiq/blob/63ee43353bd3b753beb0233f64865e658abeb1c3/lib/sidekiq/api.rb#L316-L334
|
|
147
|
-
def parse_action_name(job)
|
|
148
|
-
args = job.fetch("args", [])
|
|
149
|
-
job_class = job["class"]
|
|
150
|
-
case job_class
|
|
151
|
-
when "Sidekiq::Extensions::DelayedModel"
|
|
152
|
-
safe_load(args[0], job_class) do |target, method, _|
|
|
153
|
-
"#{target.class}##{method}"
|
|
154
|
-
end
|
|
155
|
-
when /\ASidekiq::Extensions::Delayed/
|
|
156
|
-
safe_load(args[0], job_class) do |target, method, _|
|
|
157
|
-
"#{target}.#{method}"
|
|
158
|
-
end
|
|
159
|
-
else
|
|
160
|
-
job_class
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
|
|
164
216
|
# Based on: https://github.com/mperham/sidekiq/blob/63ee43353bd3b753beb0233f64865e658abeb1c3/lib/sidekiq/api.rb#L336-L358
|
|
165
217
|
def parse_arguments(job)
|
|
166
218
|
args = job.fetch("args", [])
|
|
167
219
|
case job["class"]
|
|
168
220
|
when /\ASidekiq::Extensions::Delayed/
|
|
169
|
-
safe_load(args[0], args) do |_, _, arg|
|
|
221
|
+
SidekiqActionName.safe_load(args[0], args) do |_, _, arg|
|
|
170
222
|
arg
|
|
171
223
|
end
|
|
172
224
|
else
|
|
@@ -179,21 +231,6 @@ module Appsignal
|
|
|
179
231
|
args
|
|
180
232
|
end
|
|
181
233
|
end
|
|
182
|
-
|
|
183
|
-
# Based on: https://github.com/mperham/sidekiq/blob/63ee43353bd3b753beb0233f64865e658abeb1c3/lib/sidekiq/api.rb#L403-L412
|
|
184
|
-
def safe_load(content, default)
|
|
185
|
-
if YAML::VERSION >= "4.0.0"
|
|
186
|
-
yield(*YAML.unsafe_load(content))
|
|
187
|
-
else
|
|
188
|
-
yield(*YAML.load(content))
|
|
189
|
-
end
|
|
190
|
-
rescue => error
|
|
191
|
-
# Sidekiq issue #1761: in dev mode, it's possible to have jobs enqueued
|
|
192
|
-
# which haven't been loaded into memory yet so the YAML can't be
|
|
193
|
-
# loaded.
|
|
194
|
-
Appsignal.internal_logger.warn "Unable to load YAML: #{error.message}"
|
|
195
|
-
default
|
|
196
|
-
end
|
|
197
234
|
end
|
|
198
235
|
end
|
|
199
236
|
end
|
data/lib/appsignal/logger.rb
CHANGED
|
@@ -67,6 +67,8 @@ module Appsignal
|
|
|
67
67
|
# @return [Integer]
|
|
68
68
|
attr_reader :level
|
|
69
69
|
|
|
70
|
+
# rubocop:disable Lint/MissingSuper
|
|
71
|
+
|
|
70
72
|
# Create a new logger instance
|
|
71
73
|
#
|
|
72
74
|
# @param group [String] Name of the group for this logger.
|
|
@@ -87,6 +89,7 @@ module Appsignal
|
|
|
87
89
|
@appsignal_attributes = attributes
|
|
88
90
|
@loggers = []
|
|
89
91
|
end
|
|
92
|
+
# rubocop:enable Lint/MissingSuper
|
|
90
93
|
|
|
91
94
|
# Sets the formatter for this logger and all broadcasted loggers.
|
|
92
95
|
# @param formatter [Proc] The formatter to use for log messages.
|
|
@@ -101,7 +104,7 @@ module Appsignal
|
|
|
101
104
|
# We support the various methods in the Ruby
|
|
102
105
|
# logger class by supplying this method.
|
|
103
106
|
# @!visibility private
|
|
104
|
-
def add(severity, message = nil, group = nil, &block)
|
|
107
|
+
def add(severity, message = nil, group = nil, &block)
|
|
105
108
|
# If we do not need to broadcast to any loggers and the severity is
|
|
106
109
|
# below the log level, we can return early.
|
|
107
110
|
severity ||= UNKNOWN
|
|
@@ -108,7 +108,7 @@ module Appsignal
|
|
|
108
108
|
# @see #instrument_app_call
|
|
109
109
|
def instrument_app_call_with_exception_handling(env, transaction, wrapped_instrumentation)
|
|
110
110
|
instrument_app_call(env, transaction)
|
|
111
|
-
rescue Exception => error
|
|
111
|
+
rescue Exception => error
|
|
112
112
|
report_errors =
|
|
113
113
|
if @report_errors == DEFAULT_ERROR_REPORTING
|
|
114
114
|
# If there's no parent transaction, report the error
|
|
@@ -53,7 +53,7 @@ module Appsignal
|
|
|
53
53
|
@body_already_closed = true
|
|
54
54
|
rescue *IGNORED_ERRORS # Do not report
|
|
55
55
|
raise
|
|
56
|
-
rescue Exception => error
|
|
56
|
+
rescue Exception => error
|
|
57
57
|
appsignal_report_error(error)
|
|
58
58
|
raise error
|
|
59
59
|
end
|
|
@@ -109,7 +109,7 @@ module Appsignal
|
|
|
109
109
|
end
|
|
110
110
|
rescue *IGNORED_ERRORS # Do not report
|
|
111
111
|
raise
|
|
112
|
-
rescue Exception => error
|
|
112
|
+
rescue Exception => error
|
|
113
113
|
appsignal_report_error(error)
|
|
114
114
|
raise error
|
|
115
115
|
end
|
|
@@ -130,7 +130,7 @@ module Appsignal
|
|
|
130
130
|
end
|
|
131
131
|
rescue *IGNORED_ERRORS # Do not report
|
|
132
132
|
raise
|
|
133
|
-
rescue Exception => error
|
|
133
|
+
rescue Exception => error
|
|
134
134
|
appsignal_report_error(error)
|
|
135
135
|
raise error
|
|
136
136
|
end
|
|
@@ -156,7 +156,7 @@ module Appsignal
|
|
|
156
156
|
end
|
|
157
157
|
rescue *IGNORED_ERRORS # Do not report
|
|
158
158
|
raise
|
|
159
|
-
rescue Exception => error
|
|
159
|
+
rescue Exception => error
|
|
160
160
|
appsignal_report_error(error)
|
|
161
161
|
raise error
|
|
162
162
|
end
|
|
@@ -174,7 +174,7 @@ module Appsignal
|
|
|
174
174
|
end
|
|
175
175
|
rescue *IGNORED_ERRORS # Do not report
|
|
176
176
|
raise
|
|
177
|
-
rescue Exception => error
|
|
177
|
+
rescue Exception => error
|
|
178
178
|
appsignal_report_error(error)
|
|
179
179
|
raise error
|
|
180
180
|
end
|
|
@@ -14,6 +14,7 @@ module Appsignal
|
|
|
14
14
|
|
|
15
15
|
HANAMI_ACTION_INSTANCE = "hanami.action_instance"
|
|
16
16
|
ROUTER_PARAMS = "router.params"
|
|
17
|
+
private_constant :HANAMI_ACTION_INSTANCE, :ROUTER_PARAMS
|
|
17
18
|
|
|
18
19
|
def add_transaction_metadata_after(transaction, request)
|
|
19
20
|
action_name = fetch_hanami_action(request.env)
|
|
@@ -290,6 +290,53 @@ module Appsignal
|
|
|
290
290
|
@store[key]
|
|
291
291
|
end
|
|
292
292
|
|
|
293
|
+
# @!visibility private
|
|
294
|
+
#
|
|
295
|
+
# Run a block during which downstream HTTP client integrations (Net::HTTP,
|
|
296
|
+
# ...) skip recording their own event. Used when an outer HTTP client
|
|
297
|
+
# integration (Faraday) already records the request, so the same request is
|
|
298
|
+
# not instrumented twice as nested client events.
|
|
299
|
+
def suppress_http_client_events
|
|
300
|
+
# Restore the previous value rather than forcing `false`, so nested calls
|
|
301
|
+
# don't unsuppress while an outer block is still active.
|
|
302
|
+
previously_suppressed = store("http_client")[:suppressed]
|
|
303
|
+
store("http_client")[:suppressed] = true
|
|
304
|
+
yield
|
|
305
|
+
ensure
|
|
306
|
+
store("http_client")[:suppressed] = previously_suppressed
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
# @!visibility private
|
|
310
|
+
def http_client_events_suppressed?
|
|
311
|
+
store("http_client")[:suppressed] == true
|
|
312
|
+
end
|
|
313
|
+
|
|
314
|
+
# @!visibility private
|
|
315
|
+
#
|
|
316
|
+
# Run a block during which nested job enqueue integrations (Sidekiq, Resque,
|
|
317
|
+
# ...) skip recording their own enqueue event. Used when an outer integration
|
|
318
|
+
# (Active Job) already records the enqueue, so the same enqueue is not
|
|
319
|
+
# instrumented twice as nested enqueue events.
|
|
320
|
+
def suppress_job_enqueue_events
|
|
321
|
+
# Restore the previous value rather than forcing `false`, so nested calls
|
|
322
|
+
# don't unsuppress while an outer block is still active.
|
|
323
|
+
previously_suppressed = store("job_enqueue")[:suppressed]
|
|
324
|
+
store("job_enqueue")[:suppressed] = true
|
|
325
|
+
yield
|
|
326
|
+
ensure
|
|
327
|
+
store("job_enqueue")[:suppressed] = previously_suppressed
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
# @!visibility private
|
|
331
|
+
def job_enqueue_events_suppressed?
|
|
332
|
+
# When enqueue instrumentation is disabled, every enqueue integration
|
|
333
|
+
# treats its event as suppressed. That is how the config option turns the
|
|
334
|
+
# enqueue events off across all integrations at once.
|
|
335
|
+
return true if Appsignal.config && !Appsignal.config[:enable_job_enqueue_instrumentation]
|
|
336
|
+
|
|
337
|
+
store("job_enqueue")[:suppressed] == true
|
|
338
|
+
end
|
|
339
|
+
|
|
293
340
|
# Add parameters to the transaction.
|
|
294
341
|
#
|
|
295
342
|
# When this method is called multiple times, it will merge the request parameters.
|
|
@@ -311,7 +358,7 @@ module Appsignal
|
|
|
311
358
|
def add_params(given_params = nil, &block)
|
|
312
359
|
@params.add(given_params, &block)
|
|
313
360
|
end
|
|
314
|
-
alias
|
|
361
|
+
alias set_params add_params
|
|
315
362
|
|
|
316
363
|
# @since 4.0.0
|
|
317
364
|
# @return [void]
|
|
@@ -337,7 +384,7 @@ module Appsignal
|
|
|
337
384
|
def add_params_if_nil(given_params = nil, &block)
|
|
338
385
|
add_params(given_params, &block) if !@params.value? && !@params.empty?
|
|
339
386
|
end
|
|
340
|
-
alias
|
|
387
|
+
alias set_params_if_nil add_params_if_nil
|
|
341
388
|
|
|
342
389
|
# Add tags to the transaction.
|
|
343
390
|
#
|
|
@@ -357,7 +404,7 @@ module Appsignal
|
|
|
357
404
|
def add_tags(given_tags = {})
|
|
358
405
|
@tags.merge!(given_tags)
|
|
359
406
|
end
|
|
360
|
-
alias
|
|
407
|
+
alias set_tags add_tags
|
|
361
408
|
|
|
362
409
|
# Add session data to the transaction.
|
|
363
410
|
#
|
|
@@ -379,7 +426,7 @@ module Appsignal
|
|
|
379
426
|
def add_session_data(given_session_data = nil, &block)
|
|
380
427
|
@session_data.add(given_session_data, &block)
|
|
381
428
|
end
|
|
382
|
-
alias
|
|
429
|
+
alias set_session_data add_session_data
|
|
383
430
|
|
|
384
431
|
# Set session data on the transaction if not already set.
|
|
385
432
|
#
|
|
@@ -401,7 +448,7 @@ module Appsignal
|
|
|
401
448
|
def add_session_data_if_nil(given_session_data = nil, &block)
|
|
402
449
|
add_session_data(given_session_data, &block) unless @session_data.value?
|
|
403
450
|
end
|
|
404
|
-
alias
|
|
451
|
+
alias set_session_data_if_nil add_session_data_if_nil
|
|
405
452
|
|
|
406
453
|
# Add headers to the transaction.
|
|
407
454
|
#
|
|
@@ -418,7 +465,7 @@ module Appsignal
|
|
|
418
465
|
def add_headers(given_headers = nil, &block)
|
|
419
466
|
@headers.add(given_headers, &block)
|
|
420
467
|
end
|
|
421
|
-
alias
|
|
468
|
+
alias set_headers add_headers
|
|
422
469
|
|
|
423
470
|
# Add headers to the transaction if not already set.
|
|
424
471
|
#
|
|
@@ -439,7 +486,7 @@ module Appsignal
|
|
|
439
486
|
def add_headers_if_nil(given_headers = nil, &block)
|
|
440
487
|
add_headers(given_headers, &block) unless @headers.value?
|
|
441
488
|
end
|
|
442
|
-
alias
|
|
489
|
+
alias set_headers_if_nil add_headers_if_nil
|
|
443
490
|
|
|
444
491
|
# Add custom data to the transaction.
|
|
445
492
|
#
|
|
@@ -454,7 +501,7 @@ module Appsignal
|
|
|
454
501
|
def add_custom_data(data)
|
|
455
502
|
@custom_data.add(data)
|
|
456
503
|
end
|
|
457
|
-
alias
|
|
504
|
+
alias set_custom_data add_custom_data
|
|
458
505
|
|
|
459
506
|
# Add breadcrumbs to the transaction.
|
|
460
507
|
#
|
|
@@ -601,8 +648,8 @@ module Appsignal
|
|
|
601
648
|
error = error.cause
|
|
602
649
|
end
|
|
603
650
|
end
|
|
604
|
-
alias
|
|
605
|
-
|
|
651
|
+
alias set_error add_error
|
|
652
|
+
alias add_exception add_error
|
|
606
653
|
|
|
607
654
|
# @!visibility private
|
|
608
655
|
# @see Helpers::Instrumentation#instrument
|
|
@@ -654,7 +701,7 @@ module Appsignal
|
|
|
654
701
|
def to_h
|
|
655
702
|
JSON.parse(@ext.to_json)
|
|
656
703
|
end
|
|
657
|
-
|
|
704
|
+
alias to_hash to_h
|
|
658
705
|
|
|
659
706
|
protected
|
|
660
707
|
|
|
@@ -738,6 +785,7 @@ module Appsignal
|
|
|
738
785
|
|
|
739
786
|
BACKTRACE_REGEX =
|
|
740
787
|
%r{(?<gem>[\w-]+ \(.+\) )?(?<path>:?/?\w+?.+?):(?<line>:?\d+)(?::in `(?<method>.+)')?$}.freeze
|
|
788
|
+
private_constant :BACKTRACE_REGEX
|
|
741
789
|
|
|
742
790
|
def first_formatted_backtrace_line(error)
|
|
743
791
|
backtrace = cleaned_backtrace(error.backtrace)
|
|
@@ -6,6 +6,7 @@ module Appsignal
|
|
|
6
6
|
REPLACEMENT_KEY = "?"
|
|
7
7
|
|
|
8
8
|
module ClassMethods
|
|
9
|
+
# rubocop:disable Style/OptionalBooleanParameter
|
|
9
10
|
def sanitize(params, only_top_level = false, key_sanitizer = nil)
|
|
10
11
|
case params
|
|
11
12
|
when Hash
|
|
@@ -16,6 +17,7 @@ module Appsignal
|
|
|
16
17
|
REPLACEMENT_KEY
|
|
17
18
|
end
|
|
18
19
|
end
|
|
20
|
+
# rubocop:enable Style/OptionalBooleanParameter
|
|
19
21
|
|
|
20
22
|
private
|
|
21
23
|
|
data/lib/appsignal/version.rb
CHANGED
data/lib/appsignal.rb
CHANGED
|
@@ -105,7 +105,7 @@ module Appsignal
|
|
|
105
105
|
#
|
|
106
106
|
# @return [void]
|
|
107
107
|
# @since 0.7.0
|
|
108
|
-
def start
|
|
108
|
+
def start
|
|
109
109
|
if ENV.fetch("_APPSIGNAL_DIAGNOSE", false)
|
|
110
110
|
internal_logger.info("Skipping start in diagnose context")
|
|
111
111
|
return
|
|
@@ -169,7 +169,7 @@ module Appsignal
|
|
|
169
169
|
# @param block [Proc] Optional block to configure the config object.
|
|
170
170
|
# @return [void]
|
|
171
171
|
# @!visibility private
|
|
172
|
-
def _load_config!(env_param = nil, &block)
|
|
172
|
+
def _load_config!(env_param = nil, &block)
|
|
173
173
|
# Ensure it's not an empty string if it's a value
|
|
174
174
|
proper_env_param = env_param&.to_s&.strip
|
|
175
175
|
# Unset it if it's an empty string
|
|
@@ -8,7 +8,7 @@ require "json"
|
|
|
8
8
|
#
|
|
9
9
|
# For even more information:
|
|
10
10
|
# https://docs.appsignal.com/ruby/integrations/puma.html
|
|
11
|
-
Puma::Plugin.create do
|
|
11
|
+
Puma::Plugin.create do
|
|
12
12
|
def start(launcher)
|
|
13
13
|
@launcher = launcher
|
|
14
14
|
log_debug "AppSignal: Puma plugin start."
|
data/sig/appsignal.rbi
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
module Appsignal
|
|
9
9
|
extend Appsignal::Helpers::Metrics
|
|
10
10
|
extend Appsignal::Helpers::Instrumentation
|
|
11
|
-
VERSION = T.let("4.
|
|
11
|
+
VERSION = T.let("4.9.0", T.untyped)
|
|
12
12
|
|
|
13
13
|
class << self
|
|
14
14
|
# The loaded AppSignal configuration.
|
|
@@ -1182,6 +1182,10 @@ module Appsignal
|
|
|
1182
1182
|
sig { returns(T::Boolean) }
|
|
1183
1183
|
attr_accessor :enable_host_metrics
|
|
1184
1184
|
|
|
1185
|
+
# _@return_ — Configure whether to record an event when a background job is enqueued
|
|
1186
|
+
sig { returns(T::Boolean) }
|
|
1187
|
+
attr_accessor :enable_job_enqueue_instrumentation
|
|
1188
|
+
|
|
1185
1189
|
# _@return_ — Configure whether minutely probes are enabled
|
|
1186
1190
|
sig { returns(T::Boolean) }
|
|
1187
1191
|
attr_accessor :enable_minutely_probes
|
|
@@ -1218,10 +1222,30 @@ module Appsignal
|
|
|
1218
1222
|
sig { returns(T::Boolean) }
|
|
1219
1223
|
attr_accessor :files_world_accessible
|
|
1220
1224
|
|
|
1225
|
+
# _@return_ — Configure whether to instrument Active Job
|
|
1226
|
+
sig { returns(T::Boolean) }
|
|
1227
|
+
attr_accessor :instrument_active_job
|
|
1228
|
+
|
|
1229
|
+
# _@return_ — Configure whether to instrument Delayed Job
|
|
1230
|
+
sig { returns(T::Boolean) }
|
|
1231
|
+
attr_accessor :instrument_delayed_job
|
|
1232
|
+
|
|
1233
|
+
# _@return_ — Configure whether to instrument requests made with the Excon gem
|
|
1234
|
+
sig { returns(T::Boolean) }
|
|
1235
|
+
attr_accessor :instrument_excon
|
|
1236
|
+
|
|
1237
|
+
# _@return_ — Configure whether to instrument requests made with the Faraday gem
|
|
1238
|
+
sig { returns(T::Boolean) }
|
|
1239
|
+
attr_accessor :instrument_faraday
|
|
1240
|
+
|
|
1221
1241
|
# _@return_ — Configure whether to instrument requests made with the http.rb gem
|
|
1222
1242
|
sig { returns(T::Boolean) }
|
|
1223
1243
|
attr_accessor :instrument_http_rb
|
|
1224
1244
|
|
|
1245
|
+
# _@return_ — Configure whether to instrument MongoDB queries
|
|
1246
|
+
sig { returns(T::Boolean) }
|
|
1247
|
+
attr_accessor :instrument_mongo
|
|
1248
|
+
|
|
1225
1249
|
# _@return_ — Configure whether to instrument requests made with Net::HTTP
|
|
1226
1250
|
sig { returns(T::Boolean) }
|
|
1227
1251
|
attr_accessor :instrument_net_http
|
|
@@ -1230,14 +1254,30 @@ module Appsignal
|
|
|
1230
1254
|
sig { returns(T::Boolean) }
|
|
1231
1255
|
attr_accessor :instrument_ownership
|
|
1232
1256
|
|
|
1257
|
+
# _@return_ — Configure whether to instrument Que
|
|
1258
|
+
sig { returns(T::Boolean) }
|
|
1259
|
+
attr_accessor :instrument_que
|
|
1260
|
+
|
|
1233
1261
|
# _@return_ — Configure whether to instrument Redis queries
|
|
1234
1262
|
sig { returns(T::Boolean) }
|
|
1235
1263
|
attr_accessor :instrument_redis
|
|
1236
1264
|
|
|
1265
|
+
# _@return_ — Configure whether to instrument Resque
|
|
1266
|
+
sig { returns(T::Boolean) }
|
|
1267
|
+
attr_accessor :instrument_resque
|
|
1268
|
+
|
|
1237
1269
|
# _@return_ — Configure whether to instrument Sequel queries
|
|
1238
1270
|
sig { returns(T::Boolean) }
|
|
1239
1271
|
attr_accessor :instrument_sequel
|
|
1240
1272
|
|
|
1273
|
+
# _@return_ — Configure whether to instrument Shoryuken
|
|
1274
|
+
sig { returns(T::Boolean) }
|
|
1275
|
+
attr_accessor :instrument_shoryuken
|
|
1276
|
+
|
|
1277
|
+
# _@return_ — Configure whether to instrument Sidekiq
|
|
1278
|
+
sig { returns(T::Boolean) }
|
|
1279
|
+
attr_accessor :instrument_sidekiq
|
|
1280
|
+
|
|
1241
1281
|
# _@return_ — Configure whether the Ownership gem instrumentation should set namespace
|
|
1242
1282
|
sig { returns(T::Boolean) }
|
|
1243
1283
|
attr_accessor :ownership_set_namespace
|
data/sig/appsignal.rbs
CHANGED
|
@@ -1105,6 +1105,9 @@ module Appsignal
|
|
|
1105
1105
|
# _@return_ — Configure whether host metrics collection is enabled
|
|
1106
1106
|
attr_accessor enable_host_metrics: bool
|
|
1107
1107
|
|
|
1108
|
+
# _@return_ — Configure whether to record an event when a background job is enqueued
|
|
1109
|
+
attr_accessor enable_job_enqueue_instrumentation: bool
|
|
1110
|
+
|
|
1108
1111
|
# _@return_ — Configure whether minutely probes are enabled
|
|
1109
1112
|
attr_accessor enable_minutely_probes: bool
|
|
1110
1113
|
|
|
@@ -1132,21 +1135,48 @@ module Appsignal
|
|
|
1132
1135
|
# _@return_ — Configure whether files created by AppSignal should be world accessible
|
|
1133
1136
|
attr_accessor files_world_accessible: bool
|
|
1134
1137
|
|
|
1138
|
+
# _@return_ — Configure whether to instrument Active Job
|
|
1139
|
+
attr_accessor instrument_active_job: bool
|
|
1140
|
+
|
|
1141
|
+
# _@return_ — Configure whether to instrument Delayed Job
|
|
1142
|
+
attr_accessor instrument_delayed_job: bool
|
|
1143
|
+
|
|
1144
|
+
# _@return_ — Configure whether to instrument requests made with the Excon gem
|
|
1145
|
+
attr_accessor instrument_excon: bool
|
|
1146
|
+
|
|
1147
|
+
# _@return_ — Configure whether to instrument requests made with the Faraday gem
|
|
1148
|
+
attr_accessor instrument_faraday: bool
|
|
1149
|
+
|
|
1135
1150
|
# _@return_ — Configure whether to instrument requests made with the http.rb gem
|
|
1136
1151
|
attr_accessor instrument_http_rb: bool
|
|
1137
1152
|
|
|
1153
|
+
# _@return_ — Configure whether to instrument MongoDB queries
|
|
1154
|
+
attr_accessor instrument_mongo: bool
|
|
1155
|
+
|
|
1138
1156
|
# _@return_ — Configure whether to instrument requests made with Net::HTTP
|
|
1139
1157
|
attr_accessor instrument_net_http: bool
|
|
1140
1158
|
|
|
1141
1159
|
# _@return_ — Configure whether to instrument the Ownership gem
|
|
1142
1160
|
attr_accessor instrument_ownership: bool
|
|
1143
1161
|
|
|
1162
|
+
# _@return_ — Configure whether to instrument Que
|
|
1163
|
+
attr_accessor instrument_que: bool
|
|
1164
|
+
|
|
1144
1165
|
# _@return_ — Configure whether to instrument Redis queries
|
|
1145
1166
|
attr_accessor instrument_redis: bool
|
|
1146
1167
|
|
|
1168
|
+
# _@return_ — Configure whether to instrument Resque
|
|
1169
|
+
attr_accessor instrument_resque: bool
|
|
1170
|
+
|
|
1147
1171
|
# _@return_ — Configure whether to instrument Sequel queries
|
|
1148
1172
|
attr_accessor instrument_sequel: bool
|
|
1149
1173
|
|
|
1174
|
+
# _@return_ — Configure whether to instrument Shoryuken
|
|
1175
|
+
attr_accessor instrument_shoryuken: bool
|
|
1176
|
+
|
|
1177
|
+
# _@return_ — Configure whether to instrument Sidekiq
|
|
1178
|
+
attr_accessor instrument_sidekiq: bool
|
|
1179
|
+
|
|
1150
1180
|
# _@return_ — Configure whether the Ownership gem instrumentation should set namespace
|
|
1151
1181
|
attr_accessor ownership_set_namespace: bool
|
|
1152
1182
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appsignal
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.9.0
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Beekman
|
|
@@ -85,16 +85,16 @@ dependencies:
|
|
|
85
85
|
name: rubocop
|
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
|
87
87
|
requirements:
|
|
88
|
-
- -
|
|
88
|
+
- - "~>"
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
|
-
version: 1.
|
|
90
|
+
version: 1.87.0
|
|
91
91
|
type: :development
|
|
92
92
|
prerelease: false
|
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
|
94
94
|
requirements:
|
|
95
|
-
- -
|
|
95
|
+
- - "~>"
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: 1.
|
|
97
|
+
version: 1.87.0
|
|
98
98
|
- !ruby/object:Gem::Dependency
|
|
99
99
|
name: sord
|
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -213,7 +213,6 @@ files:
|
|
|
213
213
|
- lib/appsignal/event_formatter/active_record/instantiation_formatter.rb
|
|
214
214
|
- lib/appsignal/event_formatter/active_record/sql_formatter.rb
|
|
215
215
|
- lib/appsignal/event_formatter/elastic_search/search_formatter.rb
|
|
216
|
-
- lib/appsignal/event_formatter/faraday/request_formatter.rb
|
|
217
216
|
- lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter.rb
|
|
218
217
|
- lib/appsignal/event_formatter/rom/sql_formatter.rb
|
|
219
218
|
- lib/appsignal/event_formatter/sequel/sql_formatter.rb
|
|
@@ -236,6 +235,7 @@ files:
|
|
|
236
235
|
- lib/appsignal/hooks/delayed_job.rb
|
|
237
236
|
- lib/appsignal/hooks/dry_monitor.rb
|
|
238
237
|
- lib/appsignal/hooks/excon.rb
|
|
238
|
+
- lib/appsignal/hooks/faraday.rb
|
|
239
239
|
- lib/appsignal/hooks/gvl.rb
|
|
240
240
|
- lib/appsignal/hooks/http.rb
|
|
241
241
|
- lib/appsignal/hooks/mongo_ruby_driver.rb
|
|
@@ -264,6 +264,7 @@ files:
|
|
|
264
264
|
- lib/appsignal/integrations/delayed_job_plugin.rb
|
|
265
265
|
- lib/appsignal/integrations/dry_monitor.rb
|
|
266
266
|
- lib/appsignal/integrations/excon.rb
|
|
267
|
+
- lib/appsignal/integrations/faraday.rb
|
|
267
268
|
- lib/appsignal/integrations/http.rb
|
|
268
269
|
- lib/appsignal/integrations/mongo_ruby_driver.rb
|
|
269
270
|
- lib/appsignal/integrations/net_http.rb
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Appsignal
|
|
4
|
-
class EventFormatter
|
|
5
|
-
# @!visibility private
|
|
6
|
-
module Faraday
|
|
7
|
-
class RequestFormatter
|
|
8
|
-
def format(payload)
|
|
9
|
-
http_method = payload[:method].to_s.upcase
|
|
10
|
-
uri = payload[:url]
|
|
11
|
-
[
|
|
12
|
-
"#{http_method} #{uri.scheme}://#{uri.host}",
|
|
13
|
-
"#{http_method} #{uri.scheme}://#{uri.host}#{uri.path}"
|
|
14
|
-
]
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
Appsignal::EventFormatter.register(
|
|
22
|
-
"request.faraday",
|
|
23
|
-
Appsignal::EventFormatter::Faraday::RequestFormatter
|
|
24
|
-
)
|