appsignal 4.0.8-java → 4.1.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 +53 -0
- data/appsignal.gemspec +3 -2
- data/lib/appsignal/check_in/cron.rb +3 -5
- data/lib/appsignal/check_in/event.rb +72 -0
- data/lib/appsignal/check_in/scheduler.rb +10 -34
- data/lib/appsignal/check_in.rb +44 -1
- data/lib/appsignal/rack/body_wrapper.rb +18 -5
- data/lib/appsignal/transaction.rb +38 -5
- data/lib/appsignal/utils/data.rb +6 -2
- data/lib/appsignal/utils/{hash_sanitizer.rb → sample_data_sanitizer.rb} +16 -2
- data/lib/appsignal/utils.rb +1 -1
- data/lib/appsignal/version.rb +1 -1
- metadata +19 -6
- data/.rubocop.yml +0 -133
- data/.rubocop_todo.yml +0 -84
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b7e56f0388f28620866e5e520d1901d555b77bf4e7f4f60e6c33b1dbcc0ff9a1
|
|
4
|
+
data.tar.gz: d00e77104454c2f28f6439a08293789edff5b8c758c5f349ac12d106953f323e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7173193284b3fdf618ab6a91d1670c0c0c01c2dec7de81393004078ced93c55988d89096e54c43b70db3ef85ed3d29804695bdff3a98fd7676fa7effa646a76f
|
|
7
|
+
data.tar.gz: 14b10d0ef16f27cc312d961526d21add84c329b2213e9ff518bf4d1a29e6d44c1cd7b4dbf8e3b3e1f87c19599d61f2b944d93262faaca54c0705985d481ebc88
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
|
2
2
|
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
_Published on 2024-09-26._
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Add support for heartbeat check-ins.
|
|
10
|
+
|
|
11
|
+
Use the `Appsignal::CheckIn.heartbeat` method to send a single heartbeat check-in event from your application. This can be used, for example, in your application's main loop:
|
|
12
|
+
|
|
13
|
+
```ruby
|
|
14
|
+
loop do
|
|
15
|
+
Appsignal::CheckIn.heartbeat("job_processor")
|
|
16
|
+
process_job
|
|
17
|
+
end
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Heartbeats are deduplicated and sent asynchronously, without blocking the current thread. Regardless of how often the `.heartbeat` method is called, at most one heartbeat with the same identifier will be sent every ten seconds.
|
|
21
|
+
|
|
22
|
+
Pass `continuous: true` as the second argument to send heartbeats continuously during the entire lifetime of the current process. This can be used, for example, after your application has finished its boot process:
|
|
23
|
+
|
|
24
|
+
```ruby
|
|
25
|
+
def main
|
|
26
|
+
start_app
|
|
27
|
+
Appsignal::CheckIn.heartbeat("my_app", continuous: true)
|
|
28
|
+
end
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
(minor [7ae7152c](https://github.com/appsignal/appsignal-ruby/commit/7ae7152cddae7c257e9d62d3bf2433cce1f4287d))
|
|
32
|
+
- Include the first backtrace line from error causes to show where each cause originated in the interface. (patch [496b035a](https://github.com/appsignal/appsignal-ruby/commit/496b035a3510dbb6dc47c7c59172f488ec55c986))
|
|
33
|
+
|
|
34
|
+
## 4.0.9
|
|
35
|
+
|
|
36
|
+
_Published on 2024-09-17._
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- Add the logger gem as a dependency. This fixes the deprecation warning on Ruby 3.3. (patch [8c1d577e](https://github.com/appsignal/appsignal-ruby/commit/8c1d577e4790185db887d49577cedc7d614d8d98))
|
|
41
|
+
- Do not report errors caused by `Errno::EPIPE` (broken pipe errors) when instrumenting response bodies, to avoid reporting errors that cannot be fixed by the application. (patch [1fdccba4](https://github.com/appsignal/appsignal-ruby/commit/1fdccba4ceeb8f9bb13ae077019b2c1f7d9d4fe4))
|
|
42
|
+
- Normalize Rack and Rails `UploadedFile` objects. Instead of displaying the Ruby class name, it will now show object details like the filename and content type.
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
# Before
|
|
46
|
+
#<Rack::Multipart::UploadedFile>
|
|
47
|
+
#<ActionDispatch::Http::UploadedFile>
|
|
48
|
+
|
|
49
|
+
# After
|
|
50
|
+
#<Rack::Multipart::UploadedFile original_filename: "uploaded_file.txt", content_type: "text/plain">
|
|
51
|
+
#<ActionDispatch::Http::UploadedFile original_filename: "uploaded_file.txt", content_type: "text/plain">
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
(patch [bb50c933](https://github.com/appsignal/appsignal-ruby/commit/bb50c93387eafebe043b0e7f4083c95556b93136))
|
|
55
|
+
|
|
3
56
|
## 4.0.8
|
|
4
57
|
|
|
5
58
|
_Published on 2024-09-13._
|
data/appsignal.gemspec
CHANGED
|
@@ -17,8 +17,8 @@ IGNORED_PATHS = [
|
|
|
17
17
|
".yardopts",
|
|
18
18
|
"benchmark.rake",
|
|
19
19
|
"mono.yml",
|
|
20
|
-
"rubocop.yml",
|
|
21
|
-
"rubocop_todo.yml"
|
|
20
|
+
".rubocop.yml",
|
|
21
|
+
".rubocop_todo.yml"
|
|
22
22
|
].freeze
|
|
23
23
|
|
|
24
24
|
Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
|
|
@@ -56,6 +56,7 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
|
|
|
56
56
|
"source_code_uri" => "https://github.com/appsignal/appsignal-ruby"
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
gem.add_dependency "logger"
|
|
59
60
|
gem.add_dependency "rack"
|
|
60
61
|
|
|
61
62
|
gem.add_development_dependency "pry"
|
|
@@ -22,13 +22,11 @@ module Appsignal
|
|
|
22
22
|
private
|
|
23
23
|
|
|
24
24
|
def event(kind)
|
|
25
|
-
|
|
25
|
+
Event.cron(
|
|
26
26
|
:identifier => @identifier,
|
|
27
27
|
:digest => @digest,
|
|
28
|
-
:kind => kind
|
|
29
|
-
|
|
30
|
-
:check_in_type => "cron"
|
|
31
|
-
}
|
|
28
|
+
:kind => kind
|
|
29
|
+
)
|
|
32
30
|
end
|
|
33
31
|
end
|
|
34
32
|
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appsignal
|
|
4
|
+
module CheckIn
|
|
5
|
+
# @api private
|
|
6
|
+
class Event
|
|
7
|
+
class << self
|
|
8
|
+
def new(check_in_type:, identifier:, digest: nil, kind: nil)
|
|
9
|
+
{
|
|
10
|
+
:identifier => identifier,
|
|
11
|
+
:digest => digest,
|
|
12
|
+
:kind => kind,
|
|
13
|
+
:timestamp => Time.now.utc.to_i,
|
|
14
|
+
:check_in_type => check_in_type
|
|
15
|
+
}.compact
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def cron(identifier:, digest:, kind:)
|
|
19
|
+
new(
|
|
20
|
+
:check_in_type => "cron",
|
|
21
|
+
:identifier => identifier,
|
|
22
|
+
:digest => digest,
|
|
23
|
+
:kind => kind
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def heartbeat(identifier:)
|
|
28
|
+
new(
|
|
29
|
+
:check_in_type => "heartbeat",
|
|
30
|
+
:identifier => identifier
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def redundant?(event, other)
|
|
35
|
+
return false if
|
|
36
|
+
other[:check_in_type] != event[:check_in_type] ||
|
|
37
|
+
other[:identifier] != event[:identifier]
|
|
38
|
+
|
|
39
|
+
return false if event[:check_in_type] == "cron" && (
|
|
40
|
+
other[:digest] != event[:digest] ||
|
|
41
|
+
other[:kind] != event[:kind]
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return false if
|
|
45
|
+
event[:check_in_type] != "cron" &&
|
|
46
|
+
event[:check_in_type] != "heartbeat"
|
|
47
|
+
|
|
48
|
+
true
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def describe(events)
|
|
52
|
+
if events.empty?
|
|
53
|
+
# This shouldn't happen.
|
|
54
|
+
"no check-in events"
|
|
55
|
+
elsif events.length > 1
|
|
56
|
+
"#{events.length} check-in events"
|
|
57
|
+
else
|
|
58
|
+
event = events.first
|
|
59
|
+
if event[:check_in_type] == "cron"
|
|
60
|
+
"cron check-in `#{event[:identifier] || "unknown"}` " \
|
|
61
|
+
"#{event[:kind] || "unknown"} event (digest #{event[:digest] || "unknown"})"
|
|
62
|
+
elsif event[:check_in_type] == "heartbeat"
|
|
63
|
+
"heartbeat check-in `#{event[:identifier] || "unknown"}` event"
|
|
64
|
+
else
|
|
65
|
+
"unknown check-in event"
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
@@ -29,7 +29,7 @@ module Appsignal
|
|
|
29
29
|
def schedule(event)
|
|
30
30
|
unless Appsignal.active?
|
|
31
31
|
Appsignal.internal_logger.debug(
|
|
32
|
-
"Cannot transmit #{describe([event])}: AppSignal is not active"
|
|
32
|
+
"Cannot transmit #{Event.describe([event])}: AppSignal is not active"
|
|
33
33
|
)
|
|
34
34
|
return
|
|
35
35
|
end
|
|
@@ -37,7 +37,7 @@ module Appsignal
|
|
|
37
37
|
@mutex.synchronize do
|
|
38
38
|
if @queue.closed?
|
|
39
39
|
Appsignal.internal_logger.debug(
|
|
40
|
-
"Cannot transmit #{describe([event])}: AppSignal is stopped"
|
|
40
|
+
"Cannot transmit #{Event.describe([event])}: AppSignal is stopped"
|
|
41
41
|
)
|
|
42
42
|
return
|
|
43
43
|
end
|
|
@@ -48,7 +48,7 @@ module Appsignal
|
|
|
48
48
|
start_waker(INITIAL_DEBOUNCE_SECONDS) if @waker.nil?
|
|
49
49
|
|
|
50
50
|
Appsignal.internal_logger.debug(
|
|
51
|
-
"Scheduling #{describe([event])} to be transmitted"
|
|
51
|
+
"Scheduling #{Event.describe([event])} to be transmitted"
|
|
52
52
|
)
|
|
53
53
|
|
|
54
54
|
# Make sure to start the thread after an event has been added.
|
|
@@ -92,7 +92,7 @@ module Appsignal
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
def transmit(events)
|
|
95
|
-
description = describe(events)
|
|
95
|
+
description = Event.describe(events)
|
|
96
96
|
|
|
97
97
|
begin
|
|
98
98
|
response = CheckIn.transmitter.transmit(events, :format => :ndjson)
|
|
@@ -110,42 +110,18 @@ module Appsignal
|
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
-
def describe(events)
|
|
114
|
-
if events.empty?
|
|
115
|
-
# This shouldn't happen.
|
|
116
|
-
"no check-in events"
|
|
117
|
-
elsif events.length > 1
|
|
118
|
-
"#{events.length} check-in events"
|
|
119
|
-
else
|
|
120
|
-
event = events.first
|
|
121
|
-
if event[:check_in_type] == "cron"
|
|
122
|
-
"cron check-in `#{event[:identifier] || "unknown"}` " \
|
|
123
|
-
"#{event[:kind] || "unknown"} event (digest #{event[:digest] || "unknown"})" \
|
|
124
|
-
else
|
|
125
|
-
"unknown check-in event"
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
|
|
130
113
|
# Must be called from within a `@mutex.synchronize` block.
|
|
131
114
|
def add_event(event)
|
|
132
115
|
# Remove redundant events, keeping the newly added one, which
|
|
133
116
|
# should be the one with the most recent timestamp.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
# digest and kind as the one we're adding.
|
|
137
|
-
@events.reject! do |existing_event|
|
|
138
|
-
next unless existing_event[:identifier] == event[:identifier] &&
|
|
139
|
-
existing_event[:digest] == event[:digest] &&
|
|
140
|
-
existing_event[:kind] == event[:kind] &&
|
|
141
|
-
existing_event[:check_in_type] == "cron"
|
|
117
|
+
@events.reject! do |existing_event|
|
|
118
|
+
next unless Event.redundant?(event, existing_event)
|
|
142
119
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
120
|
+
Appsignal.internal_logger.debug(
|
|
121
|
+
"Replacing previously scheduled #{Event.describe([existing_event])}"
|
|
122
|
+
)
|
|
146
123
|
|
|
147
|
-
|
|
148
|
-
end
|
|
124
|
+
true
|
|
149
125
|
end
|
|
150
126
|
|
|
151
127
|
@events << event
|
data/lib/appsignal/check_in.rb
CHANGED
|
@@ -2,10 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
module Appsignal
|
|
4
4
|
module CheckIn
|
|
5
|
+
HEARTBEAT_CONTINUOUS_INTERVAL_SECONDS = 30
|
|
5
6
|
class << self
|
|
7
|
+
# @api private
|
|
8
|
+
def continuous_heartbeats
|
|
9
|
+
@continuous_heartbeats ||= []
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# @api private
|
|
13
|
+
def kill_continuous_heartbeats
|
|
14
|
+
continuous_heartbeats.each(&:kill)
|
|
15
|
+
end
|
|
16
|
+
|
|
6
17
|
# Track cron check-ins.
|
|
7
18
|
#
|
|
8
|
-
# Track the execution of
|
|
19
|
+
# Track the execution of scheduled processes by sending a cron check-in.
|
|
9
20
|
#
|
|
10
21
|
# To track the duration of a piece of code, pass a block to {.cron}
|
|
11
22
|
# to report both when the process starts, and when it finishes.
|
|
@@ -40,6 +51,37 @@ module Appsignal
|
|
|
40
51
|
output
|
|
41
52
|
end
|
|
42
53
|
|
|
54
|
+
# Track heartbeat check-ins.
|
|
55
|
+
#
|
|
56
|
+
# Track the execution of long-lived processes by sending a heartbeat
|
|
57
|
+
# check-in.
|
|
58
|
+
#
|
|
59
|
+
# @example Send a heartbeat check-in
|
|
60
|
+
# Appsignal::CheckIn.heartbeat("main_loop")
|
|
61
|
+
#
|
|
62
|
+
# @param identifier [String] identifier of the heartbeat check-in to report.
|
|
63
|
+
# @param continuous [Boolean] whether the heartbeats should be sent continuously
|
|
64
|
+
# during the lifetime of the process. Defaults to `false`.
|
|
65
|
+
# @yield the block to monitor.
|
|
66
|
+
# @return [void]
|
|
67
|
+
# @since 4.1.0
|
|
68
|
+
# @see https://docs.appsignal.com/check-ins/heartbeat
|
|
69
|
+
def heartbeat(identifier, continuous: false)
|
|
70
|
+
if continuous
|
|
71
|
+
continuous_heartbeats << Thread.new do
|
|
72
|
+
loop do
|
|
73
|
+
heartbeat(identifier)
|
|
74
|
+
sleep HEARTBEAT_CONTINUOUS_INTERVAL_SECONDS
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
return
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
event = Event.heartbeat(:identifier => identifier)
|
|
82
|
+
scheduler.schedule(event)
|
|
83
|
+
end
|
|
84
|
+
|
|
43
85
|
# @api private
|
|
44
86
|
def transmitter
|
|
45
87
|
@transmitter ||= Transmitter.new(
|
|
@@ -60,5 +102,6 @@ module Appsignal
|
|
|
60
102
|
end
|
|
61
103
|
end
|
|
62
104
|
|
|
105
|
+
require "appsignal/check_in/event"
|
|
63
106
|
require "appsignal/check_in/scheduler"
|
|
64
107
|
require "appsignal/check_in/cron"
|
|
@@ -54,7 +54,7 @@ module Appsignal
|
|
|
54
54
|
rescue *IGNORED_ERRORS # Do not report
|
|
55
55
|
raise
|
|
56
56
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
|
57
|
-
|
|
57
|
+
appsignal_report_error(error)
|
|
58
58
|
raise error
|
|
59
59
|
end
|
|
60
60
|
|
|
@@ -72,6 +72,19 @@ module Appsignal
|
|
|
72
72
|
@body.__send__(method_name, *args, &block)
|
|
73
73
|
end
|
|
74
74
|
ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
|
|
75
|
+
|
|
76
|
+
private
|
|
77
|
+
|
|
78
|
+
def appsignal_report_error(error)
|
|
79
|
+
@transaction.set_error(error) if appsignal_accepted_error?(error)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def appsignal_accepted_error?(error)
|
|
83
|
+
return true unless error.cause
|
|
84
|
+
return false if IGNORED_ERRORS.include?(error.cause.class)
|
|
85
|
+
|
|
86
|
+
appsignal_accepted_error?(error.cause)
|
|
87
|
+
end
|
|
75
88
|
end
|
|
76
89
|
|
|
77
90
|
# The standard Rack body wrapper which exposes "each" for iterating
|
|
@@ -97,7 +110,7 @@ module Appsignal
|
|
|
97
110
|
rescue *IGNORED_ERRORS # Do not report
|
|
98
111
|
raise
|
|
99
112
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
|
100
|
-
|
|
113
|
+
appsignal_report_error(error)
|
|
101
114
|
raise error
|
|
102
115
|
end
|
|
103
116
|
end
|
|
@@ -118,7 +131,7 @@ module Appsignal
|
|
|
118
131
|
rescue *IGNORED_ERRORS # Do not report
|
|
119
132
|
raise
|
|
120
133
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
|
121
|
-
|
|
134
|
+
appsignal_report_error(error)
|
|
122
135
|
raise error
|
|
123
136
|
end
|
|
124
137
|
end
|
|
@@ -144,7 +157,7 @@ module Appsignal
|
|
|
144
157
|
rescue *IGNORED_ERRORS # Do not report
|
|
145
158
|
raise
|
|
146
159
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
|
147
|
-
|
|
160
|
+
appsignal_report_error(error)
|
|
148
161
|
raise error
|
|
149
162
|
end
|
|
150
163
|
end
|
|
@@ -162,7 +175,7 @@ module Appsignal
|
|
|
162
175
|
rescue *IGNORED_ERRORS # Do not report
|
|
163
176
|
raise
|
|
164
177
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
|
165
|
-
|
|
178
|
+
appsignal_report_error(error)
|
|
166
179
|
raise error
|
|
167
180
|
end
|
|
168
181
|
end
|
|
@@ -627,7 +627,8 @@ module Appsignal
|
|
|
627
627
|
causes_sample_data = causes.map do |e|
|
|
628
628
|
{
|
|
629
629
|
:name => e.class.name,
|
|
630
|
-
:message => cleaned_error_message(e)
|
|
630
|
+
:message => cleaned_error_message(e),
|
|
631
|
+
:first_line => first_formatted_backtrace_line(e)
|
|
631
632
|
}
|
|
632
633
|
end
|
|
633
634
|
|
|
@@ -639,6 +640,36 @@ module Appsignal
|
|
|
639
640
|
)
|
|
640
641
|
end
|
|
641
642
|
|
|
643
|
+
BACKTRACE_REGEX =
|
|
644
|
+
%r{(?<gem>[\w-]+ \(.+\) )?(?<path>:?/?\w+?.+?):(?<line>:?\d+)(?<group>:in `(?<method>.+)')?$}.freeze # rubocop:disable Layout/LineLength
|
|
645
|
+
|
|
646
|
+
def first_formatted_backtrace_line(error)
|
|
647
|
+
backtrace = cleaned_backtrace(error.backtrace)
|
|
648
|
+
first_line = backtrace&.first
|
|
649
|
+
return unless first_line
|
|
650
|
+
|
|
651
|
+
captures = BACKTRACE_REGEX.match(first_line)
|
|
652
|
+
return unless captures
|
|
653
|
+
|
|
654
|
+
captures.named_captures
|
|
655
|
+
.merge("original" => first_line)
|
|
656
|
+
.tap do |c|
|
|
657
|
+
config = Appsignal.config
|
|
658
|
+
c.delete("group") # Unused key, only for easier matching
|
|
659
|
+
# Strip of whitespace at the end of the gem name
|
|
660
|
+
c["gem"] = c["gem"]&.strip
|
|
661
|
+
# Strip the app path from the path if present
|
|
662
|
+
root_path = config.root_path
|
|
663
|
+
if c["path"].start_with?(root_path)
|
|
664
|
+
c["path"].delete_prefix!(root_path)
|
|
665
|
+
# Relative paths shouldn't start with a slash
|
|
666
|
+
c["path"].delete_prefix!("/")
|
|
667
|
+
end
|
|
668
|
+
# Add revision for linking to the repository from the UI
|
|
669
|
+
c["revision"] = config[:revision]
|
|
670
|
+
end
|
|
671
|
+
end
|
|
672
|
+
|
|
642
673
|
def set_sample_data(key, data)
|
|
643
674
|
return unless key && data
|
|
644
675
|
|
|
@@ -707,7 +738,7 @@ module Appsignal
|
|
|
707
738
|
return unless Appsignal.config[:send_params]
|
|
708
739
|
|
|
709
740
|
filter_keys = Appsignal.config[:filter_parameters] || []
|
|
710
|
-
Appsignal::Utils::
|
|
741
|
+
Appsignal::Utils::SampleDataSanitizer.sanitize(params, filter_keys)
|
|
711
742
|
end
|
|
712
743
|
|
|
713
744
|
def session_data
|
|
@@ -720,7 +751,8 @@ module Appsignal
|
|
|
720
751
|
|
|
721
752
|
# Returns sanitized session data.
|
|
722
753
|
#
|
|
723
|
-
# The session data is sanitized by the
|
|
754
|
+
# The session data is sanitized by the
|
|
755
|
+
# {Appsignal::Utils::SampleDataSanitizer}.
|
|
724
756
|
#
|
|
725
757
|
# @return [nil] if `:send_session_data` config is set to `false`.
|
|
726
758
|
# @return [nil] if the {#request} object doesn't respond to `#session`.
|
|
@@ -729,8 +761,9 @@ module Appsignal
|
|
|
729
761
|
def sanitized_session_data
|
|
730
762
|
return unless Appsignal.config[:send_session_data]
|
|
731
763
|
|
|
732
|
-
Appsignal::Utils::
|
|
733
|
-
session_data,
|
|
764
|
+
Appsignal::Utils::SampleDataSanitizer.sanitize(
|
|
765
|
+
session_data,
|
|
766
|
+
Appsignal.config[:filter_session_data]
|
|
734
767
|
)
|
|
735
768
|
end
|
|
736
769
|
|
data/lib/appsignal/utils/data.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Appsignal
|
|
|
25
25
|
# An Integer too big for C-lang longs to fit
|
|
26
26
|
bigint = 1 << 63
|
|
27
27
|
if value >= bigint
|
|
28
|
-
map.set_string(key,
|
|
28
|
+
map.set_string(key, map_bigint(value))
|
|
29
29
|
else
|
|
30
30
|
map.set_integer(key, value)
|
|
31
31
|
end
|
|
@@ -56,7 +56,7 @@ module Appsignal
|
|
|
56
56
|
# An Integer too big for C-lang longs to fit
|
|
57
57
|
bigint = 1 << 63
|
|
58
58
|
if value >= bigint
|
|
59
|
-
array.append_string(
|
|
59
|
+
array.append_string(map_bigint(value))
|
|
60
60
|
else
|
|
61
61
|
array.append_integer(value)
|
|
62
62
|
end
|
|
@@ -76,6 +76,10 @@ module Appsignal
|
|
|
76
76
|
end
|
|
77
77
|
array
|
|
78
78
|
end
|
|
79
|
+
|
|
80
|
+
def map_bigint(value)
|
|
81
|
+
"bigint:#{value}"
|
|
82
|
+
end
|
|
79
83
|
end
|
|
80
84
|
end
|
|
81
85
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Appsignal
|
|
4
4
|
module Utils
|
|
5
|
-
class
|
|
5
|
+
class SampleDataSanitizer
|
|
6
6
|
FILTERED = "[FILTERED]"
|
|
7
7
|
RECURSIVE = "[RECURSIVE VALUE]"
|
|
8
8
|
|
|
@@ -26,7 +26,21 @@ module Appsignal
|
|
|
26
26
|
when Date
|
|
27
27
|
"#<Date: #{value.iso8601}>"
|
|
28
28
|
else
|
|
29
|
-
|
|
29
|
+
if defined?(::Rack::Multipart::UploadedFile) &&
|
|
30
|
+
value.is_a?(::Rack::Multipart::UploadedFile)
|
|
31
|
+
"#<Rack::Multipart::UploadedFile " \
|
|
32
|
+
"original_filename: #{value.original_filename.inspect}, " \
|
|
33
|
+
"content_type: #{value.content_type.inspect}" \
|
|
34
|
+
">"
|
|
35
|
+
elsif defined?(::ActionDispatch::Http::UploadedFile) &&
|
|
36
|
+
value.is_a?(::ActionDispatch::Http::UploadedFile)
|
|
37
|
+
"#<ActionDispatch::Http::UploadedFile " \
|
|
38
|
+
"original_filename: #{value.original_filename.inspect}, " \
|
|
39
|
+
"content_type: #{value.content_type.inspect}" \
|
|
40
|
+
">"
|
|
41
|
+
else
|
|
42
|
+
inspected(value)
|
|
43
|
+
end
|
|
30
44
|
end
|
|
31
45
|
end
|
|
32
46
|
|
data/lib/appsignal/utils.rb
CHANGED
|
@@ -9,7 +9,7 @@ end
|
|
|
9
9
|
require "appsignal/utils/integration_memory_logger"
|
|
10
10
|
require "appsignal/utils/stdout_and_logger_message"
|
|
11
11
|
require "appsignal/utils/data"
|
|
12
|
-
require "appsignal/utils/
|
|
12
|
+
require "appsignal/utils/sample_data_sanitizer"
|
|
13
13
|
require "appsignal/utils/integration_logger"
|
|
14
14
|
require "appsignal/utils/json"
|
|
15
15
|
require "appsignal/utils/ndjson"
|
data/lib/appsignal/version.rb
CHANGED
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.0
|
|
4
|
+
version: 4.1.0
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Beekman
|
|
@@ -10,8 +10,22 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2024-09-
|
|
13
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: logger
|
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
|
+
requirements:
|
|
19
|
+
- - ">="
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '0'
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - ">="
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '0'
|
|
15
29
|
- !ruby/object:Gem::Dependency
|
|
16
30
|
name: rack
|
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -147,8 +161,6 @@ extensions:
|
|
|
147
161
|
- ext/Rakefile
|
|
148
162
|
extra_rdoc_files: []
|
|
149
163
|
files:
|
|
150
|
-
- ".rubocop.yml"
|
|
151
|
-
- ".rubocop_todo.yml"
|
|
152
164
|
- CHANGELOG.md
|
|
153
165
|
- CODE_OF_CONDUCT.md
|
|
154
166
|
- Gemfile
|
|
@@ -169,6 +181,7 @@ files:
|
|
|
169
181
|
- lib/appsignal/capistrano.rb
|
|
170
182
|
- lib/appsignal/check_in.rb
|
|
171
183
|
- lib/appsignal/check_in/cron.rb
|
|
184
|
+
- lib/appsignal/check_in/event.rb
|
|
172
185
|
- lib/appsignal/check_in/scheduler.rb
|
|
173
186
|
- lib/appsignal/cli.rb
|
|
174
187
|
- lib/appsignal/cli/demo.rb
|
|
@@ -274,13 +287,13 @@ files:
|
|
|
274
287
|
- lib/appsignal/transmitter.rb
|
|
275
288
|
- lib/appsignal/utils.rb
|
|
276
289
|
- lib/appsignal/utils/data.rb
|
|
277
|
-
- lib/appsignal/utils/hash_sanitizer.rb
|
|
278
290
|
- lib/appsignal/utils/integration_logger.rb
|
|
279
291
|
- lib/appsignal/utils/integration_memory_logger.rb
|
|
280
292
|
- lib/appsignal/utils/json.rb
|
|
281
293
|
- lib/appsignal/utils/ndjson.rb
|
|
282
294
|
- lib/appsignal/utils/query_params_sanitizer.rb
|
|
283
295
|
- lib/appsignal/utils/rails_helper.rb
|
|
296
|
+
- lib/appsignal/utils/sample_data_sanitizer.rb
|
|
284
297
|
- lib/appsignal/utils/stdout_and_logger_message.rb
|
|
285
298
|
- lib/appsignal/version.rb
|
|
286
299
|
- lib/puma/plugin/appsignal.rb
|
|
@@ -313,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
313
326
|
- !ruby/object:Gem::Version
|
|
314
327
|
version: '0'
|
|
315
328
|
requirements: []
|
|
316
|
-
rubygems_version: 3.
|
|
329
|
+
rubygems_version: 3.3.7
|
|
317
330
|
signing_key:
|
|
318
331
|
specification_version: 4
|
|
319
332
|
summary: Logs performance and exception data from your app to appsignal.com
|
data/.rubocop.yml
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
inherit_from: .rubocop_todo.yml
|
|
2
|
-
|
|
3
|
-
AllCops:
|
|
4
|
-
TargetRubyVersion: 2.7
|
|
5
|
-
NewCops: enable
|
|
6
|
-
Include:
|
|
7
|
-
- "**/*.rb"
|
|
8
|
-
- "**/*.cap"
|
|
9
|
-
- "**/*.rake"
|
|
10
|
-
- "**/Gemfile"
|
|
11
|
-
- "**/Rakefile"
|
|
12
|
-
- "appsignal.gemspec"
|
|
13
|
-
Exclude:
|
|
14
|
-
- "pkg/**/*"
|
|
15
|
-
- "tmp/**/*"
|
|
16
|
-
- "vendor/**/*"
|
|
17
|
-
- "spec/integration/diagnose/**/*"
|
|
18
|
-
DisplayCopNames: true
|
|
19
|
-
UseCache: true
|
|
20
|
-
CacheRootDirectory: ./tmp
|
|
21
|
-
|
|
22
|
-
Style/RescueStandardError:
|
|
23
|
-
Enabled: false
|
|
24
|
-
|
|
25
|
-
Style/Documentation:
|
|
26
|
-
Enabled: false
|
|
27
|
-
|
|
28
|
-
Style/StringLiterals:
|
|
29
|
-
EnforcedStyle: double_quotes
|
|
30
|
-
|
|
31
|
-
Style/StringLiteralsInInterpolation:
|
|
32
|
-
EnforcedStyle: double_quotes
|
|
33
|
-
|
|
34
|
-
Style/HashSyntax:
|
|
35
|
-
EnforcedStyle: hash_rockets
|
|
36
|
-
|
|
37
|
-
Style/EmptyMethod:
|
|
38
|
-
EnforcedStyle: expanded
|
|
39
|
-
|
|
40
|
-
Style/MissingRespondToMissing:
|
|
41
|
-
Exclude:
|
|
42
|
-
- "lib/appsignal/extension.rb"
|
|
43
|
-
- "lib/appsignal/transaction.rb"
|
|
44
|
-
|
|
45
|
-
Style/TrailingUnderscoreVariable:
|
|
46
|
-
Enabled: false
|
|
47
|
-
|
|
48
|
-
Style/Lambda:
|
|
49
|
-
EnforcedStyle: lambda
|
|
50
|
-
|
|
51
|
-
Style/WordArray:
|
|
52
|
-
Enabled: false
|
|
53
|
-
|
|
54
|
-
Style/FrozenStringLiteralComment:
|
|
55
|
-
Enabled: true
|
|
56
|
-
Exclude:
|
|
57
|
-
- "spec/**/*.rb"
|
|
58
|
-
|
|
59
|
-
Style/NumericPredicate:
|
|
60
|
-
Enabled: false
|
|
61
|
-
|
|
62
|
-
Style/SymbolArray:
|
|
63
|
-
EnforcedStyle: brackets
|
|
64
|
-
|
|
65
|
-
Style/RedundantConstantBase:
|
|
66
|
-
Enabled: false
|
|
67
|
-
|
|
68
|
-
Lint/ConstantDefinitionInBlock:
|
|
69
|
-
Exclude:
|
|
70
|
-
- "spec/**/*.rb"
|
|
71
|
-
|
|
72
|
-
Lint/EmptyClass:
|
|
73
|
-
Exclude:
|
|
74
|
-
- "spec/**/*.rb"
|
|
75
|
-
|
|
76
|
-
Lint/EmptyFile:
|
|
77
|
-
Exclude:
|
|
78
|
-
- "spec/**/*.rb"
|
|
79
|
-
|
|
80
|
-
Layout/HashAlignment:
|
|
81
|
-
EnforcedLastArgumentHashStyle: ignore_implicit
|
|
82
|
-
|
|
83
|
-
Layout/ArgumentAlignment:
|
|
84
|
-
EnforcedStyle: with_fixed_indentation
|
|
85
|
-
|
|
86
|
-
Layout/LineContinuationLeadingSpace:
|
|
87
|
-
Enabled: false
|
|
88
|
-
|
|
89
|
-
Layout/FirstArrayElementIndentation:
|
|
90
|
-
EnforcedStyle: consistent
|
|
91
|
-
|
|
92
|
-
Layout/LineEndStringConcatenationIndentation:
|
|
93
|
-
EnforcedStyle: indented
|
|
94
|
-
|
|
95
|
-
Layout/ParameterAlignment:
|
|
96
|
-
EnforcedStyle: with_fixed_indentation
|
|
97
|
-
|
|
98
|
-
Layout/MultilineMethodCallIndentation:
|
|
99
|
-
EnforcedStyle: indented
|
|
100
|
-
|
|
101
|
-
Layout/MultilineOperationIndentation:
|
|
102
|
-
EnforcedStyle: indented
|
|
103
|
-
|
|
104
|
-
Layout/LineLength:
|
|
105
|
-
Max: 100
|
|
106
|
-
|
|
107
|
-
Naming/FileName:
|
|
108
|
-
Exclude:
|
|
109
|
-
- "ext/Rakefile"
|
|
110
|
-
|
|
111
|
-
Naming/AccessorMethodName:
|
|
112
|
-
Exclude:
|
|
113
|
-
- "lib/appsignal/helpers/instrumentation.rb"
|
|
114
|
-
- "lib/appsignal/transaction.rb"
|
|
115
|
-
|
|
116
|
-
Naming/RescuedExceptionsVariableName:
|
|
117
|
-
Enabled: false
|
|
118
|
-
|
|
119
|
-
Naming/VariableNumber:
|
|
120
|
-
Enabled: false
|
|
121
|
-
|
|
122
|
-
Metrics/ModuleLength:
|
|
123
|
-
Enabled: false
|
|
124
|
-
|
|
125
|
-
Metrics/ClassLength:
|
|
126
|
-
Enabled: false
|
|
127
|
-
|
|
128
|
-
Metrics/BlockLength:
|
|
129
|
-
Exclude:
|
|
130
|
-
- "Rakefile"
|
|
131
|
-
|
|
132
|
-
Gemspec/DevelopmentDependencies:
|
|
133
|
-
Enabled: false
|
data/.rubocop_todo.yml
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
# This configuration was generated by
|
|
2
|
-
# `rubocop --auto-gen-config`
|
|
3
|
-
# on 2024-06-27 09:42:06 UTC using RuboCop version 1.64.1.
|
|
4
|
-
# The point is for the user to remove these configuration records
|
|
5
|
-
# one by one as the offenses are removed from the code base.
|
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
-
|
|
9
|
-
# Offense count: 2
|
|
10
|
-
# Configuration parameters: AllowedParentClasses.
|
|
11
|
-
Lint/MissingSuper:
|
|
12
|
-
Exclude:
|
|
13
|
-
- 'lib/appsignal/extension.rb'
|
|
14
|
-
- 'lib/appsignal/logger.rb'
|
|
15
|
-
|
|
16
|
-
# Offense count: 1
|
|
17
|
-
Lint/StructNewOverride:
|
|
18
|
-
Exclude:
|
|
19
|
-
- 'spec/lib/appsignal/probes/sidekiq_spec.rb'
|
|
20
|
-
|
|
21
|
-
# Offense count: 63
|
|
22
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
23
|
-
Metrics/AbcSize:
|
|
24
|
-
Max: 44
|
|
25
|
-
|
|
26
|
-
# Offense count: 6
|
|
27
|
-
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
28
|
-
# AllowedMethods: refine
|
|
29
|
-
Metrics/BlockLength:
|
|
30
|
-
Max: 31
|
|
31
|
-
|
|
32
|
-
# Offense count: 21
|
|
33
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
34
|
-
Metrics/CyclomaticComplexity:
|
|
35
|
-
Max: 11
|
|
36
|
-
|
|
37
|
-
# Offense count: 139
|
|
38
|
-
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
39
|
-
Metrics/MethodLength:
|
|
40
|
-
Max: 56
|
|
41
|
-
|
|
42
|
-
# Offense count: 18
|
|
43
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
44
|
-
Metrics/PerceivedComplexity:
|
|
45
|
-
Max: 13
|
|
46
|
-
|
|
47
|
-
# Offense count: 2
|
|
48
|
-
Security/Open:
|
|
49
|
-
Exclude:
|
|
50
|
-
- 'ext/base.rb'
|
|
51
|
-
|
|
52
|
-
# Offense count: 2
|
|
53
|
-
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
54
|
-
Security/YAMLLoad:
|
|
55
|
-
Exclude:
|
|
56
|
-
- 'lib/appsignal/config.rb'
|
|
57
|
-
- 'lib/appsignal/integrations/sidekiq.rb'
|
|
58
|
-
|
|
59
|
-
# Offense count: 7
|
|
60
|
-
# This cop supports safe autocorrection (--autocorrect).
|
|
61
|
-
# Configuration parameters: EnforcedStyle.
|
|
62
|
-
# SupportedStyles: prefer_alias, prefer_alias_method
|
|
63
|
-
Style/Alias:
|
|
64
|
-
Exclude:
|
|
65
|
-
- 'lib/appsignal/helpers/instrumentation.rb'
|
|
66
|
-
- 'lib/appsignal/transaction.rb'
|
|
67
|
-
|
|
68
|
-
# Offense count: 1
|
|
69
|
-
Style/ClassVars:
|
|
70
|
-
Exclude:
|
|
71
|
-
- 'spec/lib/appsignal/event_formatter_spec.rb'
|
|
72
|
-
|
|
73
|
-
# Offense count: 1
|
|
74
|
-
Style/OpenStructUse:
|
|
75
|
-
Exclude:
|
|
76
|
-
- 'lib/appsignal/cli/install.rb'
|
|
77
|
-
|
|
78
|
-
# Offense count: 2
|
|
79
|
-
# Configuration parameters: AllowedMethods.
|
|
80
|
-
# AllowedMethods: respond_to_missing?
|
|
81
|
-
Style/OptionalBooleanParameter:
|
|
82
|
-
Exclude:
|
|
83
|
-
- 'lib/appsignal/integrations/delayed_job_plugin.rb'
|
|
84
|
-
- 'lib/appsignal/utils/query_params_sanitizer.rb'
|