plain_apm 0.5.6 → 0.6.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 127051af59250da7ce13cfc7c819caff29fb954d20399398e72eaf02ae3fecc4
|
4
|
+
data.tar.gz: 3c3f321becb4e79da27c6a09194c44fc5ec11a73f9e70a9ff55ce7833984fb73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 752b27ebb2ab36147e85af199e939a25a666a738a772077a23ea3033577e966d0afbc773c1bd3f5614c1815deb7ca32395b49628de6b487a4bd214ad96955b27
|
7
|
+
data.tar.gz: 40d0f21220a4e118abcb767951730c743ac89787d9cfa6b2d421cad597c2e38ab5fae56ccc0fb9dd6b707d2344343660680440d6df089241fb2b8e579e0709fb
|
data/lib/plain_apm/agent.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PlainApm
|
4
|
+
module Hooks
|
5
|
+
class ActiveSupport < ActiveSupportSubscriber
|
6
|
+
NOTIFICATION_PATTERN = /\Acache_[\w\?]+\.active_support\Z/.freeze
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def notification_pattern
|
11
|
+
NOTIFICATION_PATTERN
|
12
|
+
end
|
13
|
+
|
14
|
+
def payload(event)
|
15
|
+
name, source = *event.name.split(".")
|
16
|
+
payload = event.payload
|
17
|
+
|
18
|
+
base = {
|
19
|
+
"source" => source,
|
20
|
+
"name" => name,
|
21
|
+
"backtrace" => filtered_backtrace,
|
22
|
+
"started_at" => event.time,
|
23
|
+
"finished_at" => event.end,
|
24
|
+
"allocations" => event.allocations,
|
25
|
+
"thread_allocations" => event.thread_allocations,
|
26
|
+
"store" => payload[:store]
|
27
|
+
}
|
28
|
+
|
29
|
+
case name
|
30
|
+
when "cache_read"
|
31
|
+
base.merge({
|
32
|
+
"key" => payload[:key],
|
33
|
+
"hit" => payload[:hit],
|
34
|
+
"trigger" => payload[:super_operation],
|
35
|
+
})
|
36
|
+
when "cache_read_multi"
|
37
|
+
base.merge({
|
38
|
+
"keys" => payload[:key],
|
39
|
+
"hits" => payload[:hits]
|
40
|
+
})
|
41
|
+
when "cache_fetch_hit"
|
42
|
+
base.merge({
|
43
|
+
"key" => payload[:key],
|
44
|
+
"hit" => true
|
45
|
+
})
|
46
|
+
when "cache_write", "cache_write_multi", "cache_generate", "cache_delete", "cache_delete_matched", "cache_exist?"
|
47
|
+
base.merge({
|
48
|
+
"key" => payload[:key]
|
49
|
+
})
|
50
|
+
when "cache_increment", "cache_decrement"
|
51
|
+
base.merge({
|
52
|
+
"key" => payload[:key],
|
53
|
+
"amount" => payload[:amount]
|
54
|
+
})
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -17,7 +17,7 @@ module PlainApm
|
|
17
17
|
|
18
18
|
# Install the hook when the app is up. This might miss errors that
|
19
19
|
# happen before that, but that's OK.
|
20
|
-
ActiveSupport.on_load(:after_initialize, yield: self, run_once: true) do
|
20
|
+
::ActiveSupport.on_load(:after_initialize, yield: self, run_once: true) do
|
21
21
|
::Rails.error.subscribe(self)
|
22
22
|
end
|
23
23
|
end
|
@@ -36,6 +36,13 @@ module PlainApm
|
|
36
36
|
"context" => context
|
37
37
|
}
|
38
38
|
|
39
|
+
if context[:job] && context[:job].is_a?(ActiveJob::Base)
|
40
|
+
event.merge!({
|
41
|
+
"job_class" => context[:job].class.name,
|
42
|
+
"queue_name" => context[:job].queue_name
|
43
|
+
})
|
44
|
+
end
|
45
|
+
|
39
46
|
if e.cause
|
40
47
|
event.merge!({
|
41
48
|
"cause_class" => e.cause.class.name,
|
data/lib/plain_apm/version.rb
CHANGED
data/lib/plain_apm.rb
CHANGED
@@ -34,6 +34,7 @@ require_relative "plain_apm/hooks/action_pack"
|
|
34
34
|
require_relative "plain_apm/hooks/action_view"
|
35
35
|
require_relative "plain_apm/hooks/active_job"
|
36
36
|
require_relative "plain_apm/hooks/active_record"
|
37
|
+
require_relative "plain_apm/hooks/active_support"
|
37
38
|
require_relative "plain_apm/hooks/manual"
|
38
39
|
require_relative "plain_apm/hooks/error_reporter"
|
39
40
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plain_apm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PlainAPM Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/plain_apm/hooks/action_view.rb
|
115
115
|
- lib/plain_apm/hooks/active_job.rb
|
116
116
|
- lib/plain_apm/hooks/active_record.rb
|
117
|
+
- lib/plain_apm/hooks/active_support.rb
|
117
118
|
- lib/plain_apm/hooks/active_support_subscriber.rb
|
118
119
|
- lib/plain_apm/hooks/deploy.rb
|
119
120
|
- lib/plain_apm/hooks/error_reporter.rb
|