plain_apm 0.9.4 → 0.9.6

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: bbc80ac73a8d6b499ba00f4ec728d83359225be1563dc81f61599b7c9dbdab9d
4
- data.tar.gz: a885c23479749c60b4aa62df8e199bedfafd22190ab4578d5ee42cf2664b3cce
3
+ metadata.gz: c04ad1d3800e79ca5956ab34d933a7d22a978c339c38a101dbc372cdea8cb34b
4
+ data.tar.gz: c69b2e6c160f7143ccbc8c4bc6e85f80af2e1fcb327e446bc68d92ce1ab03a23
5
5
  SHA512:
6
- metadata.gz: f02c96c5f98ca5a2d8d36ba0c4c5e8454799572e0dcc455d940f5b73151346de21c767cdf6b20b1bc0f25140d404f535c71e40f7bdc296963b23020bc7b7f1c5
7
- data.tar.gz: 2ed255c00a300a1b6f8de0a64947e354462fab28a254847bd86eed49f89632cf49a8e0d1935b71196b061dc8bef009b0153a1aa5a09cd634dd078e8fd2bdd343
6
+ metadata.gz: 1294d748d9cedc00e5433dd8a520f5a69a6458ab749a314115565bdac63bebaaeaf4c533432d04db8c55a3a1eee07612ae633e205a5c79fed488b3baba1105a3
7
+ data.tar.gz: 95a27cb67aeb768088ceb852ad6be44adce0c81ba40f1e54f9dac65f874dc6d01e70ce14b9d2b09e8af6a9bee865d377e512253cabe604c2d2d495cb1235d55a
@@ -1,14 +1,17 @@
1
1
  module PlainApm
2
2
  module Helpers
3
3
  def plain_apm_context(context = {})
4
- return unless PlainApm.agent.enabled?
4
+ return context unless PlainApm.agent.enabled?
5
5
  PlainApm::Extensions::Context.context.merge!(context)
6
6
  end
7
7
 
8
8
  def plain_apm_instrument(name, context = {}, &block)
9
- return unless PlainApm.agent.enabled? && defined?(ActiveSupport::Notifications)
10
- sanitized_name = name.gsub(/\W/, "_").gsub(/(?!^)([A-Z])/) { |m| "_#{m}" }.squeeze("_").downcase
11
- ActiveSupport::Notifications.instrument("#{sanitized_name}.manual_plain_apm", **context, &block)
9
+ if PlainApm.agent.enabled? && defined?(ActiveSupport::Notifications)
10
+ sanitized_name = name.gsub(/\W/, "_").gsub(/(?!^)([A-Z])/) { |m| "_#{m}" }.squeeze("_").downcase
11
+ ActiveSupport::Notifications.instrument("#{sanitized_name}.manual_plain_apm", **context, &block)
12
+ else
13
+ yield if block
14
+ end
12
15
  end
13
16
  end
14
17
  end
@@ -45,11 +45,8 @@ module PlainApm
45
45
 
46
46
  # strip rails root
47
47
  def identifier(id)
48
- return id unless defined?(Rails) && Rails.respond_to?(:root)
49
-
50
- root = Rails.root.to_s
51
-
52
- id.start_with?(root) ? id[root.size + 1..-1] : id # standard:disable Style/SlicingWithRange
48
+ return id if self.class.rails_root.nil? || id.nil?
49
+ id.start_with?(self.class.rails_root) ? id[self.class.rails_root.length + 1..-1] : id # standard:disable Style/SlicingWithRange
53
50
  end
54
51
  end
55
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlainApm
4
- VERSION = "0.9.4"
4
+ VERSION = "0.9.6"
5
5
  end
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.9.4
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - PlainAPM Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-06 00:00:00.000000000 Z
11
+ date: 2024-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest