plain_apm 0.8.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2b710d576d9940ab2def7718d734c7b4665ca27b1c92de976e2dbdbe27df7c3
4
- data.tar.gz: 1c25404189e867c88edfdb4f98b089ae99a731961a6ee44f154bd718d246e60f
3
+ metadata.gz: d86c0595be8ac7a6b538a81136b6c5c17baa0d32c975cd51866f189d0b19f6ca
4
+ data.tar.gz: e28e7b234659abaa0e0659f7b55dc5acdaa561ecafbdddb65b403eb392411363
5
5
  SHA512:
6
- metadata.gz: 0f043623e89b5dd6fc2c725151a61b161cf59be1e29ef73fd9e47faec8e3007b93f52a7a33ee7fd351040f1ae111e73bee34d4ef7db73b48b949948f4a252d20
7
- data.tar.gz: a42e2dfd3bbae6eda795c9526af4ecb4cb33d61f052ba8815ec922a207aaa1a4ccdb9249c810665404bda8958220b9c6960fed6064aa28575021ead810d205cd
6
+ metadata.gz: 32422cfac6f7d9bd3fc73c5720be2e6ec0f85c34c5c4a1a6b4b073cd203fc387c472b1c9a17ae217a4fa0046665dcf73835ec0c9ae92a523bab6a162190a48df
7
+ data.tar.gz: 30181e92f6df8e2717f6a0265504ccf5db16eb34c0c6d061b7682e437434b4338edf145f9d8dd8a334f6528a13d5fdc175c14c3c1798c42730ca204800b27603
@@ -118,7 +118,7 @@ module PlainApm
118
118
  # or is generated by the trace_id middleware).
119
119
  # It can also carry user inserted app data.
120
120
  if defined?(PlainApm::Extensions::Context)
121
- PlainApm::Extensions::Context.current
121
+ PlainApm::Extensions::Context.current.transform_keys(&:to_s)
122
122
  else
123
123
  {}
124
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 scheduled for Rails 7.1.
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
- ::Rack::BodyProxy.new(body) do
26
- Context.clear!
27
- end
28
- else
29
- body
30
- end
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
 
@@ -6,6 +6,13 @@
6
6
  # https://github.com/steveklabnik/request_store/
7
7
  #
8
8
  # See LICENSE.txt in the current directory for the license.
9
+
10
+ begin
11
+ require "rails/railtie"
12
+ rescue LoadError
13
+ nil
14
+ end
15
+
9
16
  module PlainApm
10
17
  module Extensions
11
18
  module Context
@@ -1,5 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ begin
4
+ require "rails/railtie"
5
+ rescue LoadError
6
+ nil
7
+ end
8
+
3
9
  module PlainApm
4
10
  module Extensions
5
11
  module Exceptions
@@ -1,3 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require "rails/railtie"
5
+ rescue LoadError
6
+ nil
7
+ end
8
+
1
9
  module PlainApm
2
10
  module Extensions
3
11
  module ThreadAllocations
@@ -49,11 +49,19 @@ module PlainApm
49
49
  private
50
50
 
51
51
  def enqueued_at(job)
52
- Time.parse(job.enqueued_at).to_f if job.enqueued_at
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
- Time.parse(job.dequeued_at).to_f if job.respond_to?(:dequeued_at) && job.dequeued_at
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
@@ -1,5 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ begin
4
+ require "active_support"
5
+ require "active_support/notifications"
6
+ rescue LoadError
7
+ nil
8
+ end
9
+
3
10
  module PlainApm
4
11
  module Hooks
5
12
  class ActiveSupportSubscriber
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlainApm
4
- VERSION = "0.8.2"
4
+ VERSION = "0.8.3"
5
5
  end
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.2
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-12-28 00:00:00.000000000 Z
11
+ date: 2023-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest