plain_apm 0.8.1 → 0.8.3
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/lib/plain_apm/event_attributes.rb +6 -2
- data/lib/plain_apm/extensions/context/active_job.rb +1 -1
- data/lib/plain_apm/extensions/context/rack.rb +6 -6
- data/lib/plain_apm/extensions/context/railtie.rb +7 -0
- data/lib/plain_apm/extensions/exceptions/rack.rb +1 -1
- data/lib/plain_apm/extensions/exceptions/railtie.rb +6 -0
- data/lib/plain_apm/extensions/thread_allocations/railtie.rb +8 -0
- data/lib/plain_apm/hooks/active_job.rb +10 -2
- data/lib/plain_apm/hooks/active_support_subscriber.rb +7 -0
- data/lib/plain_apm/hooks/error_reporter.rb +3 -3
- data/lib/plain_apm/version.rb +1 -1
- data/lib/plain_apm.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d86c0595be8ac7a6b538a81136b6c5c17baa0d32c975cd51866f189d0b19f6ca
|
|
4
|
+
data.tar.gz: e28e7b234659abaa0e0659f7b55dc5acdaa561ecafbdddb65b403eb392411363
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32422cfac6f7d9bd3fc73c5720be2e6ec0f85c34c5c4a1a6b4b073cd203fc387c472b1c9a17ae217a4fa0046665dcf73835ec0c9ae92a523bab6a162190a48df
|
|
7
|
+
data.tar.gz: 30181e92f6df8e2717f6a0265504ccf5db16eb34c0c6d061b7682e437434b4338edf145f9d8dd8a334f6528a13d5fdc175c14c3c1798c42730ca204800b27603
|
|
@@ -31,7 +31,7 @@ module PlainApm
|
|
|
31
31
|
[tool, attrs]
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def attributes_from_exception(e, context)
|
|
34
|
+
def attributes_from_exception(e, context, error_source)
|
|
35
35
|
source = "exception"
|
|
36
36
|
|
|
37
37
|
return [source, nil] if IGNORED_EXCEPTIONS.include?(e.class.name)
|
|
@@ -42,6 +42,10 @@ module PlainApm
|
|
|
42
42
|
"backtrace" => e.backtrace
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
if error_source
|
|
46
|
+
attrs["event_source"] = error_source
|
|
47
|
+
end
|
|
48
|
+
|
|
45
49
|
if context[:env]
|
|
46
50
|
attrs["params"] = context[:env]["action_dispatch.request.parameters"]
|
|
47
51
|
end
|
|
@@ -114,7 +118,7 @@ module PlainApm
|
|
|
114
118
|
# or is generated by the trace_id middleware).
|
|
115
119
|
# It can also carry user inserted app data.
|
|
116
120
|
if defined?(PlainApm::Extensions::Context)
|
|
117
|
-
PlainApm::Extensions::Context.current
|
|
121
|
+
PlainApm::Extensions::Context.current.transform_keys(&:to_s)
|
|
118
122
|
else
|
|
119
123
|
{}
|
|
120
124
|
end
|
|
@@ -12,7 +12,7 @@ module PlainApm
|
|
|
12
12
|
def serialize
|
|
13
13
|
trace_id = PlainApm::Extensions::Context.trace_id || SecureRandom.uuid
|
|
14
14
|
# Rails wasn't preserving the nano-time, this has now been fixed
|
|
15
|
-
# upstream in #39698 and
|
|
15
|
+
# upstream in #39698 and fixed in Rails 7.1.
|
|
16
16
|
super.update("trace_id" => trace_id, "enqueued_at" => Time.now.utc.iso8601(9))
|
|
17
17
|
end
|
|
18
18
|
|
|
@@ -22,12 +22,12 @@ module PlainApm
|
|
|
22
22
|
status, headers, body = @app.call(env)
|
|
23
23
|
|
|
24
24
|
body = if defined?(::Rack::BodyProxy)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
::Rack::BodyProxy.new(body) do
|
|
26
|
+
Context.clear!
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
body
|
|
30
|
+
end
|
|
31
31
|
|
|
32
32
|
processed = true
|
|
33
33
|
|
|
@@ -49,11 +49,19 @@ module PlainApm
|
|
|
49
49
|
private
|
|
50
50
|
|
|
51
51
|
def enqueued_at(job)
|
|
52
|
-
|
|
52
|
+
if job.enqueued_at
|
|
53
|
+
if job.enqueued_at.is_a?(Time)
|
|
54
|
+
job.enqueued_at.iso8601(9)
|
|
55
|
+
else
|
|
56
|
+
Time.parse(job.enqueued_at).iso8601(9)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
53
59
|
end
|
|
54
60
|
|
|
55
61
|
def dequeued_at(job)
|
|
56
|
-
|
|
62
|
+
if job.respond_to?(:dequeued_at) && job.dequeued_at
|
|
63
|
+
Time.parse(job.dequeued_at).iso8601(9)
|
|
64
|
+
end
|
|
57
65
|
end
|
|
58
66
|
end
|
|
59
67
|
end
|
|
@@ -22,12 +22,12 @@ module PlainApm
|
|
|
22
22
|
subscribers&.delete(self)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def collect(e, handled:, severity:, context: {})
|
|
26
|
-
|
|
25
|
+
def collect(e, handled:, severity:, context: {}, source: nil)
|
|
26
|
+
event_source, event = attributes_from_exception(e, context, source)
|
|
27
27
|
|
|
28
28
|
return if event.nil?
|
|
29
29
|
|
|
30
|
-
event["source"] =
|
|
30
|
+
event["source"] = event_source
|
|
31
31
|
event["name"] = "error_reporter"
|
|
32
32
|
|
|
33
33
|
::PlainApm.agent.collect(event)
|
data/lib/plain_apm/version.rb
CHANGED
data/lib/plain_apm.rb
CHANGED
|
@@ -51,6 +51,12 @@ module PlainApm
|
|
|
51
51
|
@@agent ||= Agent.instance
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
+
begin
|
|
55
|
+
require "rails/railtie"
|
|
56
|
+
rescue LoadError
|
|
57
|
+
nil
|
|
58
|
+
end
|
|
59
|
+
|
|
54
60
|
# after_initialize allows reading settings from ENV on app start.
|
|
55
61
|
if defined?(Rails::Railtie)
|
|
56
62
|
class Railtie < Rails::Railtie
|
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.8.
|
|
4
|
+
version: 0.8.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- PlainAPM Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-12-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: minitest
|