appsignal 3.3.11 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,16 +1,14 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
- ## 3.3.11
3
+ ## 3.4.0
4
4
 
5
- ### Changed
5
+ ### Deprecated
6
6
 
7
- - [75ce75bb](https://github.com/appsignal/appsignal-ruby/commit/75ce75bbd277a4a53a2ab000e322d2775bd7913a) patch - Bump agent to 6bec691.
8
-
9
- - Upgrade `sql_lexer` to v0.9.5. It adds sanitization support for the `THEN` and `ELSE` logical operators.
10
- - Only ignore disk metrics that start with "loop", not all mounted disks that end with a number to report metrics for more disks.
11
- - Rely on APPSIGNAL_RUNNING_IN_CONTAINER config option value before other environment factors to determine if the app is running in a container.
12
- - Fix container detection for hosts running Docker itself.
13
- - Add APPSIGNAL_STATSD_PORT config option.
7
+ - [6f9b7a4d](https://github.com/appsignal/appsignal-ruby/commit/6f9b7a4d12c6ff3353359cb37c5c02af8bbc6ec6) minor - Remove support for Ruby versions in that are end of life, following our [maintenance policy](https://docs.appsignal.com/support/maintenance-policy.html). Please upgrade your Ruby version to a supported version before upgrading AppSignal.
8
+
9
+ ### Fixed
10
+
11
+ - [5b7735ac](https://github.com/appsignal/appsignal-ruby/commit/5b7735ac5868b0fbf9727922a32ca4645d4e2fdd) patch - Fix Logger add method signature error
14
12
 
15
13
  ## 3.3.10
16
14
 
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  gemspec
data/appsignal.gemspec CHANGED
@@ -1,4 +1,6 @@
1
- require File.expand_path("../lib/appsignal/version", __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("lib/appsignal/version", __dir__)
2
4
 
3
5
  Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
4
6
  gem.authors = [
@@ -19,50 +21,28 @@ Gem::Specification.new do |gem| # rubocop:disable Metrics/BlockLength
19
21
  gem.name = "appsignal"
20
22
  gem.require_paths = %w[lib ext]
21
23
  gem.version = Appsignal::VERSION
22
- gem.required_ruby_version = ">= 2.0"
24
+ gem.required_ruby_version = ">= 3.0"
23
25
  # Default extension installer. Overridden by JRuby gemspec as defined in
24
26
  # `Rakefile`.
25
27
  gem.extensions = %w[ext/extconf.rb]
26
28
 
27
29
  gem.metadata = {
28
30
  "rubygems_mfa_required" => "true",
29
- "bug_tracker_uri" => "https://github.com/appsignal/appsignal-ruby/issues",
30
- "changelog_uri" =>
31
+ "bug_tracker_uri" => "https://github.com/appsignal/appsignal-ruby/issues",
32
+ "changelog_uri" =>
31
33
  "https://github.com/appsignal/appsignal-ruby/blob/main/CHANGELOG.md",
32
34
  "documentation_uri" => "https://docs.appsignal.com/ruby/",
33
- "homepage_uri" => "https://docs.appsignal.com/ruby/",
34
- "source_code_uri" => "https://github.com/appsignal/appsignal-ruby"
35
+ "homepage_uri" => "https://docs.appsignal.com/ruby/",
36
+ "source_code_uri" => "https://github.com/appsignal/appsignal-ruby"
35
37
  }
36
38
 
37
39
  gem.add_dependency "rack"
38
40
 
41
+ gem.add_development_dependency "pry"
39
42
  gem.add_development_dependency "rake", ">= 12"
40
43
  gem.add_development_dependency "rspec", "~> 3.8"
44
+ gem.add_development_dependency "rubocop"
41
45
  gem.add_development_dependency "timecop"
46
+ gem.add_development_dependency "webmock"
42
47
  gem.add_development_dependency "yard", ">= 0.9.20"
43
- gem.add_development_dependency "pry"
44
-
45
- # Dependencies that need to be locked to a specific version in developement
46
- ruby_version = Gem::Version.new(RUBY_VERSION)
47
- if ruby_version < Gem::Version.new("2.3.0")
48
- gem.add_development_dependency "webmock", "3.14.0"
49
- else
50
- gem.add_development_dependency "webmock"
51
- end
52
- if ruby_version > Gem::Version.new("2.5.0")
53
- # RuboCop dependency parallel depends on Ruby > 2.4
54
- gem.add_development_dependency "rubocop", "0.50.0"
55
- end
56
- if ruby_version < Gem::Version.new("2.1.0")
57
- # Newer versions of rexml use keyword arguments with optional arguments which
58
- # work in Ruby 2.1 and newer.
59
- gem.add_development_dependency "rexml", "3.2.4"
60
- end
61
- if ruby_version < Gem::Version.new("2.1.0")
62
- # public_suffix 3.0 and newer don't support Ruby < 2.1
63
- gem.add_development_dependency "public_suffix", "~> 2.0.5"
64
- elsif ruby_version < Gem::Version.new("2.3.0")
65
- # public_suffix 4.0 and newer don't support Ruby < 2.3
66
- gem.add_development_dependency "public_suffix", "~> 3.1.1"
67
- end
68
48
  end
data/build_matrix.yml CHANGED
@@ -61,7 +61,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
61
61
  - name: Validate CI setup
62
62
  env_vars:
63
63
  - name: RUBY_VERSION
64
- value: 2.6.9
64
+ value: 3.2.2
65
65
  - name: GEMSET
66
66
  value: no_dependencies
67
67
  - name: BUNDLE_GEMFILE
@@ -85,7 +85,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
85
85
  - name: RuboCop
86
86
  env_vars:
87
87
  - name: RUBY_VERSION
88
- value: 2.6.9
88
+ value: 3.2.2
89
89
  - name: GEMSET
90
90
  value: no_dependencies
91
91
  - name: BUNDLE_GEMFILE
@@ -165,45 +165,16 @@ matrix:
165
165
  gemsets: # By default all gems are tested
166
166
  none:
167
167
  - "no_dependencies"
168
- old_rails:
169
- - "no_dependencies"
170
- - "rails-3.2"
171
- - "rails-4.2"
172
168
  minimal:
173
169
  - "no_dependencies"
174
- - "rails-5.2"
175
170
  - "rails-6.0"
176
171
  - "rails-6.1"
177
172
  - "rails-7.0"
178
173
 
179
174
  ruby:
180
- - ruby: "2.0.0-p648"
181
- rubygems: "2.7.8"
182
- bundler: "1.17.3"
183
- gems: "old_rails"
184
- - ruby: "2.1.10"
185
- rubygems: "2.7.8"
186
- bundler: "1.17.3"
187
- gems: "none"
188
- - ruby: "2.2.10"
189
- rubygems: "2.7.8"
190
- bundler: "1.17.3"
191
- gems: "none"
192
- - ruby: "2.3.8"
193
- gems: "none"
194
- rubygems: "3.3.26"
195
- bundler: "2.3.26"
196
- - ruby: "2.4.10"
197
- gems: "none"
198
- - ruby: "2.5.8"
199
- gems: "minimal"
200
- - ruby: "2.6.9"
201
- - ruby: "2.7.7"
202
175
  - ruby: "3.0.5"
203
176
  - ruby: "3.1.3"
204
177
  - ruby: "3.2.1"
205
- - ruby: "jruby-9.3.9.0"
206
- gems: "minimal"
207
178
  - ruby: "jruby-9.4.0.0"
208
179
  gems: "minimal"
209
180
  gems:
@@ -233,73 +204,14 @@ matrix:
233
204
  - "3.2.1"
234
205
  - gem: "que"
235
206
  - gem: "que_beta"
236
- - gem: "rails-3.2"
237
- bundler: "1.17.3"
238
- only:
239
- ruby:
240
- - "2.0.0-p648"
241
- - "2.1.10"
242
- - "2.2.10"
243
- - "2.3.8"
244
- - "2.4.10"
245
- - "2.5.8"
246
- - gem: "rails-4.2"
247
- bundler: "1.17.3"
248
- only:
249
- ruby:
250
- - "2.1.10"
251
- - "2.2.10"
252
- - "2.3.8"
253
- - "2.4.10"
254
- - "2.5.8"
255
- - gem: "rails-5.0"
256
- only:
257
- ruby:
258
- - "2.0.0-p648"
259
- - "2.1.10"
260
- - "2.2.10"
261
- - "2.3.8"
262
- - "2.4.10"
263
- - "2.5.8"
264
- - "2.6.9"
265
- - "2.7.7"
266
- - gem: "rails-5.1"
267
- only:
268
- ruby:
269
- - "2.0.0-p648"
270
- - "2.1.10"
271
- - "2.2.10"
272
- - "2.3.8"
273
- - "2.4.10"
274
- - "2.5.8"
275
- - "2.6.9"
276
- - "2.7.7"
277
- - gem: "rails-5.2"
278
- only:
279
- ruby:
280
- - "2.0.0-p648"
281
- - "2.1.10"
282
- - "2.2.10"
283
- - "2.3.8"
284
- - "2.4.10"
285
- - "2.5.8"
286
- - "2.6.9"
287
- - "2.7.7"
288
- - "jruby-9.3.9.0"
289
207
  - gem: "rails-6.0"
290
208
  only:
291
209
  ruby:
292
- - "2.5.8"
293
- - "2.6.9"
294
- - "2.7.7"
295
210
  - "3.0.5"
296
211
  - "jruby-9.4.0.0"
297
212
  - gem: "rails-6.1"
298
213
  only:
299
214
  ruby:
300
- - "2.5.8"
301
- - "2.6.9"
302
- - "2.7.7"
303
215
  - "3.0.5"
304
216
  - "3.1.3"
305
217
  - "3.2.1"
@@ -307,36 +219,11 @@ matrix:
307
219
  - gem: "rails-7.0"
308
220
  only:
309
221
  ruby:
310
- - "2.7.7"
311
222
  - "3.0.5"
312
223
  - "3.1.3"
313
224
  - "3.2.1"
314
225
  - "jruby-9.4.0.0"
315
- - gem: "resque-1"
316
- bundler: "1.17.3"
317
- only:
318
- ruby:
319
- - "2.0.0-p648"
320
- - "2.1.10"
321
- - "2.2.10"
322
- - "2.3.8"
323
- - "2.4.10"
324
- - "2.5.8"
325
- - "2.6.9"
326
- - "2.7.7"
327
- - gem: "resque-2"
328
226
  - gem: "sequel"
329
- - gem: "sequel-435"
330
- only:
331
- ruby:
332
- - "2.0.0-p648"
333
- - "2.1.10"
334
- - "2.2.10"
335
- - "2.3.8"
336
- - "2.4.10"
337
- - "2.5.8"
338
- - "2.6.9"
339
- - "2.7.7"
340
227
  - gem: "sinatra"
341
228
  - gem: "webmachine1"
342
229
  - gem: "webmachine2"
data/ext/agent.rb CHANGED
@@ -1,12 +1,10 @@
1
- # frozen_string_literal: true
2
-
3
1
  # DO NOT EDIT
4
2
  # This is a generated file by the `rake ship` family of tasks in the
5
3
  # appsignal-agent repository.
6
4
  # Modifications to this file will be overwritten with the next agent release.
7
5
 
8
6
  APPSIGNAL_AGENT_CONFIG = {
9
- "version" => "6bec691",
7
+ "version" => "dee4fcb",
10
8
  "mirrors" => [
11
9
  "https://appsignal-agent-releases.global.ssl.fastly.net",
12
10
  "https://d135dj0rjqvssy.cloudfront.net"
@@ -14,131 +12,131 @@ APPSIGNAL_AGENT_CONFIG = {
14
12
  "triples" => {
15
13
  "x86_64-darwin" => {
16
14
  "static" => {
17
- "checksum" => "bef6b987040f2d5feb8d4e2d9483bfa89c75b709a1b9a297b4b736643b488c6a",
15
+ "checksum" => "d45bfc2eb38138c317b501c3156459b8dbbb15a59910f1e2ec3d2d02e461a147",
18
16
  "filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
19
17
  },
20
18
  "dynamic" => {
21
- "checksum" => "82b1f842b336a2b7c409d2d59f359288b6b2e641e870ead4ef0f8b98603e30f0",
19
+ "checksum" => "a126901650046ae1c40affd386ab5dfcda5cb89f9bd05cf0a3087faff1d2d77d",
22
20
  "filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
23
21
  }
24
22
  },
25
23
  "universal-darwin" => {
26
24
  "static" => {
27
- "checksum" => "bef6b987040f2d5feb8d4e2d9483bfa89c75b709a1b9a297b4b736643b488c6a",
25
+ "checksum" => "d45bfc2eb38138c317b501c3156459b8dbbb15a59910f1e2ec3d2d02e461a147",
28
26
  "filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
29
27
  },
30
28
  "dynamic" => {
31
- "checksum" => "82b1f842b336a2b7c409d2d59f359288b6b2e641e870ead4ef0f8b98603e30f0",
29
+ "checksum" => "a126901650046ae1c40affd386ab5dfcda5cb89f9bd05cf0a3087faff1d2d77d",
32
30
  "filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
33
31
  }
34
32
  },
35
33
  "aarch64-darwin" => {
36
34
  "static" => {
37
- "checksum" => "ff083420f6ac000d2791800ba641ee331ac8757e298939879ea6f35d35eea80b",
35
+ "checksum" => "1cd875e74ba18c2bc81533437a9eebdf08f624e0201427c13326c2be00f22907",
38
36
  "filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
39
37
  },
40
38
  "dynamic" => {
41
- "checksum" => "393e8a2812968d9a44afaf1fbf413cfb352af9dfd300f0d0f70865ba17e56ee2",
39
+ "checksum" => "d2243146bf4e5839a4cf4430870b7b87d6553e1da4dc631c9fb396bba094cea4",
42
40
  "filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
43
41
  }
44
42
  },
45
43
  "arm64-darwin" => {
46
44
  "static" => {
47
- "checksum" => "ff083420f6ac000d2791800ba641ee331ac8757e298939879ea6f35d35eea80b",
45
+ "checksum" => "1cd875e74ba18c2bc81533437a9eebdf08f624e0201427c13326c2be00f22907",
48
46
  "filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
49
47
  },
50
48
  "dynamic" => {
51
- "checksum" => "393e8a2812968d9a44afaf1fbf413cfb352af9dfd300f0d0f70865ba17e56ee2",
49
+ "checksum" => "d2243146bf4e5839a4cf4430870b7b87d6553e1da4dc631c9fb396bba094cea4",
52
50
  "filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
53
51
  }
54
52
  },
55
53
  "arm-darwin" => {
56
54
  "static" => {
57
- "checksum" => "ff083420f6ac000d2791800ba641ee331ac8757e298939879ea6f35d35eea80b",
55
+ "checksum" => "1cd875e74ba18c2bc81533437a9eebdf08f624e0201427c13326c2be00f22907",
58
56
  "filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
59
57
  },
60
58
  "dynamic" => {
61
- "checksum" => "393e8a2812968d9a44afaf1fbf413cfb352af9dfd300f0d0f70865ba17e56ee2",
59
+ "checksum" => "d2243146bf4e5839a4cf4430870b7b87d6553e1da4dc631c9fb396bba094cea4",
62
60
  "filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
63
61
  }
64
62
  },
65
63
  "aarch64-linux" => {
66
64
  "static" => {
67
- "checksum" => "755e1721befe259d4b13d914020ea7793399c1dc7abdce1e6695128f30e8670d",
65
+ "checksum" => "72fbfaa1c6ed72defea9eca59679372f53ddeab845a9b2f75d9d165e4983d69e",
68
66
  "filename" => "appsignal-aarch64-linux-all-static.tar.gz"
69
67
  },
70
68
  "dynamic" => {
71
- "checksum" => "2ab9d58d8a339aba33609411f17551b9f4aed017bc7ce1161c5a5d1303d4be79",
69
+ "checksum" => "bf31b4836c84ceaa87a52aa85f296d40e32cfd784a8aa5b19ec5ca3a4aa5c8eb",
72
70
  "filename" => "appsignal-aarch64-linux-all-dynamic.tar.gz"
73
71
  }
74
72
  },
75
73
  "i686-linux" => {
76
74
  "static" => {
77
- "checksum" => "2590d6ecb89242849ea7bd0923b074520fcf370c360095d2b25f2ea7a8f8e310",
75
+ "checksum" => "c504a7233512c9285274a7ba0142ab91cf4637c6f5f57c58c6890137ba0f82de",
78
76
  "filename" => "appsignal-i686-linux-all-static.tar.gz"
79
77
  },
80
78
  "dynamic" => {
81
- "checksum" => "dec855be6787fc39f212eb8fd3f424be0c09fe7538c71eb86fde5d76c891b0ff",
79
+ "checksum" => "19091f50e98afed547b73bc220770bdafce737e152ab9345dabe03e284219cc1",
82
80
  "filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
83
81
  }
84
82
  },
85
83
  "x86-linux" => {
86
84
  "static" => {
87
- "checksum" => "2590d6ecb89242849ea7bd0923b074520fcf370c360095d2b25f2ea7a8f8e310",
85
+ "checksum" => "c504a7233512c9285274a7ba0142ab91cf4637c6f5f57c58c6890137ba0f82de",
88
86
  "filename" => "appsignal-i686-linux-all-static.tar.gz"
89
87
  },
90
88
  "dynamic" => {
91
- "checksum" => "dec855be6787fc39f212eb8fd3f424be0c09fe7538c71eb86fde5d76c891b0ff",
89
+ "checksum" => "19091f50e98afed547b73bc220770bdafce737e152ab9345dabe03e284219cc1",
92
90
  "filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
93
91
  }
94
92
  },
95
93
  "x86_64-linux" => {
96
94
  "static" => {
97
- "checksum" => "54b033f215d84fbe819092a553e4921c77a2f686f9924f336c8312cb9efd1d57",
95
+ "checksum" => "f9e68dbbee7d38b255c5b9bc0cb75226764f79cd51421e4e00a9e7454b0c6ccb",
98
96
  "filename" => "appsignal-x86_64-linux-all-static.tar.gz"
99
97
  },
100
98
  "dynamic" => {
101
- "checksum" => "077e417344bd7eed10ca48e62d1ce777f8072e4ef8cc8c384faecb8309339250",
99
+ "checksum" => "58e3192c87903a2abce6540b893c9d25a69f43e37fd2367df45c2c22c26068ba",
102
100
  "filename" => "appsignal-x86_64-linux-all-dynamic.tar.gz"
103
101
  }
104
102
  },
105
103
  "x86_64-linux-musl" => {
106
104
  "static" => {
107
- "checksum" => "3c161e852b44e2f0ad1ccd849150255fc0ce39c3b0895fb003c403de12ced331",
105
+ "checksum" => "8fa1d110d2544502509cc66ba8ec6685010d8c6d8373f4f14ebe721d4be157e0",
108
106
  "filename" => "appsignal-x86_64-linux-musl-all-static.tar.gz"
109
107
  },
110
108
  "dynamic" => {
111
- "checksum" => "11ea5500197d98fc6bb06c09d61042e9547f2a0880d9367301665a201a176935",
109
+ "checksum" => "fc46dd29864165968d96bb78fde1c8970903488d80d97056e630636c736cf86f",
112
110
  "filename" => "appsignal-x86_64-linux-musl-all-dynamic.tar.gz"
113
111
  }
114
112
  },
115
113
  "aarch64-linux-musl" => {
116
114
  "static" => {
117
- "checksum" => "bed2cb1dc599528ac4bc1939da41900f4651013bc97433f2d1c2e6864acb6b7e",
115
+ "checksum" => "a43895183baf017879332885a904208773befc14b9bd628efae6d1513052b782",
118
116
  "filename" => "appsignal-aarch64-linux-musl-all-static.tar.gz"
119
117
  },
120
118
  "dynamic" => {
121
- "checksum" => "23e0ae75413b92c55b8c975347f647d5f603da56730ad926c3f7e6ddd050dba6",
119
+ "checksum" => "7e96b29348be655066cf162ae5c15248bba7d7177663e35e60a6c5ad243937d0",
122
120
  "filename" => "appsignal-aarch64-linux-musl-all-dynamic.tar.gz"
123
121
  }
124
122
  },
125
123
  "x86_64-freebsd" => {
126
124
  "static" => {
127
- "checksum" => "19b885bccb30a4209608ac1ac3ecaf07f1cd8e78c95dbdb94df51f73360c01bb",
125
+ "checksum" => "1b992f770bdbced09f7b5f18d7aa721710218d4a76a131adc7affe44d68684f0",
128
126
  "filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
129
127
  },
130
128
  "dynamic" => {
131
- "checksum" => "05555261c4c64f11cc96c6c499d0890ec3941d9c831e65b732cd2deaf0ddd216",
129
+ "checksum" => "300b718986c10ff65f237e1d74086e9cc0f7079d7b531e3b6f9a64752f1aa6ee",
132
130
  "filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
133
131
  }
134
132
  },
135
133
  "amd64-freebsd" => {
136
134
  "static" => {
137
- "checksum" => "19b885bccb30a4209608ac1ac3ecaf07f1cd8e78c95dbdb94df51f73360c01bb",
135
+ "checksum" => "1b992f770bdbced09f7b5f18d7aa721710218d4a76a131adc7affe44d68684f0",
138
136
  "filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
139
137
  },
140
138
  "dynamic" => {
141
- "checksum" => "05555261c4c64f11cc96c6c499d0890ec3941d9c831e65b732cd2deaf0ddd216",
139
+ "checksum" => "300b718986c10ff65f237e1d74086e9cc0f7079d7b531e3b6f9a64752f1aa6ee",
142
140
  "filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
143
141
  }
144
142
  }
@@ -324,7 +324,7 @@ module Appsignal
324
324
  ENV["_APPSIGNAL_ENABLE_HOST_METRICS"] = config_hash[:enable_host_metrics].to_s
325
325
  ENV["_APPSIGNAL_ENABLE_STATSD"] = config_hash[:enable_statsd].to_s
326
326
  ENV["_APPSIGNAL_ENABLE_NGINX_METRICS"] = config_hash[:enable_nginx_metrics].to_s
327
- ENV["_APPSIGNAL_APP_ENV"] = env
327
+ ENV["_APPSIGNAL_ENVIRONMENT"] = env
328
328
  ENV["_APPSIGNAL_FILES_WORLD_ACCESSIBLE"] = config_hash[:files_world_accessible].to_s
329
329
  ENV["_APPSIGNAL_FILTER_PARAMETERS"] = config_hash[:filter_parameters].join(",")
330
330
  ENV["_APPSIGNAL_FILTER_SESSION_DATA"] = config_hash[:filter_session_data].join(",")
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "logger"
4
4
  require "set"
5
+ require "thread"
5
6
 
6
7
  module Appsignal
7
8
  # Logger that flushes logs to the AppSignal logging service
@@ -27,12 +28,13 @@ module Appsignal
27
28
  @group = group
28
29
  @level = level
29
30
  @format = format
31
+ @mutex = Mutex.new
30
32
  end
31
33
 
32
34
  # We support the various methods in the Ruby
33
35
  # logger class by supplying this method.
34
36
  # @api private
35
- def add(severity, message = nil, group = nil, attributes = {})
37
+ def add(severity, message = nil, group = nil)
36
38
  severity ||= UNKNOWN
37
39
  return true if severity < level
38
40
  group = @group if group.nil?
@@ -52,7 +54,7 @@ module Appsignal
52
54
  SEVERITY_MAP.fetch(severity, 0),
53
55
  @format,
54
56
  message,
55
- Appsignal::Utils::Data.generate(attributes)
57
+ Appsignal::Utils::Data.generate(appsignal_attributes)
56
58
  )
57
59
  end
58
60
  alias log add
@@ -65,7 +67,7 @@ module Appsignal
65
67
  return if DEBUG < level
66
68
  message = yield if message.nil? && block_given?
67
69
  return if message.nil?
68
- add(DEBUG, message, @group, attributes)
70
+ add_with_attributes(DEBUG, message, @group, attributes)
69
71
  end
70
72
 
71
73
  # Log an info level message
@@ -76,7 +78,7 @@ module Appsignal
76
78
  return if INFO < level
77
79
  message = yield if message.nil? && block_given?
78
80
  return if message.nil?
79
- add(INFO, message, @group, attributes)
81
+ add_with_attributes(INFO, message, @group, attributes)
80
82
  end
81
83
 
82
84
  # Log a warn level message
@@ -87,7 +89,7 @@ module Appsignal
87
89
  return if WARN < level
88
90
  message = yield if message.nil? && block_given?
89
91
  return if message.nil?
90
- add(WARN, message, @group, attributes)
92
+ add_with_attributes(WARN, message, @group, attributes)
91
93
  end
92
94
 
93
95
  # Log an error level message
@@ -98,7 +100,7 @@ module Appsignal
98
100
  return if ERROR < level
99
101
  message = yield if message.nil? && block_given?
100
102
  return if message.nil?
101
- add(ERROR, message, @group, attributes)
103
+ add_with_attributes(ERROR, message, @group, attributes)
102
104
  end
103
105
 
104
106
  # Log a fatal level message
@@ -109,7 +111,20 @@ module Appsignal
109
111
  return if FATAL < level
110
112
  message = yield if message.nil? && block_given?
111
113
  return if message.nil?
112
- add(FATAL, message, @group, attributes)
114
+ add_with_attributes(FATAL, message, @group, attributes)
115
+ end
116
+
117
+ private
118
+
119
+ def add_with_attributes(severity, message, group, attributes)
120
+ Thread.current[:appsignal_logger_attributes] = attributes
121
+ add(severity, message, group)
122
+ ensure
123
+ Thread.current[:appsignal_logger_attributes] = nil
124
+ end
125
+
126
+ def appsignal_attributes
127
+ Thread.current.fetch(:appsignal_logger_attributes, {})
113
128
  end
114
129
  end
115
130
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "3.3.11".freeze
4
+ VERSION = "3.4.0".freeze
5
5
  end
@@ -622,7 +622,7 @@ describe Appsignal::Config do
622
622
  expect(ENV["_APPSIGNAL_PUSH_API_ENDPOINT"]).to eq "https://push.appsignal.com"
623
623
  expect(ENV["_APPSIGNAL_PUSH_API_KEY"]).to eq "abc"
624
624
  expect(ENV["_APPSIGNAL_APP_NAME"]).to eq "TestApp"
625
- expect(ENV["_APPSIGNAL_APP_ENV"]).to eq "production"
625
+ expect(ENV["_APPSIGNAL_ENVIRONMENT"]).to eq "production"
626
626
  expect(ENV["_APPSIGNAL_LANGUAGE_INTEGRATION_VERSION"]).to eq "ruby-#{Appsignal::VERSION}"
627
627
  expect(ENV["_APPSIGNAL_HTTP_PROXY"]).to eq "http://localhost"
628
628
  expect(ENV["_APPSIGNAL_IGNORE_ACTIONS"]).to eq "action1,action2"
@@ -76,13 +76,15 @@ describe Appsignal::Logger do
76
76
  ].each do |method|
77
77
  describe "##{method[0]}" do
78
78
  it "should log with a message" do
79
+ # rubocop:disable Style/BracesAroundHashParameters
79
80
  expect(Appsignal::Utils::Data).to receive(:generate)
80
- .with({})
81
+ .with({ :attribute => "value" })
81
82
  .and_call_original
83
+ # rubocop:enable Style/BracesAroundHashParameters
82
84
  expect(Appsignal::Extension).to receive(:log)
83
85
  .with("group", method[1], 0, "Log message", instance_of(Appsignal::Extension::Data))
84
86
 
85
- logger.send(method[0], "Log message")
87
+ logger.send(method[0], "Log message", :attribute => "value")
86
88
  end
87
89
 
88
90
  it "should log with a block" do