appsignal 3.6.1-java → 3.6.3-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -4
- data/Rakefile +1 -1
- data/ext/agent.rb +27 -27
- data/lib/appsignal/auth_check.rb +1 -1
- data/lib/appsignal/config.rb +14 -1
- data/lib/appsignal/event_formatter/sequel/sql_formatter.rb +1 -1
- data/lib/appsignal/integrations/railtie.rb +14 -2
- data/lib/appsignal/logger.rb +5 -5
- data/lib/appsignal/rack/generic_instrumentation.rb +4 -17
- data/lib/appsignal/rack/rails_instrumentation.rb +3 -15
- data/lib/appsignal/rack/sinatra_instrumentation.rb +3 -15
- data/lib/appsignal/rack/streaming_listener.rb +35 -26
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +0 -1
- data/lib/puma/plugin/appsignal.rb +1 -1
- data/spec/lib/appsignal/capistrano2_spec.rb +2 -2
- data/spec/lib/appsignal/capistrano3_spec.rb +2 -2
- data/spec/lib/appsignal/cli/diagnose_spec.rb +1 -1
- data/spec/lib/appsignal/config_spec.rb +10 -5
- data/spec/lib/appsignal/environment_spec.rb +3 -3
- data/spec/lib/appsignal/event_formatter/mongo_ruby_driver/query_formatter_spec.rb +1 -1
- data/spec/lib/appsignal/hooks/resque_spec.rb +1 -1
- data/spec/lib/appsignal/hooks_spec.rb +1 -1
- data/spec/lib/appsignal/integrations/railtie_spec.rb +27 -2
- data/spec/lib/appsignal/integrations/sidekiq_spec.rb +1 -1
- data/spec/lib/appsignal/rack/generic_instrumentation_spec.rb +2 -3
- data/spec/lib/appsignal/rack/rails_instrumentation_spec.rb +2 -4
- data/spec/lib/appsignal/rack/sinatra_instrumentation_spec.rb +1 -3
- data/spec/lib/appsignal/rack/streaming_listener_spec.rb +53 -9
- data/spec/lib/appsignal/transaction_spec.rb +2 -2
- data/spec/lib/appsignal_spec.rb +1 -1
- data/spec/lib/puma/appsignal_spec.rb +1 -1
- metadata +3 -5
- data/lib/appsignal/rack/body_wrapper.rb +0 -161
- data/spec/lib/appsignal/rack/body_wrapper_spec.rb +0 -220
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '087bfd6a23d24ba7a74aeb4307eef319da3613b6d6843dc61a7995715d242958'
|
4
|
+
data.tar.gz: 63ec67e524abc5fac18bb85746b0f45b3dcb3aa05870b23fb46d8cf44381054c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b44722132c864d47321fa58a3c8493fdb51a734b988d994f0d2f269152372ae9df9844abb4158870020f9f30fe3b386e0a97fbe757300412b637bb069fe4d68
|
7
|
+
data.tar.gz: e7b735d7384c2c9ef43141b1eb2d2eb2704c9a42d23185fd7748bdb09e786afcf2717b2a8b80ad0401503f9f65b9dd510bbdc3545e48ce40a7e8a0f6ef5ee375
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 3.6.3
|
4
|
+
|
5
|
+
_Published on 2024-03-20._
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- [e50433fb](https://github.com/appsignal/appsignal-ruby/commit/e50433fbcb109ef741a889b0b7e78f16b884bd81) patch - Implement CPU count configuration option. Use it to override the auto-detected, cgroups-provided number of CPUs that is used to calculate CPU usage percentages.
|
10
|
+
|
11
|
+
To set it, use the the `cpu_count`
|
12
|
+
configuration option or the `APPSIGNAL_CPU_COUNT` environment variable.
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
|
16
|
+
- [c6dd9779](https://github.com/appsignal/appsignal-ruby/commit/c6dd9779bb50dd9385da8962ccf1057ca1a44c7a) patch - Add request parameters, path and method tags to errors reported in controllers via the Rails error reporter.
|
17
|
+
|
18
|
+
## 3.6.2
|
19
|
+
|
20
|
+
_Published on 2024-03-08._
|
21
|
+
|
22
|
+
### Fixed
|
23
|
+
|
24
|
+
- [c3921865](https://github.com/appsignal/appsignal-ruby/commit/c392186573a72fd9afe22299fabcd14dcfe96139) patch - Revert Rack middleware changes (see [changelog](https://github.com/appsignal/appsignal-ruby/blob/main/CHANGELOG.md#360)) to fix issues relating to Unicorn broken pipe errors and multiple requests merging into a single sample.
|
25
|
+
|
3
26
|
## 3.6.1
|
4
27
|
|
5
28
|
_Published on 2024-03-05._
|
@@ -1451,7 +1474,7 @@ Yanked
|
|
1451
1474
|
- Support for arrays, literal value types and function arguments in sql lexer
|
1452
1475
|
|
1453
1476
|
## 1.2.2
|
1454
|
-
- Handle out of range numbers in queue
|
1477
|
+
- Handle out of range numbers in queue length and metrics api
|
1455
1478
|
|
1456
1479
|
## 1.2.1
|
1457
1480
|
- Use Dir.pwd in CLI install wizard
|
@@ -1476,7 +1499,7 @@ Yanked
|
|
1476
1499
|
## 1.1.7
|
1477
1500
|
- Make logging resilient for closing FD's (daemons gem does this)
|
1478
1501
|
- Add support for using Resque through ActiveJob
|
1479
|
-
- Rescue more
|
1502
|
+
- Rescue more exceptions in json generation
|
1480
1503
|
|
1481
1504
|
## 1.1.6
|
1482
1505
|
- Generic Rack instrumentation middleware
|
@@ -1526,7 +1549,7 @@ Yanked
|
|
1526
1549
|
- Improved sql sanitization
|
1527
1550
|
- Improved mongoid/mongodb sanitization
|
1528
1551
|
- Minor performance improvements
|
1529
|
-
- Better handling for non-utf8
|
1552
|
+
- Better handling for non-utf8 convertible strings
|
1530
1553
|
- Make gem installable (but not functional) on JRuby
|
1531
1554
|
|
1532
1555
|
## 1.0.4
|
@@ -1707,7 +1730,7 @@ Yanked
|
|
1707
1730
|
Yanked
|
1708
1731
|
|
1709
1732
|
## 0.8.8
|
1710
|
-
-
|
1733
|
+
- Explicitly require securerandom
|
1711
1734
|
|
1712
1735
|
## 0.8.7
|
1713
1736
|
- Dup process action event to avoid threading issue
|
data/Rakefile
CHANGED
@@ -219,7 +219,7 @@ namespace :build do
|
|
219
219
|
Gem::PackageTask.new(base_gemspec, &block)
|
220
220
|
rescue StandardError => e
|
221
221
|
puts "Warning: An error occurred defining `build:#{task_name}:gem` Rake task."
|
222
|
-
puts "This task will not be
|
222
|
+
puts "This task will not be available."
|
223
223
|
if ENV["DEBUG"]
|
224
224
|
puts "#{e}: #{e.message}"
|
225
225
|
puts e.backtrace
|
data/ext/agent.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# Modifications to this file will be overwritten with the next agent release.
|
7
7
|
|
8
8
|
APPSIGNAL_AGENT_CONFIG = {
|
9
|
-
"version" => "0.
|
9
|
+
"version" => "0.34.1",
|
10
10
|
"mirrors" => [
|
11
11
|
"https://appsignal-agent-releases.global.ssl.fastly.net",
|
12
12
|
"https://d135dj0rjqvssy.cloudfront.net"
|
@@ -14,131 +14,131 @@ APPSIGNAL_AGENT_CONFIG = {
|
|
14
14
|
"triples" => {
|
15
15
|
"x86_64-darwin" => {
|
16
16
|
"static" => {
|
17
|
-
"checksum" => "
|
17
|
+
"checksum" => "351f3dae916d3e84177d8cc35eaeaca5345f4deca9e0925a29353915cc0530d2",
|
18
18
|
"filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
|
19
19
|
},
|
20
20
|
"dynamic" => {
|
21
|
-
"checksum" => "
|
21
|
+
"checksum" => "91ecacdf5e826dd21d5da26c07c5ecffd668cb16eaf15388d08a223425e716bb",
|
22
22
|
"filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
|
23
23
|
}
|
24
24
|
},
|
25
25
|
"universal-darwin" => {
|
26
26
|
"static" => {
|
27
|
-
"checksum" => "
|
27
|
+
"checksum" => "351f3dae916d3e84177d8cc35eaeaca5345f4deca9e0925a29353915cc0530d2",
|
28
28
|
"filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
|
29
29
|
},
|
30
30
|
"dynamic" => {
|
31
|
-
"checksum" => "
|
31
|
+
"checksum" => "91ecacdf5e826dd21d5da26c07c5ecffd668cb16eaf15388d08a223425e716bb",
|
32
32
|
"filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
|
33
33
|
}
|
34
34
|
},
|
35
35
|
"aarch64-darwin" => {
|
36
36
|
"static" => {
|
37
|
-
"checksum" => "
|
37
|
+
"checksum" => "fd7359232fbd65f10ee565fcf65f4afa6d7a2ba1a8dead200c34736ca942df16",
|
38
38
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
39
39
|
},
|
40
40
|
"dynamic" => {
|
41
|
-
"checksum" => "
|
41
|
+
"checksum" => "a53ed8cc13d2821a4eee1ea7e4e58346125f27309973d4a2e8f059f129e927e2",
|
42
42
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
43
43
|
}
|
44
44
|
},
|
45
45
|
"arm64-darwin" => {
|
46
46
|
"static" => {
|
47
|
-
"checksum" => "
|
47
|
+
"checksum" => "fd7359232fbd65f10ee565fcf65f4afa6d7a2ba1a8dead200c34736ca942df16",
|
48
48
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
49
49
|
},
|
50
50
|
"dynamic" => {
|
51
|
-
"checksum" => "
|
51
|
+
"checksum" => "a53ed8cc13d2821a4eee1ea7e4e58346125f27309973d4a2e8f059f129e927e2",
|
52
52
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
53
53
|
}
|
54
54
|
},
|
55
55
|
"arm-darwin" => {
|
56
56
|
"static" => {
|
57
|
-
"checksum" => "
|
57
|
+
"checksum" => "fd7359232fbd65f10ee565fcf65f4afa6d7a2ba1a8dead200c34736ca942df16",
|
58
58
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
59
59
|
},
|
60
60
|
"dynamic" => {
|
61
|
-
"checksum" => "
|
61
|
+
"checksum" => "a53ed8cc13d2821a4eee1ea7e4e58346125f27309973d4a2e8f059f129e927e2",
|
62
62
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
63
63
|
}
|
64
64
|
},
|
65
65
|
"aarch64-linux" => {
|
66
66
|
"static" => {
|
67
|
-
"checksum" => "
|
67
|
+
"checksum" => "dfbab18b7faa24684bf0ab57666b6b493356a3da43ecdba2e992b2d6d513cf31",
|
68
68
|
"filename" => "appsignal-aarch64-linux-all-static.tar.gz"
|
69
69
|
},
|
70
70
|
"dynamic" => {
|
71
|
-
"checksum" => "
|
71
|
+
"checksum" => "865b8f034aa680aa6cdfe77cf117f071f9b5857c92cc7b6f36decfd5b2293b27",
|
72
72
|
"filename" => "appsignal-aarch64-linux-all-dynamic.tar.gz"
|
73
73
|
}
|
74
74
|
},
|
75
75
|
"i686-linux" => {
|
76
76
|
"static" => {
|
77
|
-
"checksum" => "
|
77
|
+
"checksum" => "ce4a819f3eaa4590795497915e4a20b3fe281a0821364b80d26ffd1391af67a8",
|
78
78
|
"filename" => "appsignal-i686-linux-all-static.tar.gz"
|
79
79
|
},
|
80
80
|
"dynamic" => {
|
81
|
-
"checksum" => "
|
81
|
+
"checksum" => "195d570b7f6b1ea5d2ced90dc12d68a6627e1886d078258b5483163e52afc620",
|
82
82
|
"filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
|
83
83
|
}
|
84
84
|
},
|
85
85
|
"x86-linux" => {
|
86
86
|
"static" => {
|
87
|
-
"checksum" => "
|
87
|
+
"checksum" => "ce4a819f3eaa4590795497915e4a20b3fe281a0821364b80d26ffd1391af67a8",
|
88
88
|
"filename" => "appsignal-i686-linux-all-static.tar.gz"
|
89
89
|
},
|
90
90
|
"dynamic" => {
|
91
|
-
"checksum" => "
|
91
|
+
"checksum" => "195d570b7f6b1ea5d2ced90dc12d68a6627e1886d078258b5483163e52afc620",
|
92
92
|
"filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
|
93
93
|
}
|
94
94
|
},
|
95
95
|
"x86_64-linux" => {
|
96
96
|
"static" => {
|
97
|
-
"checksum" => "
|
97
|
+
"checksum" => "e55f9ecb4e4b51e9232918216487712b63a7cfea9710763f61077e8d40d53dbe",
|
98
98
|
"filename" => "appsignal-x86_64-linux-all-static.tar.gz"
|
99
99
|
},
|
100
100
|
"dynamic" => {
|
101
|
-
"checksum" => "
|
101
|
+
"checksum" => "b5edf38f4ac2725907995518a1d09dc09c70cae600d1d3a287e0b6404c2301d2",
|
102
102
|
"filename" => "appsignal-x86_64-linux-all-dynamic.tar.gz"
|
103
103
|
}
|
104
104
|
},
|
105
105
|
"x86_64-linux-musl" => {
|
106
106
|
"static" => {
|
107
|
-
"checksum" => "
|
107
|
+
"checksum" => "8963ebc98405648205a6d8aa371bafa49cb33cd104e0c3e6cc1856ba41fe3d8c",
|
108
108
|
"filename" => "appsignal-x86_64-linux-musl-all-static.tar.gz"
|
109
109
|
},
|
110
110
|
"dynamic" => {
|
111
|
-
"checksum" => "
|
111
|
+
"checksum" => "6b5bab353f1597e64d0dc7638f02e8a0c4da2b341991f8e8efb251d8f94878a2",
|
112
112
|
"filename" => "appsignal-x86_64-linux-musl-all-dynamic.tar.gz"
|
113
113
|
}
|
114
114
|
},
|
115
115
|
"aarch64-linux-musl" => {
|
116
116
|
"static" => {
|
117
|
-
"checksum" => "
|
117
|
+
"checksum" => "34bb72678b896a2a8289a97611a61a297b5a0e6110f5085a683ad93857cdf26c",
|
118
118
|
"filename" => "appsignal-aarch64-linux-musl-all-static.tar.gz"
|
119
119
|
},
|
120
120
|
"dynamic" => {
|
121
|
-
"checksum" => "
|
121
|
+
"checksum" => "999e0bdc36613f9e016b01d4a00fab864b5996472e32ff1e03a0019877cd5e5d",
|
122
122
|
"filename" => "appsignal-aarch64-linux-musl-all-dynamic.tar.gz"
|
123
123
|
}
|
124
124
|
},
|
125
125
|
"x86_64-freebsd" => {
|
126
126
|
"static" => {
|
127
|
-
"checksum" => "
|
127
|
+
"checksum" => "68e882ba3bc87328953d9bfbb676b00d4199756a7090d5cdc265a4b32d857cc5",
|
128
128
|
"filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
|
129
129
|
},
|
130
130
|
"dynamic" => {
|
131
|
-
"checksum" => "
|
131
|
+
"checksum" => "3e770a387ada2e12052929c6f4ea141d05bd3dec5337ca53bbcf1078a6a2537d",
|
132
132
|
"filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
|
133
133
|
}
|
134
134
|
},
|
135
135
|
"amd64-freebsd" => {
|
136
136
|
"static" => {
|
137
|
-
"checksum" => "
|
137
|
+
"checksum" => "68e882ba3bc87328953d9bfbb676b00d4199756a7090d5cdc265a4b32d857cc5",
|
138
138
|
"filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
|
139
139
|
},
|
140
140
|
"dynamic" => {
|
141
|
-
"checksum" => "
|
141
|
+
"checksum" => "3e770a387ada2e12052929c6f4ea141d05bd3dec5337ca53bbcf1078a6a2537d",
|
142
142
|
"filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
|
143
143
|
}
|
144
144
|
}
|
data/lib/appsignal/auth_check.rb
CHANGED
@@ -40,7 +40,7 @@ module Appsignal
|
|
40
40
|
# @return [Array<String/nil, String>] response tuple.
|
41
41
|
# - First value is the response status code.
|
42
42
|
# - Second value is a description of the response and the exception error
|
43
|
-
# message if an exception
|
43
|
+
# message if an exception occurred.
|
44
44
|
def perform_with_result
|
45
45
|
status = perform
|
46
46
|
result =
|
data/lib/appsignal/config.rb
CHANGED
@@ -70,6 +70,7 @@ module Appsignal
|
|
70
70
|
"APPSIGNAL_APP_NAME" => :name,
|
71
71
|
"APPSIGNAL_BIND_ADDRESS" => :bind_address,
|
72
72
|
"APPSIGNAL_CA_FILE_PATH" => :ca_file_path,
|
73
|
+
"APPSIGNAL_CPU_COUNT" => :cpu_count,
|
73
74
|
"APPSIGNAL_DEBUG" => :debug,
|
74
75
|
"APPSIGNAL_DNS_SERVERS" => :dns_servers,
|
75
76
|
"APPSIGNAL_ENABLE_ALLOCATION_TRACKING" => :enable_allocation_tracking,
|
@@ -167,6 +168,9 @@ module Appsignal
|
|
167
168
|
APPSIGNAL_IGNORE_NAMESPACES
|
168
169
|
APPSIGNAL_REQUEST_HEADERS
|
169
170
|
].freeze
|
171
|
+
ENV_FLOAT_KEYS = %w[
|
172
|
+
APPSIGNAL_CPU_COUNT
|
173
|
+
].freeze
|
170
174
|
|
171
175
|
# @attribute [r] system_config
|
172
176
|
# Config detected on the system level.
|
@@ -344,6 +348,7 @@ module Appsignal
|
|
344
348
|
ENV["_APPSIGNAL_APP_PATH"] = root_path.to_s
|
345
349
|
ENV["_APPSIGNAL_BIND_ADDRESS"] = config_hash[:bind_address].to_s
|
346
350
|
ENV["_APPSIGNAL_CA_FILE_PATH"] = config_hash[:ca_file_path].to_s
|
351
|
+
ENV["_APPSIGNAL_CPU_COUNT"] = config_hash[:cpu_count].to_s
|
347
352
|
ENV["_APPSIGNAL_DEBUG_LOGGING"] = config_hash[:debug].to_s
|
348
353
|
ENV["_APPSIGNAL_DNS_SERVERS"] = config_hash[:dns_servers].join(",")
|
349
354
|
ENV["_APPSIGNAL_ENABLE_HOST_METRICS"] = config_hash[:enable_host_metrics].to_s
|
@@ -444,7 +449,7 @@ module Appsignal
|
|
444
449
|
"'APPSIGNAL_INACTIVE_ON_CONFIG_FILE_ERROR=1' in your system " \
|
445
450
|
"environment."
|
446
451
|
end
|
447
|
-
message = "An error
|
452
|
+
message = "An error occurred while loading the AppSignal config file. " \
|
448
453
|
"#{extra_message}\n" \
|
449
454
|
"File: #{config_file.inspect}\n" \
|
450
455
|
"#{e.class.name}: #{e}"
|
@@ -501,6 +506,14 @@ module Appsignal
|
|
501
506
|
config[ENV_TO_KEY_MAPPING[var]] = env_var.split(",")
|
502
507
|
end
|
503
508
|
|
509
|
+
# Configuration with float type
|
510
|
+
ENV_FLOAT_KEYS.each do |var|
|
511
|
+
env_var = ENV.fetch(var, nil)
|
512
|
+
next unless env_var
|
513
|
+
|
514
|
+
config[ENV_TO_KEY_MAPPING[var]] = env_var.to_f
|
515
|
+
end
|
516
|
+
|
504
517
|
config
|
505
518
|
end
|
506
519
|
|
@@ -4,7 +4,7 @@ module Appsignal
|
|
4
4
|
class EventFormatter
|
5
5
|
# @api private
|
6
6
|
module Sequel
|
7
|
-
#
|
7
|
+
# Compatibility with the sequel-rails gem.
|
8
8
|
# The sequel-rails gem adds its own ActiveSupport::Notifications events
|
9
9
|
# that conflict with our own sequel instrumentor. Without this event
|
10
10
|
# formatter the sequel-rails events are recorded without the SQL query
|
@@ -60,9 +60,13 @@ module Appsignal
|
|
60
60
|
return unless handled
|
61
61
|
|
62
62
|
Appsignal.send_error(error) do |transaction|
|
63
|
-
namespace, action_name, tags, custom_data =
|
63
|
+
namespace, action_name, path, method, params, tags, custom_data =
|
64
|
+
context_for(context.dup)
|
64
65
|
transaction.set_namespace(namespace) if namespace
|
65
66
|
transaction.set_action(action_name) if action_name
|
67
|
+
transaction.set_metadata("path", path)
|
68
|
+
transaction.set_metadata("method", method)
|
69
|
+
transaction.params = params
|
66
70
|
transaction.set_sample_data("custom_data", custom_data) if custom_data
|
67
71
|
|
68
72
|
tags[:severity] = severity
|
@@ -81,9 +85,17 @@ module Appsignal
|
|
81
85
|
# Fetch the namespace and action name based on the Rails execution
|
82
86
|
# context.
|
83
87
|
controller = context.delete(:controller)
|
88
|
+
path = nil
|
89
|
+
method = nil
|
90
|
+
params = nil
|
84
91
|
if controller
|
85
92
|
namespace = Appsignal::Transaction::HTTP_REQUEST
|
86
93
|
action_name = "#{controller.class.name}##{controller.action_name}"
|
94
|
+
unless controller.request.nil?
|
95
|
+
path = controller.request.path
|
96
|
+
method = controller.request.method
|
97
|
+
params = controller.request.filtered_parameters
|
98
|
+
end
|
87
99
|
end
|
88
100
|
# ActiveJob transaction naming relies on the current AppSignal
|
89
101
|
# transaction namespace and action name copying done after this.
|
@@ -115,7 +127,7 @@ module Appsignal
|
|
115
127
|
end
|
116
128
|
tags.merge!(context)
|
117
129
|
|
118
|
-
[namespace, action_name, tags, custom_data]
|
130
|
+
[namespace, action_name, path, method, params, tags, custom_data]
|
119
131
|
end
|
120
132
|
end
|
121
133
|
end
|
data/lib/appsignal/logger.rb
CHANGED
@@ -64,7 +64,7 @@ module Appsignal
|
|
64
64
|
alias log add
|
65
65
|
|
66
66
|
# Log a debug level message
|
67
|
-
# @param message
|
67
|
+
# @param message Message to log
|
68
68
|
# @param attributes Attributes to tag the log with
|
69
69
|
# @return [void]
|
70
70
|
def debug(message = nil, attributes = {})
|
@@ -77,7 +77,7 @@ module Appsignal
|
|
77
77
|
end
|
78
78
|
|
79
79
|
# Log an info level message
|
80
|
-
# @param message
|
80
|
+
# @param message Message to log
|
81
81
|
# @param attributes Attributes to tag the log with
|
82
82
|
# @return [void]
|
83
83
|
def info(message = nil, attributes = {})
|
@@ -90,7 +90,7 @@ module Appsignal
|
|
90
90
|
end
|
91
91
|
|
92
92
|
# Log a warn level message
|
93
|
-
# @param message
|
93
|
+
# @param message Message to log
|
94
94
|
# @param attributes Attributes to tag the log with
|
95
95
|
# @return [void]
|
96
96
|
def warn(message = nil, attributes = {})
|
@@ -103,7 +103,7 @@ module Appsignal
|
|
103
103
|
end
|
104
104
|
|
105
105
|
# Log an error level message
|
106
|
-
# @param message
|
106
|
+
# @param message Message to log
|
107
107
|
# @param attributes Attributes to tag the log with
|
108
108
|
# @return [void]
|
109
109
|
def error(message = nil, attributes = {})
|
@@ -116,7 +116,7 @@ module Appsignal
|
|
116
116
|
end
|
117
117
|
|
118
118
|
# Log a fatal level message
|
119
|
-
# @param message
|
119
|
+
# @param message Message to log
|
120
120
|
# @param attributes Attributes to tag the log with
|
121
121
|
# @return [void]
|
122
122
|
def fatal(message = nil, attributes = {})
|
@@ -16,9 +16,7 @@ module Appsignal
|
|
16
16
|
if Appsignal.active?
|
17
17
|
call_with_appsignal_monitoring(env)
|
18
18
|
else
|
19
|
-
|
20
|
-
status, headers, obody = @app.call(env)
|
21
|
-
[status, headers, Appsignal::Rack::BodyWrapper.wrap(obody, nil_transaction)]
|
19
|
+
@app.call(env)
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
@@ -29,30 +27,19 @@ module Appsignal
|
|
29
27
|
Appsignal::Transaction::HTTP_REQUEST,
|
30
28
|
request
|
31
29
|
)
|
32
|
-
# We need to complete the transaction if there is an exception inside the `call`
|
33
|
-
# of the app. If there isn't one and the app returns us a Rack response triplet, we let
|
34
|
-
# the BodyWrapper complete the transaction when #close gets called on it
|
35
|
-
# (guaranteed by the webserver)
|
36
|
-
complete_transaction_without_body = false
|
37
30
|
begin
|
38
31
|
Appsignal.instrument("process_action.generic") do
|
39
|
-
|
40
|
-
[status, headers, Appsignal::Rack::BodyWrapper.wrap(obody, transaction)]
|
32
|
+
@app.call(env)
|
41
33
|
end
|
42
34
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
43
35
|
transaction.set_error(error)
|
44
|
-
complete_transaction_without_body = true
|
45
36
|
raise error
|
46
37
|
ensure
|
47
|
-
|
48
|
-
transaction.set_action_if_nil(default_action)
|
38
|
+
transaction.set_action_if_nil(env["appsignal.route"] || "unknown")
|
49
39
|
transaction.set_metadata("path", request.path)
|
50
40
|
transaction.set_metadata("method", request.request_method)
|
51
41
|
transaction.set_http_or_background_queue_start
|
52
|
-
|
53
|
-
# Transaction gets completed when the body gets read out, except in cases when
|
54
|
-
# the app failed before returning us the Rack response triplet.
|
55
|
-
Appsignal::Transaction.complete_current! if complete_transaction_without_body
|
42
|
+
Appsignal::Transaction.complete_current!
|
56
43
|
end
|
57
44
|
end
|
58
45
|
end
|
@@ -16,9 +16,7 @@ module Appsignal
|
|
16
16
|
if Appsignal.active?
|
17
17
|
call_with_appsignal_monitoring(env)
|
18
18
|
else
|
19
|
-
|
20
|
-
status, headers, obody = @app.call(env)
|
21
|
-
[status, headers, Appsignal::Rack::BodyWrapper.wrap(obody, nil_transaction)]
|
19
|
+
@app.call(env)
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
@@ -30,17 +28,10 @@ module Appsignal
|
|
30
28
|
request,
|
31
29
|
:params_method => :filtered_parameters
|
32
30
|
)
|
33
|
-
# We need to complete the transaction if there is an exception exception inside the `call`
|
34
|
-
# of the app. If there isn't one and the app returns us a Rack response triplet, we let
|
35
|
-
# the BodyWrapper complete the transaction when #close gets called on it
|
36
|
-
# (guaranteed by the webserver)
|
37
|
-
complete_transaction_without_body = false
|
38
31
|
begin
|
39
|
-
|
40
|
-
[status, headers, Appsignal::Rack::BodyWrapper.wrap(obody, transaction)]
|
32
|
+
@app.call(env)
|
41
33
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
42
34
|
transaction.set_error(error)
|
43
|
-
complete_transaction_without_body = true
|
44
35
|
raise error
|
45
36
|
ensure
|
46
37
|
controller = env["action_controller.instance"]
|
@@ -54,10 +45,7 @@ module Appsignal
|
|
54
45
|
rescue => error
|
55
46
|
Appsignal.internal_logger.error("Unable to report HTTP request method: '#{error}'")
|
56
47
|
end
|
57
|
-
|
58
|
-
# Transaction gets completed when the body gets read out, except in cases when
|
59
|
-
# the app failed before returning us the Rack response triplet.
|
60
|
-
Appsignal::Transaction.complete_current! if complete_transaction_without_body
|
48
|
+
Appsignal::Transaction.complete_current!
|
61
49
|
end
|
62
50
|
end
|
63
51
|
|
@@ -42,9 +42,7 @@ module Appsignal
|
|
42
42
|
if Appsignal.active?
|
43
43
|
call_with_appsignal_monitoring(env)
|
44
44
|
else
|
45
|
-
|
46
|
-
status, headers, obody = @app.call(env)
|
47
|
-
[status, headers, Appsignal::Rack::BodyWrapper.wrap(obody, nil_transaction)]
|
45
|
+
@app.call(env)
|
48
46
|
end
|
49
47
|
end
|
50
48
|
|
@@ -58,19 +56,12 @@ module Appsignal
|
|
58
56
|
request,
|
59
57
|
options
|
60
58
|
)
|
61
|
-
# We need to complete the transaction if there is an exception exception inside the `call`
|
62
|
-
# of the app. If there isn't one and the app returns us a Rack response triplet, we let
|
63
|
-
# the BodyWrapper complete the transaction when #close gets called on it
|
64
|
-
# (guaranteed by the webserver)
|
65
|
-
complete_transaction_without_body = false
|
66
59
|
begin
|
67
60
|
Appsignal.instrument("process_action.sinatra") do
|
68
|
-
|
69
|
-
[status, headers, Appsignal::Rack::BodyWrapper.wrap(obody, transaction)]
|
61
|
+
@app.call(env)
|
70
62
|
end
|
71
63
|
rescue Exception => error # rubocop:disable Lint/RescueException
|
72
64
|
transaction.set_error(error)
|
73
|
-
complete_transaction_without_body = true
|
74
65
|
raise error
|
75
66
|
ensure
|
76
67
|
# If raise_error is off versions of Sinatra don't raise errors, but store
|
@@ -82,10 +73,7 @@ module Appsignal
|
|
82
73
|
transaction.set_metadata("path", request.path)
|
83
74
|
transaction.set_metadata("method", request.request_method)
|
84
75
|
transaction.set_http_or_background_queue_start
|
85
|
-
|
86
|
-
# Transaction gets completed when the body gets read out, except in cases when
|
87
|
-
# the app failed before returning us the Rack response triplet.
|
88
|
-
Appsignal::Transaction.complete_current! if complete_transaction_without_body
|
76
|
+
Appsignal::Transaction.complete_current!
|
89
77
|
end
|
90
78
|
end
|
91
79
|
|
@@ -16,9 +16,7 @@ module Appsignal
|
|
16
16
|
if Appsignal.active?
|
17
17
|
call_with_appsignal_monitoring(env)
|
18
18
|
else
|
19
|
-
|
20
|
-
status, headers, obody = @app.call(env)
|
21
|
-
[status, headers, Appsignal::Rack::BodyWrapper.wrap(obody, nil_transaction)]
|
19
|
+
@app.call(env)
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
@@ -30,35 +28,46 @@ module Appsignal
|
|
30
28
|
request
|
31
29
|
)
|
32
30
|
|
33
|
-
# We need to complete the transaction if there is an exception exception inside the `call`
|
34
|
-
# of the app. If there isn't one and the app returns us a Rack response triplet, we let
|
35
|
-
# the BodyWrapper complete the transaction when #close gets called on it
|
36
|
-
# (guaranteed by the webserver)
|
37
|
-
complete_transaction_without_body = false
|
38
|
-
|
39
31
|
# Instrument a `process_action`, to set params/action name
|
40
|
-
|
32
|
+
status, headers, body =
|
41
33
|
Appsignal.instrument("process_action.rack") do
|
42
|
-
|
43
|
-
|
34
|
+
@app.call(env)
|
35
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
36
|
+
transaction.set_error(e)
|
37
|
+
raise e
|
38
|
+
ensure
|
39
|
+
transaction.set_action_if_nil(env["appsignal.action"])
|
40
|
+
transaction.set_metadata("path", request.path)
|
41
|
+
transaction.set_metadata("method", request.request_method)
|
42
|
+
transaction.set_http_or_background_queue_start
|
44
43
|
end
|
45
|
-
rescue Exception => error # rubocop:disable Lint/RescueException
|
46
|
-
transaction.set_error(error)
|
47
|
-
complete_transaction_without_body = true
|
48
|
-
raise error
|
49
|
-
ensure
|
50
|
-
transaction.set_action_if_nil(env["appsignal.action"])
|
51
|
-
transaction.set_metadata("path", request.path)
|
52
|
-
transaction.set_metadata("method", request.request_method)
|
53
|
-
transaction.set_http_or_background_queue_start
|
54
44
|
|
55
|
-
|
56
|
-
|
57
|
-
Appsignal::Transaction.complete_current! if complete_transaction_without_body
|
58
|
-
end
|
45
|
+
# Wrap the result body with our StreamWrapper
|
46
|
+
[status, headers, StreamWrapper.new(body, transaction)]
|
59
47
|
end
|
60
48
|
end
|
61
49
|
end
|
62
50
|
|
63
|
-
StreamWrapper
|
51
|
+
class StreamWrapper
|
52
|
+
def initialize(stream, transaction)
|
53
|
+
@stream = stream
|
54
|
+
@transaction = transaction
|
55
|
+
end
|
56
|
+
|
57
|
+
def each(&block)
|
58
|
+
@stream.each(&block)
|
59
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
60
|
+
@transaction.set_error(e)
|
61
|
+
raise e
|
62
|
+
end
|
63
|
+
|
64
|
+
def close
|
65
|
+
@stream.close if @stream.respond_to?(:close)
|
66
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
67
|
+
@transaction.set_error(e)
|
68
|
+
raise e
|
69
|
+
ensure
|
70
|
+
Appsignal::Transaction.complete_current!
|
71
|
+
end
|
72
|
+
end
|
64
73
|
end
|
data/lib/appsignal/version.rb
CHANGED
data/lib/appsignal.rb
CHANGED
@@ -305,6 +305,5 @@ require "appsignal/garbage_collection"
|
|
305
305
|
require "appsignal/integrations/railtie" if defined?(::Rails)
|
306
306
|
require "appsignal/transaction"
|
307
307
|
require "appsignal/version"
|
308
|
-
require "appsignal/rack/body_wrapper"
|
309
308
|
require "appsignal/rack/generic_instrumentation"
|
310
309
|
require "appsignal/transmitter"
|
@@ -18,7 +18,7 @@ Puma::Plugin.create do # rubocop:disable Metrics/BlockLength
|
|
18
18
|
|
19
19
|
loop do
|
20
20
|
# Implement similar behavior to minutely probes.
|
21
|
-
# Initial sleep to wait until the app is fully
|
21
|
+
# Initial sleep to wait until the app is fully initialized.
|
22
22
|
# Then loop every 60 seconds and collect the Puma stats as AppSignal
|
23
23
|
# metrics.
|
24
24
|
sleep sleep_time
|