appsignal 3.1.1 → 3.1.4

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.
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: 3.1.1
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-07-28 00:00:00.000000000 Z
13
+ date: 2022-08-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -69,35 +69,35 @@ dependencies:
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  - !ruby/object:Gem::Dependency
72
- name: webmock
72
+ name: yard
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - ">="
76
76
  - !ruby/object:Gem::Version
77
- version: '0'
77
+ version: 0.9.20
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
82
  - - ">="
83
83
  - !ruby/object:Gem::Version
84
- version: '0'
84
+ version: 0.9.20
85
85
  - !ruby/object:Gem::Dependency
86
- name: yard
86
+ name: pry
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: 0.9.20
91
+ version: '0'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- version: 0.9.20
98
+ version: '0'
99
99
  - !ruby/object:Gem::Dependency
100
- name: pry
100
+ name: webmock
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - ">="
@@ -204,7 +204,7 @@ files:
204
204
  - lib/appsignal/event_formatter/sequel/sql_formatter.rb
205
205
  - lib/appsignal/extension.rb
206
206
  - lib/appsignal/extension/jruby.rb
207
- - lib/appsignal/garbage_collection_profiler.rb
207
+ - lib/appsignal/garbage_collection.rb
208
208
  - lib/appsignal/helpers/instrumentation.rb
209
209
  - lib/appsignal/helpers/metrics.rb
210
210
  - lib/appsignal/hooks.rb
@@ -305,7 +305,7 @@ files:
305
305
  - spec/lib/appsignal/extension/jruby_spec.rb
306
306
  - spec/lib/appsignal/extension_install_failure_spec.rb
307
307
  - spec/lib/appsignal/extension_spec.rb
308
- - spec/lib/appsignal/garbage_collection_profiler_spec.rb
308
+ - spec/lib/appsignal/garbage_collection_spec.rb
309
309
  - spec/lib/appsignal/hooks/action_cable_spec.rb
310
310
  - spec/lib/appsignal/hooks/action_mailer_spec.rb
311
311
  - spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
@@ -457,7 +457,7 @@ test_files:
457
457
  - spec/lib/appsignal/extension/jruby_spec.rb
458
458
  - spec/lib/appsignal/extension_install_failure_spec.rb
459
459
  - spec/lib/appsignal/extension_spec.rb
460
- - spec/lib/appsignal/garbage_collection_profiler_spec.rb
460
+ - spec/lib/appsignal/garbage_collection_spec.rb
461
461
  - spec/lib/appsignal/hooks/action_cable_spec.rb
462
462
  - spec/lib/appsignal/hooks/action_mailer_spec.rb
463
463
  - spec/lib/appsignal/hooks/active_support_notifications/finish_with_state_shared_examples.rb
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Appsignal
4
- # {Appsignal::GarbageCollectionProfiler} wraps Ruby's `GC::Profiler` to be
5
- # able to track garbage collection time for multiple transactions, while
6
- # constantly clearing `GC::Profiler`'s total_time to make sure it doesn't
7
- # leak memory by keeping garbage collection run samples in memory.
8
- #
9
- # @api private
10
- class GarbageCollectionProfiler
11
- def self.lock
12
- @lock ||= Mutex.new
13
- end
14
-
15
- def initialize
16
- @total_time = 0
17
- end
18
-
19
- # Whenever {#total_time} is called, the current `GC::Profiler#total_time`
20
- # gets added to `@total_time`, after which `GC::Profiler.clear` is called
21
- # to prevent it from leaking memory. A class-level lock is used to make
22
- # sure garbage collection time is never counted more than once.
23
- #
24
- # Whenever `@total_time` gets above two billion milliseconds (about 23
25
- # days), it's reset to make sure the result fits in a signed 32-bit
26
- # integer.
27
- #
28
- # @return [Integer]
29
- def total_time
30
- lock.synchronize do
31
- @total_time += (internal_profiler.total_time * 1000).round
32
- internal_profiler.clear
33
- end
34
-
35
- @total_time = 0 if @total_time > 2_000_000_000
36
-
37
- @total_time
38
- end
39
-
40
- private
41
-
42
- def internal_profiler
43
- GC::Profiler
44
- end
45
-
46
- def lock
47
- self.class.lock
48
- end
49
- end
50
-
51
- # {Appsignal::NilGarbageCollectionProfiler} is a dummy profiler
52
- # that always returns 0 as the total time.
53
- # Used when we don't want any profile information
54
- #
55
- # @api private
56
- class NilGarbageCollectionProfiler
57
- def total_time
58
- 0
59
- end
60
- end
61
- end